32#include <VirtualRobot/MathTools.h>
40#include <RobotAPI/interface/components/ViewSelectionInterface.h>
43#include <MemoryX/interface/memorytypes/MemoryEntities.h>
88 std::stringstream strStr;
90 strStr <<
"SceneModificationType";
97 ARMARX_DEBUG <<
"Checking for property " << strStr.str() <<
"...";
108 ARMARX_DEBUG <<
"Failed to get property " << strStr.str() <<
"...";
117 if (mode ==
"addObject")
121 else if (mode ==
"removeObject")
125 else if (mode ==
"moveObject")
129 else if (mode !=
"none")
151 for (
int i = 0; i < 10; i++)
153 std::stringstream strStr;
175 std::string attachObjectName =
177 std::string attachRobotName =
179 std::string attachRobotNodeName =
182 if (!attachObjectName.empty() && !attachRobotName.empty() && !attachRobotNodeName.empty())
184 ARMARX_VERBOSE <<
"Attaching " << attachObjectName <<
"to robot " << attachRobotName
185 <<
" at robot node " << attachRobotNodeName;
186 attachObject(attachObjectName, attachRobotName, attachRobotNodeName);
199 std::stringstream ss1, ss2, ss3, ss4, ss5, ss6;
203 ss4 <<
"OrientationRoll";
204 ss5 <<
"OrientationPitch";
205 ss6 <<
"OrientationYaw";
224 Eigen::Vector3f pos = {
x, y, z};
225 Eigen::Matrix4f globalPose;
226 VirtualRobot::MathTools::rpy2eigen4f(ro,
pi, ya, globalPose);
227 globalPose.block<3, 1>(0, 3) = pos;
234 std::stringstream ss1;
235 ss1 <<
"StaticObject";
250 const std::string& robotName,
251 const std::string& robotNodeName)
255 ARMARX_ERROR <<
"Object " << objName <<
" is not present in simulator...";
261 ARMARX_ERROR <<
"Robot " << robotName <<
" is not present in simulator...";
265 if (!
simulatorPrx->hasRobotNode(robotName, robotNodeName))
267 ARMARX_ERROR <<
"Robot node " << robotNodeName <<
" is not present in simulator...";
271 simulatorPrx->objectGrasped(robotName, robotNodeName, objName);
277 std::stringstream ss1, ss2;
278 ss1 <<
"ObjectClassName";
279 ss2 <<
"ObjectInstanceName";
287 ARMARX_DEBUG <<
"checking for object class property: " << ss1.str()
288 <<
", and instance name:" << ss2.str();
292 ARMARX_DEBUG <<
"adding object class " << objClassName <<
", instance name:" << objInstanceName;
295 memoryx::PersistentObjectClassSegmentBasePrx classesSegmentPrx =
304 memoryx::EntityBasePtr classesEntity = classesSegmentPrx->getEntityByName(objClassName);
308 ARMARX_ERROR <<
"No memory entity found with class name " << objClassName;
316 ARMARX_ERROR <<
"Could not cast entitiy to object class, name: " << objClassName;
327 ARMARX_ERROR <<
"Object " << objInstanceName <<
" is already present...";
331 ARMARX_IMPORTANT <<
"Adding Object " << objInstanceName <<
" at :\n" << pose;
332 simulatorPrx->addObject(objectClass, objInstanceName, pose, isStatic);
356 std::stringstream ss1, ss2;
357 ss1 <<
"ObjectClassName";
358 ss2 <<
"ObjectInstanceName";
367 ARMARX_DEBUG <<
"moving object instance :" << objInstanceName;
374 ARMARX_ERROR <<
"Object " << objInstanceName <<
" is not present in simulator...";
378 ARMARX_VERBOSE <<
"Moving object " << objInstanceName <<
" to :\n" << pose;
389 ARMARX_VERBOSE <<
"Initiating localization of " << objClass <<
" for " << sleepS <<
" seconds";
393 objClass, 50, armarx::DEFAULT_VIEWTARGET_PRIORITY);
397 ARMARX_ERROR <<
"Could not find class " << objClass <<
" in prior knowledge";
403 Literal objectLocalizationFinished1(
404 ChannelRefPtr::dynamicCast(
classChannel1)->getDataFieldIdentifier(
"localizationFinished"),
407 EventBasePtr e1 =
new EventBase();
408 ConditionIdentifier id1 =
410 objectLocalizationFinished1.
getImpl(),
421 ChannelRefBaseSequence::iterator iter = channelRefs.begin();
424 while (iter != channelRefs.end())
426 ChannelRefPtr channelRef = ChannelRefPtr::dynamicCast(*iter);
427 ARMARX_INFO << channelRef->getDataField(
"instanceName");
Property< PropertyType > getProperty(const std::string &name)
Literals are part of the user front end of the ArmarX condition mechanism.
static VarList createParameterList()
Static helper method to create an empty parameterlist.
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)
bool checkForConfigs(const std::string &suffix)
void onInitComponent() override
Pure virtual hook for the subclass.
void removeObject(const std::string &suffix)
armarx::ConditionHandlerInterfacePrx conditionHandler
memoryx::WorkingMemoryInterfacePrx workingMemoryProxy
void onDisconnectComponent() override
Hook for subclass.
void addObject(const std::string &suffix)
void moveObject(const std::string &suffix)
memoryx::ObjectMemoryObserverInterfacePrx memoryObserver
SimulatorInterfacePrx simulatorPrx
armarx::ChannelRefBasePtr classChannel1
Eigen::Matrix4f getGlobalPose(const std::string &suffix)
void onConnectComponent() override
Pure virtual hook for the subclass.
void localizeSingleObject(const std::string &objClass, int sleepS)
void attachObject(const std::string &objName, const std::string &robotName, const std::string &robotNodeName)
void onExitComponent() override
Hook for subclass.
bool getStatic(const std::string &suffix)
memoryx::PriorKnowledgeInterfacePrx priorKnowledgeProxy
TermImplPtr getImpl() const
Retrieve term implementation object as used in the ArmarX Framework in order to build distributed exp...
static void MSSleep(int durationMS)
lock the calling thread for a given duration (like usleep(...) but using Timeserver time)
#define ARMARX_INFO
The normal logging level.
#define ARMARX_IMPORTANT
The logging level for always important information, but expected behaviour (in contrast to ARMARX_WAR...
#define ARMARX_ERROR
The logging level for unexpected behaviour, that must be fixed.
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
#define ARMARX_VERBOSE
The logging level for verbose information.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< Pose > PosePtr
IceInternal::Handle< ChannelRef > ChannelRefPtr
IceInternal::Handle< ObjectClass > ObjectClassPtr