36 std::setlocale(LC_ALL,
"En_US");
38 std::string objectPoseFile = getProperty<std::string>(
"ObjectPoseFile").getValue();
41 ARMARX_ERROR <<
"Could not find object pose file file in ArmarXDataPath: " << objectPoseFile;
45 std::stringstream fileContent;
49 input.exceptions(std::ifstream::failbit | std::ifstream::badbit);
50 input.open(objectPoseFile, std::ios::binary);
51 fileContent <<
input.rdbuf();
53 catch (std::exception
const& ex)
55 ARMARX_WARNING <<
"Could not open or read from file: " << objectPoseFile;
58 ARMARX_INFO <<
"File content: " << fileContent.str();
64 std::vector<std::string> objectNames = j.getMemberNames();
66 for (std::string
const& objectName : objectNames)
70 object.
name = objectName;
72 Json::Value map = j.get(objectName, Json::Value::null);
73 std::string encodedPose = map[
"pose"].asString();
74 std::string frame = map[
"frame"].asString();
75 std::string agent = map[
"agent"].asString();
77 std::istringstream poseInput(encodedPose);
79 for (
int row = 0; row < 4; ++row)
81 for (
int column = 0; column < 4; ++column)
84 if (poseInput >>
value)
86 pose.col(column)[row] =
value;
97 dummyObjects.push_back(
object);
101 usingProxy(getProperty<std::string>(
"RobotStateComponentName").getValue());
109 ARMARX_INFO <<
"Object '" <<
object.name <<
"': " << *
object.pose;
113 robotStateComponent = getProxy<armarx::RobotStateComponentInterfacePrx>(getProperty<std::string>(
"RobotStateComponentName").getValue());
138 memoryx::ObjectLocalizationResultList result;
139 result.reserve(dummyObjects.size());
146 if (std::find(classes.begin(), classes.end(),
object.name) == classes.end())
153 memoryx::ObjectLocalizationResult localizedObject;
155 localizedObject.objectClassName =
object.name;
156 ARMARX_INFO <<
"Reporting: " <<
object.name <<
" at " << poseInRootFrame->output();
157 localizedObject.position = poseInRootFrame->getPosition();
158 localizedObject.orientation = poseInRootFrame->getOrientation();
160 localizedObject.recognitionCertainty = 1.0f;
164 localizedObject.timeStamp = now;
167 result.push_back(localizedObject);