Go to the documentation of this file.
30 #include <VirtualRobot/VirtualRobot.h>
31 #include <VirtualRobot/EndEffector/EndEffector.h>
32 #include <VirtualRobot/XML/RobotIO.h>
42 std::string endeffectorFile = getProperty<std::string>(
"RobotFileName").getValue();
43 std::string endeffectorName = getProperty<std::string>(
"EndeffectorName").getValue();
47 throw UserException(
"Could not find robot file " + endeffectorFile);
53 robot = VirtualRobot::RobotIO::loadRobot(endeffectorFile, VirtualRobot::RobotIO::eStructure);
55 catch (VirtualRobot::VirtualRobotException& e)
57 throw UserException(e.what());
60 if (endeffectorName ==
"")
62 throw UserException(
"EndeffectorName not defined");
65 if (!robot->hasEndEffector(endeffectorName))
67 throw UserException(
"Robot does not contain an endeffector with name: " + endeffectorName);
70 eef = robot->getEndEffector(endeffectorName);
71 robotName = robot->getName();
75 tcpName = robot->getEndEffector(endeffectorName)->getTcp()->getName();
79 throw UserException(
"Endeffector without TCP: " + endeffectorName);
83 std::vector<EndEffectorActorPtr> actors;
84 eef->getActors(actors);
86 for (
size_t i = 0; i < actors.size(); i++)
88 EndEffectorActorPtr
a = actors[i];
89 std::vector<EndEffectorActor::ActorDefinition> ads;
91 for (
size_t j = 0; j < ads.size(); j++)
93 EndEffectorActor::ActorDefinition ad = ads[j];
97 handJoints[ad.robotNode->getName()] = ad.directionAndSpeed;
102 const std::vector<std::string> endeffectorPreshapes = robot->getEndEffector(endeffectorName)->getPreshapes();
105 std::vector<std::string>::const_iterator iter = endeffectorPreshapes.begin();
107 while (iter != endeffectorPreshapes.end())
111 shapeNames->addVariant(currentPreshape);
117 listenerChannelName = endeffectorName +
"State";
118 offeringTopic(listenerChannelName);
120 this->onInitHandUnit();
127 listenerPrx = getTopic<HandUnitListenerPrx>(listenerChannelName);
129 this->onStartHandUnit();
135 this->onExitHandUnit();
146 ARMARX_WARNING <<
"setShapeWithObjectInstance Function not implemented!";
159 getConfigIdentifier()));
165 EndEffectorPtr efp = robot->getEndEffector(getProperty<std::string>(
"EndeffectorName").getValue());
166 RobotConfigPtr rc = efp->getPreshape(shapeName);
167 return rc->getRobotNodeJointValueMap();
174 for (
auto j : handJoints)
176 result[j.first] = 0.0f;
185 graspedObject = objectName;
198 return eef->getName();
219 return "not implemented";
The Variant class is described here: Variants.
void onConnectComponent() override
Calls armarx::PlatformUnit::onStartPlatformUnit().
std::string describeHandState(const Ice::Current &) override
void setString(const std::string &s, const Ice::Current &c=Ice::emptyCurrent) override
Sets the Variant's value to s.
void setObjectReleased(const std::string &objectName, const Ice::Current &) override
std::string getHandName(const Ice::Current &=Ice::emptyCurrent) override
void setObjectGrasped(const std::string &objectName, const Ice::Current &) override
void onInitComponent() override
Retrieve proxy for publishing State information and call armarx::PlatformUnit::onInitPlatformUnit().
void setJointForces(const NameValueMap &targetJointForces, const Ice::Current &) override
SingleTypeVariantListBasePtr getShapeNames(const Ice::Current &c=Ice::emptyCurrent) override
double a(double t, double a0, double j)
NameValueMap getCurrentJointValues(const Ice::Current &c=Ice::emptyCurrent) override
PropertyDefinitionsPtr createPropertyDefinitions() override
void setShape(const std::string &shapeName, const Ice::Current &c=Ice::emptyCurrent) override
Send command to the hand to form a specific shape position.
const LogSender::manipulator flush
void setShapeWithObjectInstance(const std::string &shapeName, const std::string &objectInstanceName, const Ice::Current &c=Ice::emptyCurrent) override
setShapeWithObjectInstance Send command to the hand to form a specific shape position.
NameValueMap getShapeJointValues(const std::string &shapeName, const Ice::Current &c=Ice::emptyCurrent) override
Defines all necessary properties for armarx::HandUnit.
void onExitComponent() override
Calls armarx::PlatformUnit::onExitPlatformUnit().
void sendJointCommands(const NameCommandMap &targetJointCommands, const Ice::Current &) override
static bool getAbsolutePath(const std::string &relativeFilename, std::string &storeAbsoluteFilename, const std::vector< std::string > &additionalSearchPaths={}, bool verbose=true)
void setJointAngles(const NameValueMap &targetJointAngles, const Ice::Current &) override
const VariantTypeId String
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
const VariantTypeId SingleTypeVariantList
This file offers overloads of toIce() and fromIce() functions for STL container types.