5 #include <VirtualRobot/RobotNodeSet.h>
11 #include <armarx/control/skills/aron/MoveJointsToPositionParams.aron.generated.h>
19 SimpleSpecializedSkill(GetSkillDescription()), remote(remote)
28 defaultParams.enableLeftArm =
true;
29 defaultParams.enableRightArm =
true;
31 defaultParams.enableLeftHand =
false;
32 defaultParams.enableRightHand =
false;
34 defaultParams.enableTorso =
true;
36 defaultParams.enableHead =
false;
38 std::stringstream desc;
39 desc <<
"Move all joints to a named configuration of the robot model." <<
"\n\n"
40 <<
"The `enable*` parameters can be used to enable/disable movement for different "
41 "body parts of the robot.";
45 .description = desc.str(),
46 .rootProfileDefaults = defaultParams.toAron(),
48 .parametersType = ParamType::ToAronType(),
63 const auto configuration = robot->getConfiguration(in.parameters.configuration);
64 if (not configuration)
67 << in.parameters.configuration <<
"'.";
72 std::set<std::string> enabledJoints;
73 const auto addJoints = [&](
const std::string& nodeSetName)
75 if (not robot->hasRobotNodeSet(nodeSetName))
78 << in.parameters.configuration <<
"'.";
82 const auto robotNodes = robot->getRobotNodeSet(nodeSetName)->getNodeNames();
83 enabledJoints.insert(robotNodes.cbegin(), robotNodes.cend());
87 if (in.parameters.enableLeftArm)
91 if (in.parameters.enableRightArm)
93 addJoints(
"RightArm");
95 if (in.parameters.enableLeftHand)
97 addJoints(
"LeftHand");
99 if (in.parameters.enableRightHand)
101 addJoints(
"RightHand");
103 if (in.parameters.enableTorso)
107 if (in.parameters.enableHead)
123 for (
const auto& [node,
value] : *configuration)
125 if (enabledJoints.count(node))
127 subParams.jointsTargetValues[node] =
value;