39 std::setlocale(LC_ALL,
"En_US");
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);
113 ARMARX_INFO <<
"Object '" <<
object.name <<
"': " << *
object.pose;
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);
static bool getAbsolutePath(const std::string &relativeFilename, std::string &storeAbsoluteFilename, const std::vector< std::string > &additionalSearchPaths={}, bool verbose=true)
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Property< PropertyType > getProperty(const std::string &name)
void onInitComponent() override
void onDisconnectComponent() override
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
memoryx::ObjectLocalizationResultList localizeObjectClasses(const memoryx::ObjectClassNameList &classes, const Ice::Current &) override
void onConnectComponent() override
void onExitComponent() override
The JSONObject class is used to represent and (de)serialize JSON objects.
const Json::Value & getJsonValue() const
void fromString(const ::std::string &jsonString, const ::Ice::Current &=Ice::emptyCurrent) override
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
static TimestampVariantPtr nowPtr()
static MultivariateNormalDistributionPtr CreateDefaultDistribution(float variance=10000)
Create a distribution with uncertainty of variance in all directions (default: variance = 10000,...
#define ARMARX_INFO
The normal logging level.
#define ARMARX_ERROR
The logging level for unexpected behaviour, that must be fixed.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
::IceInternal::ProxyHandle<::IceProxy::armarx::SharedRobotInterface > SharedRobotInterfacePrx
IceInternal::Handle< TimestampVariant > TimestampVariantPtr
IceInternal::Handle< FramedPose > FramedPosePtr