31 const RobotUnitPtr& robotUnit,
32 const NJointControllerConfigPtr& config,
37 createMPs(configFileName);
42 return "NJointKeypointsImpedanceMPController";
47 NJointKeypointsImpedanceController::reconfigureController(
filename);
57 if (mp.second.mp->getClassName() ==
"KeypointsMP")
60 in->keypointPosition = controlStatusBuffer.getReadBuffer().filteredKeypointPosition;
61 in->keypointVelocity = controlStatusBuffer.getReadBuffer().currentKeypointVelocity;
62 in->deltaT = controlStatusBuffer.getReadBuffer().deltaT;
65 else if (mp.second.mp->getClassName() ==
"JSMP")
67 mp::JSMPInputPtr in = std::dynamic_pointer_cast<mp::JSMPInput>(mp.second.input);
68 in->angleRadian = controlStatusBuffer.getReadBuffer().qpos;
69 in->angularVel = controlStatusBuffer.getReadBuffer().qvel;
70 in->deltaT = controlStatusBuffer.getReadBuffer().deltaT;
76 if (mp.second.mp->getClassName() ==
"KeypointsMP" and !mp.second.mp->isFinished())
79 getWriterControlStruct().desiredKeypointPosition = out->keypointPosition;
80 getWriterControlStruct().desiredKeypointVelocity = out->keypointVelocity;
84 else if (mp.second.mp->getClassName() ==
"JSMP" and !mp.second.mp->isFinished())
86 mp::JSMPOutputPtr out = std::dynamic_pointer_cast<mp::JSMPOutput>(mp.second.output);
87 getWriterControlStruct().desiredNullspaceJointAngles = out->angleRadian;
103 ARMARX_IMPORTANT <<
"rt pre activate: reinitialize the mp input output, as well as the rt related buffer values";
107 if (mp.second.mp->getClassName() ==
"KeypointsMP")
109 ARMARX_IMPORTANT <<
"initialize input output buffers between KeypointsMP and keypoint controllers";
111 auto in = std::dynamic_pointer_cast<mp::KeypointsMPInput>(mp.second.input);
112 in->keypointPosition =
controller.s.filteredKeypointPosition;
113 in->keypointVelocity =
controller.s.currentKeypointVelocity;
115 auto out = std::dynamic_pointer_cast<mp::KeypointsMPOutput>(mp.second.output);
116 out->keypointPosition =
controller.s.filteredKeypointPosition;
117 out->keypointVelocity =
controller.s.currentKeypointVelocity;
120 else if (mp.second.mp->getClassName() ==
"JSMP")
122 ARMARX_IMPORTANT <<
"initialize input output buffers between JSMP and keypoint controllers";
123 auto in = std::dynamic_pointer_cast<mp::JSMPInput>(mp.second.input);
124 auto out = std::dynamic_pointer_cast<mp::JSMPOutput>(mp.second.output);