27 NJointControllerRegistration<NJointKeypointsImpedanceMPController>
29 "NJointKeypointsImpedanceMPController");
33 const NJointControllerConfigPtr& config,
37 createMPs(configFileName);
43 return "NJointKeypointsImpedanceMPController";
50 NJointKeypointsImpedanceController::reconfigureController(
filename);
60 if (mp.second.mp->getClassName() ==
"KeypointsMP")
63 std::dynamic_pointer_cast<mp::KeypointsMPInput>(mp.second.input);
64 in->keypointPosition = controlStatusBuffer.getReadBuffer().filteredKeypointPosition;
65 in->keypointVelocity = controlStatusBuffer.getReadBuffer().currentKeypointVelocity;
66 in->deltaT = controlStatusBuffer.getReadBuffer().deltaT;
69 else if (mp.second.mp->getClassName() ==
"JSMP")
71 mp::JSMPInputPtr in = std::dynamic_pointer_cast<mp::JSMPInput>(mp.second.input);
72 in->angleRadian = controlStatusBuffer.getReadBuffer().qpos;
73 in->angularVel = controlStatusBuffer.getReadBuffer().qvel;
74 in->deltaT = controlStatusBuffer.getReadBuffer().deltaT;
80 if (mp.second.mp->getClassName() ==
"KeypointsMP" and !mp.second.mp->isFinished())
83 std::dynamic_pointer_cast<mp::KeypointsMPOutput>(mp.second.output);
84 getWriterControlStruct().desiredKeypointPosition = out->keypointPosition;
85 getWriterControlStruct().desiredKeypointVelocity = out->keypointVelocity;
89 else if (mp.second.mp->getClassName() ==
"JSMP" and !mp.second.mp->isFinished())
91 mp::JSMPOutputPtr out = std::dynamic_pointer_cast<mp::JSMPOutput>(mp.second.output);
92 getWriterControlStruct().desiredNullspaceJointAngles = out->angleRadian;
109 ARMARX_IMPORTANT <<
"rt pre activate: reinitialize the mp input output, as well as the rt "
110 "related buffer values";
114 if (mp.second.mp->getClassName() ==
"KeypointsMP")
116 ARMARX_IMPORTANT <<
"initialize input output buffers between KeypointsMP and "
117 "keypoint controllers";
119 auto in = std::dynamic_pointer_cast<mp::KeypointsMPInput>(mp.second.input);
120 in->keypointPosition =
controller.s.filteredKeypointPosition;
121 in->keypointVelocity =
controller.s.currentKeypointVelocity;
123 auto out = std::dynamic_pointer_cast<mp::KeypointsMPOutput>(mp.second.output);
124 out->keypointPosition =
controller.s.filteredKeypointPosition;
125 out->keypointVelocity =
controller.s.currentKeypointVelocity;
128 else if (mp.second.mp->getClassName() ==
"JSMP")
131 <<
"initialize input output buffers between JSMP and keypoint controllers";
132 auto in = std::dynamic_pointer_cast<mp::JSMPInput>(mp.second.input);
133 auto out = std::dynamic_pointer_cast<mp::JSMPOutput>(mp.second.output);