Go to the documentation of this file.
34 #include <Eigen/Dense>
44 const std::string ind(4 * indent, indentChar);
47 str << ind <<
"nullptr\n";
50 str << ind << n->name <<
", profile = " << n->profile <<
", value " << n->value <<
'\n';
51 for (
const auto&
c : n->children)
66 root(
Node(robotInfo)), robotInfo(robotInfo)
70 while (p && !p->isRoot())
72 profiles.emplace_back(p->getName());
75 profiles.emplace_back(
"");
82 for (
const std::string& p :
Split(path,
"/"))
84 node = node.
select(p, profiles);
89 s <<
"RobotNameHelper::select: path " + path +
" not found\nrobotInfo:\n";
91 throw std::runtime_error(
s.str());
113 const std::string name = infoNode.
name();
117 const auto nodes = infoNode.
nodes();
119 std::vector<RobotInfoNodePtr> children;
120 children.reserve(nodes.size());
124 std::back_inserter(children),
125 [](
const auto & childNode)
127 return readRobotInfo(childNode);
130 return new RobotInfoNode(name, profile,
value, children);
135 return Arm(shared_from_this(), side);
141 return RobotArm(
Arm(shared_from_this(), side), robot);
154 return robotInfo->value;
158 const std::vector<std::string>& profiles)
163 return Node(
nullptr);
165 std::map<std::string, RobotInfoNodePtr>
matches;
166 for (
const RobotInfoNodePtr& child : robotInfo->children)
168 if (child->name == name)
170 matches[child->profile] = child;
173 for (
const std::string& p : profiles)
180 return Node(
nullptr);
185 return robotInfo ? true :
false;
194 s <<
"RobotNameHelper::Node nullptr exception\nrobotInfo:\n";
196 throw std::runtime_error(
s.str());
208 return select(
"KinematicChain");
214 return select(
"TorsoKinematicChain");
226 return select(
"ForceTorqueSensor");
232 return select(
"ForceTorqueSensorFrame");
238 return select(
"EndEffector");
244 return select(
"MemoryHandName");
250 return select(
"HandControllerName");
256 return select(
"HandUnitName");
262 return select(
"HandRootNode");
268 return select(
"HandModelPath");
281 return select(
"HandModelPackage");
287 return select(
"PalmCollisionModel");
293 return select(
"FullHandCollisionModel");
303 Arm::Arm(
const std::shared_ptr<const RobotNameHelper>& rnh,
304 const std::string& side) :
312 return rnh->select(side +
"Arm/" + path);
339 return robot->getRobotNode(arm.
getTCP());
355 return VirtualRobot::TriMeshModel::FromFile(
abs);
368 const auto tcp =
getTCP();
372 return tcp->getPoseInRootFrame().inverse() * hand->getPoseInRootFrame();
386 arm(arm), robot(robot)
static const std::string LocationLeft
std::shared_ptr< RapidXmlReader > RapidXmlReaderPtr
static RapidXmlReaderPtr FromFile(const std::string &path)
Node select(const std::string &name, const std::vector< std::string > &profiles)
std::string getMemoryHandName() const
std::string getFullHandCollisionModel() const
std::string getAbsoluteHandModelPath() const
RobotArm addRobot(const VirtualRobot::RobotPtr &robot) const
std::string getPalmCollisionModel() const
static bool FindPackageAndAddDataPath(const std::string &packageName)
Search for the package and add its data path if it was found.
std::string getHandRootNode() const
std::string getHandModelPackage() const
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
std::string getSide() const
std::vector< std::string > Split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
std::string getHandUnitName() const
std::shared_ptr< class StatechartProfile > StatechartProfilePtr
Node(const RobotInfoNodePtr &robotInfo)
static const std::string LocationRight
VirtualRobot::RobotNodeSetPtr getTorsoKinematicChain() const
const std::vector< std::string > & getProfiles() const
VirtualRobot::TriMeshModelPtr getFullHandCollisionModel() const
std::string select(const std::string &path) const
std::string getTCP() const
static void writeRobotInfoNode(const RobotInfoNodePtr &n, std::ostream &str, std::size_t indent=0, char indentChar=' ')
RobotArm getRobotArm(const std::string &side, const VirtualRobot::RobotPtr &robot) const
std::string getTorsoKinematicChain() const
std::string getForceTorqueSensor() const
std::string getEndEffector() const
VirtualRobot::RobotNodePtr getHandRootNode() const
std::shared_ptr< Value > value()
std::vector< T > abs(const std::vector< T > &v)
const RobotInfoNodePtr & getRobotInfoNodePtr() const
std::shared_ptr< class RobotNameHelper > RobotNameHelperPtr
VirtualRobot::RobotNodePtr getTCP() const
Eigen::Matrix4f getTcp2HandRootTransform() const
std::shared_ptr< const RobotNameHelper > getRobotNameHelper() const
VirtualRobot::RobotNodePtr getPalmCollisionModel() const
VirtualRobot::RobotNodeSetPtr getKinematicChain() const
armarx::RobotArm RobotArm
std::string getKinematicChain() const
std::string getHandModelPath() const
RobotNameHelper(const RobotInfoNodePtr &robotInfo, const StatechartProfilePtr &profile=nullptr)
const VirtualRobot::RobotPtr & getRobot() const
static bool SearchReadableFile(const std::string &querryFileName, std::string &resultFileName, bool verbose=true)
MatrixXX< 4, 4, float > Matrix4f
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
std::string select(const std::string &path) const
bool matches(std::string skillName, std::vector< std::string > &searches)
auto transform(const Container< InputT, Alloc > &in, OutputT(*func)(InputT const &)) -> Container< OutputT, typename std::allocator_traits< Alloc >::template rebind_alloc< OutputT > >
Convenience function (with less typing) to transform a container of type InputT into the same contain...
std::string getSide() const
std::vector< RapidXmlReaderNode > nodes(const char *name=nullptr) const
static RobotNameHelperPtr Create(const RobotInfoNodePtr &robotInfo, const StatechartProfilePtr &profile)
static bool getAbsolutePath(const std::string &relativeFilename, std::string &storeAbsoluteFilename, const std::vector< std::string > &additionalSearchPaths={}, bool verbose=true)
const Arm & getArm() const
RapidXmlReaderNode first_node(const char *name=nullptr) const
std::string getForceTorqueSensorFrame() const
double s(double t, double s0, double v0, double a0, double j)
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::string attribute_value_or_default(const char *attrName, const std::string &defaultValue) const
std::shared_ptr< class Robot > RobotPtr
Arm getArm(const std::string &side) const
std::string getHandControllerName() const