39 std::setlocale(LC_ALL,
"En_US");
41 std::string objectPoseFile = getProperty<std::string>(
"ObjectPoseFile").getValue();
44 ARMARX_ERROR <<
"Could not find object pose file file in ArmarXDataPath: "
49 std::stringstream fileContent;
53 input.exceptions(std::ifstream::failbit | std::ifstream::badbit);
54 input.open(objectPoseFile, std::ios::binary);
55 fileContent <<
input.rdbuf();
57 catch (std::exception
const& ex)
59 ARMARX_WARNING <<
"Could not open or read from file: " << objectPoseFile;
62 ARMARX_INFO <<
"File content: " << fileContent.str();
68 std::vector<std::string> objectNames = j.getMemberNames();
70 for (std::string
const& objectName : objectNames)
74 object.
name = objectName;
76 Json::Value map = j.get(objectName, Json::Value::null);
77 std::string encodedPose = map[
"pose"].asString();
78 std::string frame = map[
"frame"].asString();
79 std::string agent = map[
"agent"].asString();
81 std::istringstream poseInput(encodedPose);
83 for (
int row = 0; row < 4; ++row)
85 for (
int column = 0; column < 4; ++column)
88 if (poseInput >>
value)
90 pose.col(column)[row] =
value;
101 dummyObjects.push_back(
object);
105 usingProxy(getProperty<std::string>(
"RobotStateComponentName").getValue());
113 ARMARX_INFO <<
"Object '" <<
object.name <<
"': " << *
object.pose;
117 robotStateComponent = getProxy<armarx::RobotStateComponentInterfacePrx>(
118 getProperty<std::string>(
"RobotStateComponentName").getValue());
138 memoryx::ObjectLocalizationResultList
142 memoryx::ObjectLocalizationResultList result;
143 result.reserve(dummyObjects.size());
150 if (std::find(classes.begin(), classes.end(),
object.name) == classes.end())
157 memoryx::ObjectLocalizationResult localizedObject;
159 localizedObject.objectClassName =
object.name;
160 ARMARX_INFO <<
"Reporting: " <<
object.name <<
" at " << poseInRootFrame->output();
161 localizedObject.position = poseInRootFrame->getPosition();
162 localizedObject.orientation = poseInRootFrame->getOrientation();
164 localizedObject.recognitionCertainty = 1.0f;
166 localizedObject.positionNoise =
169 localizedObject.timeStamp = now;
172 result.push_back(localizedObject);