Go to the documentation of this file.
30 #include <VirtualRobot/EndEffector/EndEffector.h>
31 #include <VirtualRobot/VirtualRobot.h>
32 #include <VirtualRobot/VirtualRobotException.h>
33 #include <VirtualRobot/XML/RobotIO.h>
43 std::string endeffectorFile = getProperty<std::string>(
"RobotFileName").getValue();
44 std::string endeffectorName = getProperty<std::string>(
"EndeffectorName").getValue();
48 throw UserException(
"Could not find robot file " + endeffectorFile);
55 VirtualRobot::RobotIO::loadRobot(endeffectorFile, VirtualRobot::RobotIO::eStructure);
57 catch (VirtualRobot::VirtualRobotException& e)
59 throw UserException(e.what());
62 if (endeffectorName ==
"")
64 throw UserException(
"EndeffectorName not defined");
67 if (!robot->hasEndEffector(endeffectorName))
69 throw UserException(
"Robot does not contain an endeffector with name: " + endeffectorName);
72 eef = robot->getEndEffector(endeffectorName);
73 robotName = robot->getName();
77 tcpName = robot->getEndEffector(endeffectorName)->getTcp()->getName();
81 throw UserException(
"Endeffector without TCP: " + endeffectorName);
85 std::vector<EndEffectorActorPtr> actors;
86 eef->getActors(actors);
88 for (
size_t i = 0; i < actors.size(); i++)
90 EndEffectorActorPtr
a = actors[i];
91 std::vector<EndEffectorActor::ActorDefinition> ads;
93 for (
size_t j = 0; j < ads.size(); j++)
95 EndEffectorActor::ActorDefinition ad = ads[j];
99 handJoints[ad.robotNode->getName()] = ad.directionAndSpeed;
104 const std::vector<std::string> endeffectorPreshapes =
105 robot->getEndEffector(endeffectorName)->getPreshapes();
108 std::vector<std::string>::const_iterator iter = endeffectorPreshapes.begin();
110 while (iter != endeffectorPreshapes.end())
114 shapeNames->addVariant(currentPreshape);
120 listenerChannelName = endeffectorName +
"State";
121 offeringTopic(listenerChannelName);
123 this->onInitHandUnit();
130 listenerPrx = getTopic<HandUnitListenerPrx>(listenerChannelName);
132 this->onStartHandUnit();
138 this->onExitHandUnit();
148 const std::string& objectInstanceName,
149 const Ice::Current&
c)
151 ARMARX_WARNING <<
"setShapeWithObjectInstance Function not implemented!";
154 SingleTypeVariantListBasePtr
170 robot->getEndEffector(getProperty<std::string>(
"EndeffectorName").getValue());
171 RobotConfigPtr rc = efp->getPreshape(shapeName);
172 return rc->getRobotNodeJointValueMap();
180 for (
auto j : handJoints)
182 result[j.first] = 0.0f;
192 graspedObject = objectName;
205 return eef->getName();
220 const Ice::Current&
c)
227 return "not implemented";
233 ARMARX_WARNING <<
"`reloadPreshapes` not implemented for this hand unit!";
245 ARMARX_WARNING <<
"Resetting firmware is not supported by this hand.";
The Variant class is described here: Variants.
void onConnectComponent() override
Calls armarx::PlatformUnit::onStartPlatformUnit().
std::string describeHandState(const Ice::Current &) override
void tare(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
void reloadPreshapes(const Ice::Current &) override
Defines all necessary properties for armarx::HandUnit.
void onExitComponent() override
Calls armarx::PlatformUnit::onExitPlatformUnit().
void resetFirmware(const Ice::Current &) override
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.