32#include <Ice/Current.h>
34#include <VirtualRobot/EndEffector/EndEffector.h>
35#include <VirtualRobot/VirtualRobot.h>
36#include <VirtualRobot/VirtualRobotException.h>
37#include <VirtualRobot/XML/RobotIO.h>
43#include <ArmarXCore/interface/core/UserException.h>
44#include <ArmarXCore/interface/observers/VariantContainers.h>
48#include <RobotAPI/interface/core/NameValueMap.h>
49#include <RobotAPI/interface/units/HandUnitInterface.h>
62 throw UserException(
"Could not find robot file " + endeffectorFile);
68 VirtualRobot::RobotIO::loadRobot(endeffectorFile, VirtualRobot::RobotIO::eStructure);
70 catch (VirtualRobot::VirtualRobotException& e)
72 throw UserException(e.what());
75 if (endeffectorName ==
"")
77 throw UserException(
"EndeffectorName not defined");
80 if (!
robot->hasEndEffector(endeffectorName))
82 throw UserException(
"Robot does not contain an endeffector with name: " + endeffectorName);
85 eef =
robot->getEndEffector(endeffectorName);
90 tcpName =
robot->getEndEffector(endeffectorName)->getTcp()->getName();
94 throw UserException(
"Endeffector without TCP: " + endeffectorName);
98 std::vector<EndEffectorActorPtr> actors;
99 eef->getActors(actors);
101 for (
size_t i = 0; i < actors.size(); i++)
103 EndEffectorActorPtr a = actors[i];
104 std::vector<EndEffectorActor::ActorDefinition> ads;
106 for (
size_t j = 0; j < ads.size(); j++)
108 EndEffectorActor::ActorDefinition ad = ads[j];
112 handJoints[ad.robotNode->getName()] = ad.directionAndSpeed;
117 const std::vector<std::string> endeffectorPreshapes =
118 robot->getEndEffector(endeffectorName)->getPreshapes();
121 std::vector<std::string>::const_iterator iter = endeffectorPreshapes.begin();
123 while (iter != endeffectorPreshapes.end())
160 const std::string& objectInstanceName,
161 const Ice::Current&
c)
163 ARMARX_WARNING <<
"setShapeWithObjectInstance Function not implemented!";
166SingleTypeVariantListBasePtr
183 RobotConfigPtr rc = efp->getPreshape(shapeName);
184 return rc->getRobotNodeJointValueMap();
194 result[j.first] = 0.0f;
217 return eef->getName();
232 const Ice::Current&
c)
239 return "not implemented";
245 ARMARX_WARNING <<
"`reloadPreshapes` not implemented for this hand unit!";
263 ARMARX_WARNING <<
"Resetting firmware is not supported by this hand.";
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)
Defines all necessary properties for armarx::HandUnit.
virtual void onExitHandUnit()=0
void onInitComponent() override
Retrieve proxy for publishing State information and call armarx::PlatformUnit::onInitPlatformUnit().
std::string getHandName(const Ice::Current &=Ice::emptyCurrent) override
HandUnitListenerPrx listenerPrx
HandUnitListener proxy for publishing state updates.
SingleTypeVariantListPtr shapeNames
List containing the names of all valid shapes.
std::string describeHandState(const Ice::Current &) override
VirtualRobot::RobotPtr robot
VirtualRobot::EndEffectorPtr eef
void setShape(const std::string &shapeName, const Ice::Current &c=Ice::emptyCurrent) override
Send command to the hand to form a specific shape position.
void setObjectReleased(const std::string &objectName, const Ice::Current &) override
void setJointForces(const NameValueMap &targetJointForces, const Ice::Current &) override
virtual void onInitHandUnit()=0
void sendJointCommands(const NameCommandMap &targetJointCommands, const Ice::Current &) override
std::map< std::string, float > handJoints
SingleTypeVariantListBasePtr getShapeNames(const Ice::Current &c=Ice::emptyCurrent) override
std::string graspedObject
void setObjectGrasped(const std::string &objectName, const Ice::Current &) override
void onConnectComponent() override
Calls armarx::PlatformUnit::onStartPlatformUnit().
void setJointAngles(const NameValueMap &targetJointAngles, const Ice::Current &) override
NameValueMap getCurrentJointValues(const Ice::Current &c=Ice::emptyCurrent) override
void tare(const Ice::Current &) override
PropertyDefinitionsPtr createPropertyDefinitions() override
void reloadPreshapes(const Ice::Current &) override
std::string listenerChannelName
Ice Topic name on which armarx::HandUnit::listenerPrx publishes information.
void startTare(const Ice::Current &) override
void onExitComponent() override
Calls armarx::PlatformUnit::onExitPlatformUnit().
void rebootEmbeddedSystem(const Ice::Current &) override
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.
virtual void onStartHandUnit()=0
NameValueMap getShapeJointValues(const std::string &shapeName, const Ice::Current &c=Ice::emptyCurrent) override
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
TopicProxyType getTopic(const std::string &name)
Returns a proxy of the specified topic.
The SingleTypeVariantList class is a subclass of VariantContainer and is comparable to a std::vector<...
The Variant class is described here: Variants.
void setString(const std::string &s, const Ice::Current &c=Ice::emptyCurrent) override
Sets the Variant's value to s.
#define ARMARX_INFO
The normal logging level.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
const VariantTypeId String
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
const LogSender::manipulator flush