15 std::map<std::string, float>
16 MoveJointsWithVelocity::filterJointTargetValues(
18 const std::vector<std::string>& disabledJoints)
const
20 std::map<std::string, float> filtered;
21 for (
const auto& [jointName,
v] : jointsTargetValues)
23 if (std::find(disabledJoints.begin(), disabledJoints.end(), jointName) !=
27 <<
" because it was explictly disabled in skill params.";
30 filtered[jointName] =
v;
38 auto filtered = this->filterJointTargetValues(in.parameters.jointsTargetVelocities,
39 in.parameters.disabledJoints);
41 auto jointNames = simox::alg::get_keys(filtered);
43 for (
auto& [k,
v] : filtered)
51 return {::armarx::skills::TerminatedSkillStatus::Succeeded};
57 auto filtered = this->filterJointTargetValues(in.parameters.jointsTargetVelocities,
58 in.parameters.disabledJoints);
60 auto jointNames = simox::alg::get_keys(filtered);
68 catch (
const armarx::KinematicUnitUnavailable& e)
70 ARMARX_IMPORTANT <<
"Failed to request joints. Terminating. Joints unavailable:"
76 ARMARX_INFO <<
"Moving joints with vel " << filtered;
78 switchControlMode(filtered, eVelocityControl);
80 moveJoints(filtered, in.parameters.duration);
85 MoveJointsWithVelocity::switchControlMode(
const NameValueMap& jointsTargetValues,
86 const ControlMode controlMode)
88 armarx::NameControlModeMap modeMap;
89 for (
const auto& [jointName, _] : jointsTargetValues)
91 modeMap[jointName] = controlMode;
97 MoveJointsWithVelocity::moveJoints(
const NameValueMap& jointsTargetVelocities,
100 srv_.
kinematicUnit->setJointVelocities(jointsTargetVelocities);
109 clock.waitFor(sleepTime);