13 std::map<std::string, float>
14 MoveJointsWithVelocity::filterJointTargetValues(
16 const std::vector<std::string>& disabledJoints)
const
18 std::map<std::string, float> filtered;
19 for (
const auto& [jointName,
v] : jointsTargetValues)
21 if (std::find(disabledJoints.begin(), disabledJoints.end(), jointName) !=
25 <<
" because it was explictly disabled in skill params.";
28 filtered[jointName] =
v;
36 auto filtered = this->filterJointTargetValues(in.parameters.jointsTargetVelocities,
37 in.parameters.disabledJoints);
39 auto jointNames = simox::alg::get_keys(filtered);
41 for (
auto& [k,
v] : filtered)
49 return {::armarx::skills::TerminatedSkillStatus::Succeeded};
55 auto filtered = this->filterJointTargetValues(in.parameters.jointsTargetVelocities,
56 in.parameters.disabledJoints);
58 auto jointNames = simox::alg::get_keys(filtered);
66 catch (
const armarx::KinematicUnitUnavailable& e)
68 ARMARX_IMPORTANT <<
"Failed to request joints. Terminating. Joints unavailable:"
74 ARMARX_INFO <<
"Moving joints with vel " << filtered;
76 switchControlMode(filtered, eVelocityControl);
78 moveJoints(filtered, in.parameters.duration);
83 MoveJointsWithVelocity::switchControlMode(
const NameValueMap& jointsTargetValues,
84 const ControlMode controlMode)
86 armarx::NameControlModeMap modeMap;
87 for (
const auto& [jointName, _] : jointsTargetValues)
89 modeMap[jointName] = controlMode;
95 MoveJointsWithVelocity::moveJoints(
const NameValueMap& jointsTargetVelocities,
98 srv_.
kinematicUnit->setJointVelocities(jointsTargetVelocities);
107 clock.waitFor(sleepTime);