25 #include <SimoxUtility/math/convert/mat4f_to_pos.h>
26 #include <SimoxUtility/math/convert/mat4f_to_quat.h>
36 const RobotUnitPtr& robotUnit,
37 const NJointControllerConfigPtr& config,
41 NJointTaskSpaceImpedanceControlConfigPtr cfg =
42 NJointTaskSpaceImpedanceControlConfigPtr::dynamicCast(config);
48 VirtualRobot::RobotNodeSetPtr rns =
rtGetRobot()->getRobotNodeSet(cfg->nodeSetName);
52 for (
size_t i = 0; i < rns->getSize(); ++i)
54 std::string jointName = rns->getNode(i)->getName();
55 jointNames.push_back(jointName);
60 auto casted_ct = ct->
asA<ControlTarget1DoFActuatorTorque>();
62 targets.push_back(casted_ct);
64 const SensorValue1DoFActuatorTorque* torqueSensor =
65 sv->
asA<SensorValue1DoFActuatorTorque>();
66 const SensorValue1DoFActuatorVelocity* velocitySensor =
67 sv->
asA<SensorValue1DoFActuatorVelocity>();
68 const SensorValue1DoFActuatorPosition* positionSensor =
69 sv->
asA<SensorValue1DoFActuatorPosition>();
76 torqueSensors.push_back(torqueSensor);
77 velocitySensors.push_back(velocitySensor);
78 positionSensors.push_back(positionSensor);
87 initData.
Kpos = cfg->Kpos;
88 initData.
Dpos = cfg->Dpos;
89 initData.
Kori = cfg->Kori;
90 initData.
Dori = cfg->Dori;
92 initData.
Knull = cfg->Knull;
93 initData.
Dnull = cfg->Dnull;
105 const auto& jointDesiredTorques =
109 for (
size_t i = 0; i < targets.size(); ++i)
111 targets.at(i)->torque = jointDesiredTorques(i);
112 if (!targets.at(i)->isValid())
114 targets.at(i)->torque = 0;
138 datafields[pair.first] =
new Variant(pair.second);
141 datafields[
"desiredForce_x"] =
143 datafields[
"desiredForce_y"] =
145 datafields[
"desiredForce_z"] =
148 datafields[
"tcpDesiredTorque_x"] =
150 datafields[
"tcpDesiredTorque_y"] =
152 datafields[
"tcpDesiredTorque_z"] =
158 debugObs->setDebugChannel(
"DSControllerOutput", datafields);
200 const Ice::FloatSeq& vals,
209 for (
size_t i = 0; i < 3; ++i)
215 else if (name ==
"Kori")
220 for (
size_t i = 0; i < 3; ++i)
226 else if (name ==
"Dpos")
231 for (
size_t i = 0; i < 3; ++i)
237 else if (name ==
"Dori")
242 for (
size_t i = 0; i < 3; ++i)
248 else if (name ==
"Knull")
254 for (
size_t i = 0; i < 8; ++i)
260 else if (name ==
"Dnull")
266 for (
size_t i = 0; i < 8; ++i)
277 const Eigen::VectorXf& knull,
278 const Eigen::VectorXf& dnull,
293 const NJointTaskSpaceImpedanceControlRuntimeConfig& cfg,
299 ARMARX_CHECK_EQUAL(
static_cast<std::size_t
>(cfg.desiredJointPositions.size()), targets.size());