diff --git a/VirtualRobot/Robot.cpp b/VirtualRobot/Robot.cpp index c043284344f53dbaeee0ffccbaaf5e75a97c0f94..73269ef1b179e01209fe147ec8c9993fdb1f0851 100644 --- a/VirtualRobot/Robot.cpp +++ b/VirtualRobot/Robot.cpp @@ -1274,6 +1274,12 @@ namespace VirtualRobot this->nodeMapping = nodeMapping; } + void Robot::registerHumanMapping(const HumanMapping& humanMapping) + { + this->humanMapping = humanMapping; + } + + const NodeMapping& Robot::getNodeMapping() const { return nodeMapping; @@ -1281,4 +1287,3 @@ namespace VirtualRobot } // namespace VirtualRobot - diff --git a/VirtualRobot/Robot.h b/VirtualRobot/Robot.h index dab2baf82213aefe6962fe00bc7cb5f35d0feeb1..acfd3b5c594d57f98ea085bcc054bec0e2409456 100644 --- a/VirtualRobot/Robot.h +++ b/VirtualRobot/Robot.h @@ -30,6 +30,7 @@ #include <type_traits> #include <string> +#include <unordered_map> #include <vector> #include <map> @@ -50,6 +51,47 @@ namespace VirtualRobot using NodeMapping = std::unordered_map<std::string, NodeMappingElement>; + struct HumanMapping + { + struct ArmDescription + { + struct Locations + { + std::string shoulder; + std::string elbow; + std::string wrist; + std::string tcp; + } location; + + struct NodeDescription + { + std::string name; + float offset; + bool inverted; + }; + + // mapping: "location" -> "movement" -> "node name" + using JointMapping = + std::unordered_map<std::string, std::unordered_map<std::string, NodeDescription>>; + + JointMapping jointMapping; + + std::string nodeSet; + }; + + struct HandDescription + { + std::string palm; + std::string tcp; + }; + + ArmDescription leftArm; + ArmDescription rightArm; + + HandDescription leftHand; + HandDescription rightHand; + }; + /*! This is the main object defining the kinematic structure of a robot. @@ -184,6 +226,7 @@ namespace VirtualRobot * Node mapping */ const NodeMapping& getNodeMapping() const; + const std::optional<HumanMapping>& getHumanMapping() const; /** * @@ -454,11 +497,14 @@ namespace VirtualRobot void registerNodeMapping(const NodeMapping& nodeMapping); + void registerHumanMapping(const HumanMapping& humanMapping); + protected: Robot(); void validateNodeMapping(const NodeMapping& nodeMapping) const; + void validateHumanMapping(const HumanMapping& humanMapping) const; /*! @@ -486,6 +532,7 @@ namespace VirtualRobot private: NodeMapping nodeMapping; + std::optional<HumanMapping> humanMapping; }; @@ -568,4 +615,3 @@ namespace VirtualRobot } // namespace VirtualRobot -