9 joint_control::arondto::MoveJointsToPositionAcceptedType GetDefaultParameterization()
11 joint_control::arondto::MoveJointsToPositionAcceptedType
ret;
12 ret.jointTargetTolerance = 0.05;
18 "MoveJointsToPosition",
"Move the joints to position",
20 joint_control::arondto::MoveJointsToPositionAcceptedType::ToAronType(),
21 GetDefaultParameterization().toAron()
26 mixin::RobotReadingSkillMixin(mns),
27 PeriodicSimpleSpecializedSkill<joint_control::arondto::MoveJointsToPositionAcceptedType>(Description,
armarx::core::time::
Frequency::Hertz(10))
31 void MoveJointsToPosition::reset()
33 already_running =
false;
36 Skill::InitResult MoveJointsToPosition::init(
const SpecializedInitInput &in)
42 PeriodicSkill::StepResult MoveJointsToPosition::step(
const SpecializedMainInput& in)
47 ARMARX_WARNING <<
"Unable to get robot from robotstatememory. Abort.";
57 std::map<std::string, float> filteredTargets;
58 auto currentValues = robot->jointMap;
59 for (
const auto& [key, val] : in.parameters.targetJointMap)
61 if (
const auto& it = currentValues.find(key); it != currentValues.end())
63 ARMARX_INFO <<
deactivateSpam(1) <<
"Current value of " << key <<
" is " << it->second <<
" and it will be set to " << val;
64 filteredTargets.insert({key, val});
68 if (filteredTargets.size() == 0)
73 auto currentJointValueTolerance = in.parameters.jointTargetTolerance;
80 currentValues = robot->jointMap;
81 float maxDeltaTmp = 0;
82 for (
const auto& [key,
value] : filteredTargets)
84 const float delta = fabs((
value - currentValues.at(key)));
85 maxDeltaTmp =
std::max(delta, maxDeltaTmp);
87 currentMaxDelta = maxDeltaTmp;
92 if (currentMaxDelta <= currentJointValueTolerance)
99 already_running =
true;
101 NameControlModeMap controlModes;
102 for (
const auto& p : filteredTargets)
104 controlModes[p.first] = ePositionControl;
113 Skill::ExitResult MoveJointsToPosition::exit(
const SpecializedExitInput &in)
115 std::vector<std::string> joints;
116 std::for_each(in.parameters.targetJointMap.begin(), in.parameters.targetJointMap.end(), [&joints](
const std::pair<std::string, float>& p) { joints.push_back(p.first); });