Go to the documentation of this file.
36 #include <Eigen/Dense>
38 #include <VirtualRobot/Nodes/RobotNode.h>
39 #include <VirtualRobot/Robot.h>
40 #include <VirtualRobot/VirtualRobot.h>
41 #include <VirtualRobot/Visualization/TriMeshModel.h>
51 const std::string ind(4 * indent, indentChar);
54 str << ind <<
"nullptr\n";
57 str << ind << n->name <<
", profile = " << n->profile <<
", value " << n->value <<
'\n';
58 for (
const auto&
c : n->children)
64 const RobotInfoNodePtr&
75 root(
Node(robotInfo)), robotInfo(robotInfo)
79 while (p && !p->isRoot())
81 profiles.emplace_back(p->getName());
84 profiles.emplace_back(
"");
92 for (
const std::string& p :
Split(path,
"/"))
94 node = node.
select(p, profiles);
99 s <<
"RobotNameHelper::select: path " + path +
" not found\nrobotInfo:\n";
101 throw std::runtime_error(
s.str());
125 const std::string name = infoNode.
name();
129 const auto nodes = infoNode.
nodes();
131 std::vector<RobotInfoNodePtr> children;
132 children.reserve(nodes.size());
136 std::back_inserter(children),
137 [](
const auto& childNode) { return readRobotInfo(childNode); });
139 return new RobotInfoNode(name, profile,
value, children);
145 return Arm(shared_from_this(), side);
151 return RobotArm(
Arm(shared_from_this(), side), robot);
154 std::shared_ptr<const RobotNameHelper>
168 return robotInfo->value;
177 return Node(
nullptr);
179 std::map<std::string, RobotInfoNodePtr>
matches;
180 for (
const RobotInfoNodePtr& child : robotInfo->children)
182 if (child->name == name)
184 matches[child->profile] = child;
187 for (
const std::string& p : profiles)
194 return Node(
nullptr);
200 return robotInfo ? true :
false;
210 s <<
"RobotNameHelper::Node nullptr exception\nrobotInfo:\n";
212 throw std::runtime_error(
s.str());
226 return select(
"KinematicChain");
233 return select(
"TorsoKinematicChain");
247 return select(
"ForceTorqueSensor");
254 return select(
"ForceTorqueSensorFrame");
261 return select(
"EndEffector");
268 return select(
"MemoryHandName");
275 return select(
"HandControllerName");
282 return select(
"HandUnitName");
289 return select(
"HandRootNode");
296 return select(
"HandModelPath");
311 return select(
"HandModelPackage");
318 return select(
"PalmCollisionModel");
325 return select(
"FullHandCollisionModel");
335 Arm::Arm(
const std::shared_ptr<const RobotNameHelper>& rnh,
const std::string& side) :
344 return rnh->select(side +
"Arm/" + path);
354 VirtualRobot::RobotNodeSetPtr
362 VirtualRobot::RobotNodeSetPtr
370 VirtualRobot::RobotNodePtr
375 return robot->getRobotNode(arm.
getTCP());
378 VirtualRobot::RobotNodePtr
386 VirtualRobot::TriMeshModelPtr
393 return VirtualRobot::TriMeshModel::FromFile(
abs);
396 VirtualRobot::RobotNodePtr
408 const auto tcp =
getTCP();
412 return tcp->getPoseInRootFrame().inverse() * hand->getPoseInRootFrame();
432 const std::vector<std::string>&
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
MatrixXX< 4, 4, float > Matrix4f
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
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...
static bool SearchReadableFile(const std::string &querryFileName, std::string &resultFileName, bool verbose=true)
#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)
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