5#include <VirtualRobot/RobotNodeSet.h>
12#include <armarx/control/skills/aron/MoveJointsToPositionParams.aron.generated.h>
29 defaultParams.enableLeftArm =
true;
30 defaultParams.enableRightArm =
true;
32 defaultParams.enableLeftHand =
false;
33 defaultParams.enableRightHand =
false;
35 defaultParams.enableTorso =
true;
37 defaultParams.enableHead =
false;
39 std::stringstream desc;
40 desc <<
"Move all joints to a named configuration of the robot model."
42 <<
"The `enable*` parameters can be used to enable/disable movement for different "
43 "body parts of the robot.";
47 .description = desc.str(),
48 .rootProfileDefaults = defaultParams.toAron(),
50 .parametersType = ParamType::ToAronType(),
65 const auto configuration = robot->getConfiguration(in.parameters.configuration);
66 if (not configuration)
69 << in.parameters.configuration <<
"'.";
74 std::set<std::string> enabledJoints;
75 const auto addJoints = [&](
const std::string& nodeSetName)
77 if (not robot->hasRobotNodeSet(nodeSetName))
80 << in.parameters.configuration <<
"'.";
84 const auto robotNodes = robot->getRobotNodeSet(nodeSetName)->getNodeNames();
85 enabledJoints.insert(robotNodes.cbegin(), robotNodes.cend());
89 if (in.parameters.enableLeftArm)
93 if (in.parameters.enableRightArm)
95 addJoints(
"RightArm");
97 if (in.parameters.enableLeftHand)
99 addJoints(
"LeftHand");
101 if (in.parameters.enableRightHand)
103 addJoints(
"RightHand");
105 if (in.parameters.enableTorso)
109 if (in.parameters.enableHead)
116 ::armarx::skills::SkillID skillId{
121 using Parameters = arondto::MoveJointsToPositionParams;
125 [&](Parameters& params)
130 for (
const auto& [node, value] : *configuration)
132 if (enabledJoints.count(node))
134 params.jointsTargetValues[node] =
value;
static Duration Seconds(std::int64_t seconds)
Constructs a duration in seconds.
VirtualRobot::RobotPtr getRobotWaiting(const std::string &name, const armem::Time ×tamp=armem::Time::Invalid(), const VirtualRobot::RobotIO::RobotDescription &loadMode=VirtualRobot::RobotIO::RobotDescription::eStructure)
In contrast to getRobot(), this function will retry to query the robot until it exists.
::armarx::skills::SkillDescription GetSkillDescription()
MoveJointsToNamedConfiguration(const Services &remote)
arondto::MoveJointsToNamedConfigurationParams ParamType
std::optional< ProviderID > providerId
std::optional< TerminatedSkillStatusUpdate > callSubskill(const SkillID &skillId)
Call a subskill with the given ID and its default parameters.
static MainResult MakeSucceededResult(aron::data::DictPtr data=nullptr)
virtual MainResult main()
Override this method with the actual implementation.
SkillID getSkillId() const
Get the id of the skill.
static MainResult MakeFailedResult(aron::data::DictPtr data=nullptr)
#define ARMARX_ERROR
The logging level for unexpected behaviour, that must be fixed.
std::shared_ptr< class Robot > RobotPtr
std::string MOVE_JOINTS_TO_NAMED_CONFIGURATION_SKILL_NAME
std::string MOVE_JOINTS_TO_POSITION_SKILL_NAME
void copy_params(const arondto::MoveJointsParams &from, arondto::MoveJointsToPositionParams &to)
aron::data::DictPtr Parameters
bool skillExecutionFailed(const std::optional< armarx::skills::TerminatedSkillStatusUpdate > &update)
std::shared_ptr< Value > value()
::armarx::armem::robot_state::VirtualRobotReader virtualRobotReader
A result struct for th main method of a skill.