KeypointsAdmittanceController.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package ...
17  * @author Jianfeng Gao ( jianfeng dot gao at kit dot edu )
18  * @date 2021
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
24 
25 #include <VirtualRobot/MathTools.h>
26 #include <VirtualRobot/RobotNodeSet.h>
27 
30 
35 
37 {
38  NJointControllerRegistration<NJointKeypointsAdmittanceController>
40  "NJointKeypointsAdmittanceController");
41 
43  const RobotUnitPtr& robotUnit,
44  const NJointControllerConfigPtr& config,
46  {
47  ARMARX_INFO << "--------------------------------------- creating keypoints admittance "
48  "controller ---------------------------------------";
49  ConfigPtrT cfg = ConfigPtrT::dynamicCast(config);
50 
52  ARMARX_CHECK_EXPRESSION(robotUnit);
53  ARMARX_CHECK_EXPRESSION(!cfg->nodeSetName.empty());
55  kinematicChainName = cfg->nodeSetName;
56 
57  VirtualRobot::RobotNodeSetPtr rns = rtGetRobot()->getRobotNodeSet(cfg->nodeSetName);
58  ARMARX_CHECK_EXPRESSION(rns) << cfg->nodeSetName;
59 
60  jointNames.clear();
61  for (size_t i = 0; i < rns->getSize(); ++i)
62  {
63  std::string jointName = rns->getNode(i)->getName();
64  jointNames.push_back(jointName);
65  ControlTargetBase* ct = useControlTarget(jointName, ControlModes::Torque1DoF);
67  const SensorValueBase* sv = useSensorValue(jointName);
69  auto casted_ct = ct->asA<ControlTarget1DoFActuatorTorque>();
70  ARMARX_CHECK_EXPRESSION(casted_ct);
71  targets.push_back(casted_ct);
72 
73  const SensorValue1DoFActuatorTorque* torqueSensor =
74  sv->asA<SensorValue1DoFActuatorTorque>();
75  const SensorValue1DoFActuatorVelocity* velocitySensor =
76  sv->asA<SensorValue1DoFActuatorVelocity>();
77  const SensorValue1DoFActuatorPosition* positionSensor =
78  sv->asA<SensorValue1DoFActuatorPosition>();
79  if (!torqueSensor)
80  {
81  ARMARX_WARNING << "No Torque sensor available for " << jointName;
82  }
83  if (!velocitySensor)
84  {
85  ARMARX_WARNING << "No velocity sensor available for " << jointName;
86  }
87  if (!positionSensor)
88  {
89  ARMARX_WARNING << "No position sensor available for " << jointName;
90  }
91 
92  torqueSensors.push_back(torqueSensor);
93  velocitySensors.push_back(velocitySensor);
94  positionSensors.push_back(positionSensor);
95  };
96  configFileName = cfg->controlParamJsonFile;
97  controller.initialize(rns, configFileName);
98  ftsensor.initialize(rns, robotUnit, configFileName);
99 
100  common::FTSensor::FTBufferData ftData;
101  ftData.ftFilter = ftsensor.s.ftFilter;
102  ftData.deadZoneForce = ftsensor.s.deadZoneForce;
103  ftData.deadZoneTorque = ftsensor.s.deadZoneTorque;
104  ftData.timeLimit = ftsensor.s.timeLimit;
105  ftData.tcpMass = ftsensor.s.tcpMass;
106  ftData.tcpCoMInFTSensorFrame = ftsensor.s.tcpCoMInFTSensorFrame;
107  ftData.enableTCPGravityCompensation = ftsensor.s.enableTCPGravityCompensation;
108  ftData.forceBaseline = ftsensor.s.forceBaseline;
109  ftData.torqueBaseline = ftsensor.s.torqueBaseline;
111 
112  law::KeypointsAdmittanceController::Config configData;
113  configData.kpImpedance = controller.s.kpImpedance;
114  configData.kdImpedance = controller.s.kdImpedance;
115  configData.kpAdmittance = controller.s.kpAdmittance;
116  configData.kdAdmittance = controller.s.kdAdmittance;
117  configData.kmAdmittance = controller.s.kmAdmittance;
118 
119  configData.kpNullspace = controller.s.kpNullspace;
120  configData.kdNullspace = controller.s.kdNullspace;
121 
122  configData.currentForceTorque.setZero();
123  configData.desiredNullspaceJointAngles = controller.s.desiredNullspaceJointAngles;
124 
125  configData.torqueLimit = controller.s.torqueLimit;
126  configData.qvelFilter = controller.s.qvelFilter;
127 
128  configData.numPoints = controller.s.numPoints;
129  configData.keypointKp = controller.s.keypointKp;
130  configData.keypointKd = controller.s.keypointKd;
131 
132  configData.currentKeypointPosition = controller.s.currentKeypointPosition;
133  configData.desiredKeypointPosition = controller.s.currentKeypointPosition;
134  configData.desiredKeypointVelocity = controller.s.desiredKeypointVelocity;
135  configData.keypointPositionFilter = controller.s.keypointPositionFilter;
136  configData.keypointVelocityFilter = controller.s.keypointVelocityFilter;
137 
138  configData.isRigid = controller.s.isRigid;
139  configData.fixedTranslation = controller.s.fixedTranslation;
140  reinitTripleBuffer(configData);
141  ARMARX_INFO << "--------------------------------------- done "
142  "---------------------------------------";
143  }
144 
145  std::string
147  {
148  return "NJointKeypointsAdmittanceController";
149  }
150 
151  std::string
153  {
154  return kinematicChainName;
155  }
156 
157  void
159  {
160  runTask("NJointTaskspaceAdmittanceAdditionalTask",
161  [&]
162  {
163  CycleUtil c(1);
164  getObjectScheduler()->waitForObjectStateMinimum(eManagedIceObjectStarted);
166  << "Create a new thread alone NJointKeypointsAdmittanceController";
167  while (getState() == eManagedIceObjectStarted)
168  {
169  if (isControllerActive() and rtReady.load())
170  {
171  additionalTask();
172  }
173  c.waitForCycleDuration();
174  }
175  });
176  }
177 
178  void
180  const IceUtil::Time& timeSinceLastIteration)
181  {
183  bool valid = controller.updateControlStatus(rtGetControlStruct(),
184  timeSinceLastIteration,
188 
189  if (rtFirstRun.load())
190  {
191  rtFirstRun.store(false);
192  rtReady.store(false);
193  ftsensor.reset();
194  controller.firstRun();
195  }
196  else
197  {
198  ftsensor.compensateTCPGravity(ftSensorBuffer.getReadBuffer());
199  if (!rtReady.load())
200  {
201  if (ftsensor.calibrate(controller.s.deltaT))
202  {
203  rtReady.store(true);
204  }
205  }
206  else
207  {
208  if (valid)
209  {
210  controller.s.currentForceTorque =
211  ftsensor.getFilteredForceTorque(ftSensorBuffer.getReadBuffer());
212  }
213  }
214  }
215 
216  controller.run(rtReady.load(), targets);
217 
218 
219  /// for debug output
220  {
221  controlStatusBuffer.getWriteBuffer().currentPose = controller.s.currentPose;
222  controlStatusBuffer.getWriteBuffer().currentTwist = controller.s.currentTwist * 1000.0f;
223  controlStatusBuffer.getWriteBuffer().deltaT = controller.s.deltaT;
224 
225  controlStatusBuffer.getWriteBuffer().kpImpedance = controller.s.kpImpedance;
226  controlStatusBuffer.getWriteBuffer().kdImpedance = controller.s.kdImpedance;
227  controlStatusBuffer.getWriteBuffer().forceImpedance = controller.s.forceImpedance;
228  controlStatusBuffer.getWriteBuffer().currentForceTorque =
229  controller.s.currentForceTorque;
230  controlStatusBuffer.getWriteBuffer().pointTrackingForce =
231  controller.s.pointTrackingForce;
232 
233  controlStatusBuffer.getWriteBuffer().virtualPose = controller.s.virtualPose;
234  controlStatusBuffer.getWriteBuffer().virtualVel = controller.s.virtualVel;
235  controlStatusBuffer.getWriteBuffer().virtualAcc = controller.s.virtualAcc;
236 
237  controlStatusBuffer.getWriteBuffer().desiredPose = controller.s.desiredPose;
238  controlStatusBuffer.getWriteBuffer().desiredVel = controller.s.desiredVel;
239  controlStatusBuffer.getWriteBuffer().desiredAcc = controller.s.desiredAcc;
240 
241  controlStatusBuffer.getWriteBuffer().desiredKeypointPosition =
242  controller.s.desiredKeypointPosition;
243  controlStatusBuffer.getWriteBuffer().currentKeypointPosition =
244  controller.s.currentKeypointPosition;
245  controlStatusBuffer.getWriteBuffer().currentKeypointVelocity =
246  controller.s.currentKeypointVelocity;
247  controlStatusBuffer.getWriteBuffer().filteredKeypointPosition =
248  controller.s.filteredKeypointPosition;
249 
250  controlStatusBuffer.getWriteBuffer().desiredJointTorques =
251  controller.s.desiredJointTorques;
253  }
254  }
255 
256  void
259  const DebugObserverInterfacePrx& debugObs)
260  {
261  StringVariantBaseMap datafields;
262  auto values = controlStatusBuffer.getUpToDateReadBuffer().desiredJointTorques;
263  for (int i = 0; i < values.size(); i++)
264  {
265  datafields["torque_" + std::to_string(i)] = new Variant(values(i));
266  }
267 
268  int dim = 3 * controlStatusBuffer.getUpToDateReadBuffer().numPoints;
269 
270  Eigen::Matrix4f virtualPose = controlStatusBuffer.getUpToDateReadBuffer().virtualPose;
271  Eigen::Vector3f rpy = VirtualRobot::MathTools::eigen4f2rpy(virtualPose);
272  datafields["virtualPose_x"] = new Variant(virtualPose(0, 3));
273  datafields["virtualPose_y"] = new Variant(virtualPose(1, 3));
274  datafields["virtualPose_z"] = new Variant(virtualPose(2, 3));
275  datafields["virtualPose_rx"] = new Variant(rpy(0));
276  datafields["virtualPose_ry"] = new Variant(rpy(1));
277  datafields["virtualPose_rz"] = new Variant(rpy(2));
278 
279  Eigen::Matrix4f desiredPose = controlStatusBuffer.getUpToDateReadBuffer().desiredPose;
280  Eigen::Vector3f rpyDesired = VirtualRobot::MathTools::eigen4f2rpy(desiredPose);
281  datafields["desiredPose_x"] = new Variant(desiredPose(0, 3));
282  datafields["desiredPose_y"] = new Variant(desiredPose(1, 3));
283  datafields["desiredPose_z"] = new Variant(desiredPose(2, 3));
284  datafields["desiredPose_rx"] = new Variant(rpyDesired(0));
285  datafields["desiredPose_ry"] = new Variant(rpyDesired(1));
286  datafields["desiredPose_rz"] = new Variant(rpyDesired(2));
287 
288  datafields["virtualVel_x"] =
290  datafields["virtualVel_y"] =
292  datafields["virtualVel_z"] =
294  datafields["virtualVel_rx"] =
296  datafields["virtualVel_ry"] =
298  datafields["virtualVel_rz"] =
300 
301  datafields["virtualAcc_x"] =
303  datafields["virtualAcc_y"] =
305  datafields["virtualAcc_z"] =
307  datafields["virtualAcc_rx"] =
309  datafields["virtualAcc_ry"] =
311  datafields["virtualAcc_rz"] =
313 
314  datafields["desiredTwist_x"] =
316  datafields["desiredTwist_y"] =
318  datafields["desiredTwist_z"] =
320  datafields["desiredTwist_rx"] =
322  datafields["desiredTwist_ry"] =
324  datafields["desiredTwist_rz"] =
326 
327  datafields["desiredAcc_x"] =
329  datafields["desiredAcc_y"] =
331  datafields["desiredAcc_z"] =
333  datafields["desiredAcc_rx"] =
335  datafields["desiredAcc_ry"] =
337  datafields["desiredAcc_rz"] =
339 
340  datafields["kpImpedance_x"] =
341  new Variant(controlStatusBuffer.getUpToDateReadBuffer().kpImpedance(0));
342  datafields["kpImpedance_y"] =
343  new Variant(controlStatusBuffer.getUpToDateReadBuffer().kpImpedance(1));
344  datafields["kpImpedance_z"] =
345  new Variant(controlStatusBuffer.getUpToDateReadBuffer().kpImpedance(2));
346  datafields["kpImpedance_rx"] =
347  new Variant(controlStatusBuffer.getUpToDateReadBuffer().kpImpedance(3));
348  datafields["kpImpedance_ry"] =
349  new Variant(controlStatusBuffer.getUpToDateReadBuffer().kpImpedance(4));
350  datafields["kpImpedance_rz"] =
351  new Variant(controlStatusBuffer.getUpToDateReadBuffer().kpImpedance(5));
352 
353  datafields["kdImpedance_x"] =
354  new Variant(controlStatusBuffer.getUpToDateReadBuffer().kdImpedance(0));
355  datafields["kdImpedance_y"] =
356  new Variant(controlStatusBuffer.getUpToDateReadBuffer().kdImpedance(1));
357  datafields["kdImpedance_z"] =
358  new Variant(controlStatusBuffer.getUpToDateReadBuffer().kdImpedance(2));
359  datafields["kdImpedance_rx"] =
360  new Variant(controlStatusBuffer.getUpToDateReadBuffer().kdImpedance(3));
361  datafields["kdImpedance_ry"] =
362  new Variant(controlStatusBuffer.getUpToDateReadBuffer().kdImpedance(4));
363  datafields["kdImpedance_rz"] =
364  new Variant(controlStatusBuffer.getUpToDateReadBuffer().kdImpedance(5));
365 
366  datafields["forceImpedance_x"] =
367  new Variant(controlStatusBuffer.getUpToDateReadBuffer().forceImpedance(0));
368  datafields["forceImpedance_y"] =
369  new Variant(controlStatusBuffer.getUpToDateReadBuffer().forceImpedance(1));
370  datafields["forceImpedance_z"] =
371  new Variant(controlStatusBuffer.getUpToDateReadBuffer().forceImpedance(2));
372  datafields["forceImpedance_rx"] =
373  new Variant(controlStatusBuffer.getUpToDateReadBuffer().forceImpedance(3));
374  datafields["forceImpedance_ry"] =
375  new Variant(controlStatusBuffer.getUpToDateReadBuffer().forceImpedance(4));
376  datafields["forceImpedance_rz"] =
377  new Variant(controlStatusBuffer.getUpToDateReadBuffer().forceImpedance(5));
378 
379  datafields["currentForceTorque_x"] =
380  new Variant(controlStatusBuffer.getUpToDateReadBuffer().currentForceTorque(0));
381  datafields["currentForceTorque_y"] =
382  new Variant(controlStatusBuffer.getUpToDateReadBuffer().currentForceTorque(1));
383  datafields["currentForceTorque_z"] =
384  new Variant(controlStatusBuffer.getUpToDateReadBuffer().currentForceTorque(2));
385  datafields["currentForceTorque_rx"] =
386  new Variant(controlStatusBuffer.getUpToDateReadBuffer().currentForceTorque(3));
387  datafields["currentForceTorque_ry"] =
388  new Variant(controlStatusBuffer.getUpToDateReadBuffer().currentForceTorque(4));
389  datafields["currentForceTorque_rz"] =
390  new Variant(controlStatusBuffer.getUpToDateReadBuffer().currentForceTorque(5));
391 
392  datafields["pointTrackingForce_x"] =
393  new Variant(controlStatusBuffer.getUpToDateReadBuffer().pointTrackingForce(0));
394  datafields["pointTrackingForce_y"] =
395  new Variant(controlStatusBuffer.getUpToDateReadBuffer().pointTrackingForce(1));
396  datafields["pointTrackingForce_z"] =
397  new Variant(controlStatusBuffer.getUpToDateReadBuffer().pointTrackingForce(2));
398  datafields["pointTrackingForce_rx"] =
399  new Variant(controlStatusBuffer.getUpToDateReadBuffer().pointTrackingForce(3));
400  datafields["pointTrackingForce_ry"] =
401  new Variant(controlStatusBuffer.getUpToDateReadBuffer().pointTrackingForce(4));
402  datafields["pointTrackingForce_rz"] =
403  new Variant(controlStatusBuffer.getUpToDateReadBuffer().pointTrackingForce(5));
404 
405  for (int i = 0; i < dim; i++)
406  {
407  datafields["desiredKeypointPosition_" + std::to_string(i)] =
408  new Variant(controlStatusBuffer.getUpToDateReadBuffer().desiredKeypointPosition(i));
409  datafields["currentKeypointPosition_" + std::to_string(i)] =
410  new Variant(controlStatusBuffer.getUpToDateReadBuffer().currentKeypointPosition(i));
411  datafields["currentKeypointVelocity_" + std::to_string(i)] =
412  new Variant(controlStatusBuffer.getUpToDateReadBuffer().currentKeypointVelocity(i));
413  datafields["filteredKeypointPosition_" + std::to_string(i)] = new Variant(
414  controlStatusBuffer.getUpToDateReadBuffer().filteredKeypointPosition(i));
415  }
416  debugObs->setDebugChannel("NJointKeypointsAdmittanceController", datafields);
417  }
418 
419  void
421  const Ice::Current&)
422  {
423  law::KeypointsAdmittanceController::Config config = controller.reconfigure(filename);
424  reinitTripleBuffer(config);
425 
426  common::FTSensor::FTBufferData ftConfig = ftsensor.reconfigure(filename);
428  }
429 
430  void
432  const Eigen::VectorXf& value,
433  const Ice::Current&)
434  {
436  if (name == "target")
437  {
438  ARMARX_CHECK_EQUAL(value.size(), controller.s.numPoints);
439  getWriterControlStruct().desiredKeypointPosition = value;
440  }
441  else if (name == "current")
442  {
443  ARMARX_CHECK_EQUAL(value.size(), controller.s.numPoints);
444  getWriterControlStruct().currentKeypointPosition = value;
445  }
446  else if (name == "kp")
447  {
448  ARMARX_CHECK_EQUAL(value.size(), controller.s.numPoints);
449  getWriterControlStruct().keypointKp = value;
450  }
451  else if (name == "kd")
452  {
453  ARMARX_CHECK_EQUAL(value.size(), controller.s.numPoints);
454  getWriterControlStruct().keypointKd = value;
455  }
456  else if (name == "translation")
457  {
458  ARMARX_CHECK_EQUAL(value.size(), controller.s.numPoints);
459  getWriterControlStruct().fixedTranslation = value;
460  }
461  }
462 
463  void
465  const Eigen::VectorXf& value,
466  const Ice::Current&)
467  {
469  if (name == "impedance_stiffness")
470  {
471  ARMARX_CHECK_EQUAL(value.size(), 6);
472  getWriterControlStruct().kpImpedance = value;
473  }
474  else if (name == "impedance_damping")
475  {
476  ARMARX_CHECK_EQUAL(value.size(), 6);
477  getWriterControlStruct().kdImpedance = value;
478  }
479  else if (name == "admittance_stiffness")
480  {
481  ARMARX_CHECK_EQUAL(value.size(), 6);
482  getWriterControlStruct().kpAdmittance = value;
483  }
484  else if (name == "admittance_damping")
485  {
486  ARMARX_CHECK_EQUAL(value.size(), 6);
487  getWriterControlStruct().kdAdmittance = value;
488  }
489  else if (name == "admittance_inertia")
490  {
491  ARMARX_CHECK_EQUAL(value.size(), 6);
492  getWriterControlStruct().kmAdmittance = value;
493  }
494  else if (name == "nullspace_stiffness")
495  {
496  ARMARX_CHECK_EQUAL((unsigned)value.size(), targets.size());
497  getWriterControlStruct().kpNullspace = value;
498  }
499  else if (name == "nullspace_damping")
500  {
501  ARMARX_CHECK_EQUAL((unsigned)value.size(), targets.size());
502  getWriterControlStruct().kdNullspace = value;
503  }
504  else if (name == "desired_nullspace_joint_angles")
505  {
506  ARMARX_CHECK_EQUAL((unsigned)value.size(), targets.size());
507  getWriterControlStruct().desiredNullspaceJointAngles = value;
508  }
509  else
510  {
511  ARMARX_ERROR << name << " is not supported by TaskSpaceAdmittanceController";
512  }
514  }
515 
516  void
518  const Eigen::Vector3f& forceBaseline,
519  const Eigen::Vector3f& torqueBaseline,
520  const Ice::Current&)
521  {
522  ftSensorBuffer.getWriteBuffer().forceBaseline = forceBaseline;
523  ftSensorBuffer.getWriteBuffer().torqueBaseline = torqueBaseline;
525  }
526 
527  void
529  {
530  ftSensorBuffer.getWriteBuffer().enableTCPGravityCompensation = true;
531  ftSensorBuffer.getWriteBuffer().tcpMass = mass;
533  }
534 
535  void
537  const Eigen::Vector3f& tcpCoMInFTSensorFrame,
538  const Ice::Current&)
539  {
540  ftSensorBuffer.getWriteBuffer().enableTCPGravityCompensation = true;
541  ftSensorBuffer.getWriteBuffer().tcpCoMInFTSensorFrame = tcpCoMInFTSensorFrame;
543  }
544 
545  void
547  {
548  rtReady.store(false);
549  }
550 
551  void
553  const Ice::Current&)
554  {
555  ftSensorBuffer.getWriteBuffer().enableTCPGravityCompensation = toggle;
557  rtReady.store(false); /// you also need to re-calibrate ft sensor
558  }
559 
560  void
562  {
563  VirtualRobot::RobotNodeSetPtr rns = rtGetRobot()->getRobotNodeSet(kinematicChainName);
564  Eigen::Matrix4f currentPose = rns->getTCP()->getPoseInRootFrame();
565  ARMARX_IMPORTANT << "rt preactivate controller with target pose\n\n" << currentPose;
566  controller.preactivateInit(rns);
567  getWriterControlStruct().desiredNullspaceJointAngles =
568  controller.s.desiredNullspaceJointAngles;
570 
572  }
573 } // namespace armarx::control::njoint_controller::task_space
armarx::NJointControllerWithTripleBuffer< law::KeypointsAdmittanceController::Config >::reinitTripleBuffer
void reinitTripleBuffer(const law::KeypointsAdmittanceController::Config &initial)
Definition: NJointControllerWithTripleBuffer.h:68
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::setKeypointsParameters
void setKeypointsParameters(const std::string &name, const Eigen::VectorXf &value, const Ice::Current &) override
Definition: KeypointsAdmittanceController.cpp:431
armarx::ControlTargetBase::asA
const T * asA() const
Definition: ControlTargetBase.h:76
armarx::Variant
The Variant class is described here: Variants.
Definition: Variant.h:223
armarx::VariantType::Float
const VariantTypeId Float
Definition: Variant.h:919
armarx::TripleBuffer::getWriteBuffer
T & getWriteBuffer()
Definition: TripleBuffer.h:92
armarx::NJointControllerBase::useSynchronizedRtRobot
const VirtualRobot::RobotPtr & useSynchronizedRtRobot(bool updateCollisionModel=false)
Requests a VirtualRobot for use in rtRun *.
Definition: NJointController.cpp:293
armarx::NJointControllerWithTripleBuffer< law::KeypointsAdmittanceController::Config >::rtGetControlStruct
const law::KeypointsAdmittanceController::Config & rtGetControlStruct() const
Definition: NJointControllerWithTripleBuffer.h:32
armarx::StringVariantBaseMap
std::map< std::string, VariantBasePtr > StringVariantBaseMap
Definition: ManagedIceObject.h:110
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::setTCPMass
void setTCPMass(Ice::Float, const Ice::Current &) override
Definition: KeypointsAdmittanceController.cpp:528
ARMARX_IMPORTANT
#define ARMARX_IMPORTANT
Definition: Logging.h:190
armarx::SensorValueBase::asA
const T * asA() const
Definition: SensorValueBase.h:82
armarx::SensorValueBase
The SensorValueBase class.
Definition: SensorValueBase.h:40
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::additionalTask
virtual void additionalTask()
Definition: KeypointsAdmittanceController.h:87
armarx::ControlTargetBase
Brief description of class JointControlTargetBase.
Definition: ControlTargetBase.h:47
RobotUnit.h
armarx::TripleBuffer::commitWrite
void commitWrite()
Definition: TripleBuffer.h:163
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:650
armarx::NJointControllerBase::useControlTarget
ControlTargetBase * useControlTarget(const std::string &deviceName, const std::string &controlMode)
Declares to calculate the ControlTarget for the given ControlDevice in the given ControlMode when rtR...
Definition: NJointController.cpp:410
armarx::control::njoint_controller::task_space
Definition: AdmittanceController.cpp:43
armarx::CycleUtil
This util class helps with keeping a cycle time during a control cycle.
Definition: CycleUtil.h:40
armarx::ManagedIceObject::getState
int getState() const
Retrieve current state of the ManagedIceObject.
Definition: ManagedIceObject.cpp:769
ProsthesisInterface.values
values
Definition: ProsthesisInterface.py:190
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::ftsensor
common::FTSensor ftsensor
Definition: KeypointsAdmittanceController.h:105
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::rtPreActivateController
void rtPreActivateController() override
This function is called before the controller is activated.
Definition: KeypointsAdmittanceController.cpp:561
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
armarx::NJointControllerBase::ConfigPtrT
NJointControllerConfigPtr ConfigPtrT
Definition: NJointControllerBase.h:587
armarx::NJointControllerWithTripleBuffer< law::KeypointsAdmittanceController::Config >::getWriterControlStruct
law::KeypointsAdmittanceController::Config & getWriterControlStruct()
Definition: NJointControllerWithTripleBuffer.h:54
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::reconfigureController
void reconfigureController(const std::string &filename, const Ice::Current &iceCurrent=Ice::emptyCurrent) override
set control target
Definition: KeypointsAdmittanceController.cpp:420
armarx::NJointControllerWithTripleBuffer< law::KeypointsAdmittanceController::Config >::LockGuardType
std::lock_guard< std::recursive_mutex > LockGuardType
Definition: NJointControllerWithTripleBuffer.h:14
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::toggleGravityCompensation
void toggleGravityCompensation(const bool toggle, const Ice::Current &) override
Definition: KeypointsAdmittanceController.cpp:552
armarx::control::njoint_controller::task_space::registrationControllerNJointKeypointsAdmittanceController
NJointControllerRegistration< NJointKeypointsAdmittanceController > registrationControllerNJointKeypointsAdmittanceController("NJointKeypointsAdmittanceController")
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::jointNames
std::vector< std::string > jointNames
Definition: KeypointsAdmittanceController.h:103
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::onInitNJointController
void onInitNJointController() override
Definition: KeypointsAdmittanceController.cpp:158
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::setForceTorqueBaseline
void setForceTorqueBaseline(const Eigen::Vector3f &, const Eigen::Vector3f &, const Ice::Current &) override
ft sensor
Definition: KeypointsAdmittanceController.cpp:517
armarx::NJointControllerBase::rtGetRobot
const VirtualRobot::RobotPtr & rtGetRobot()
TODO make protected and use attorneys.
Definition: NJointControllerBase.h:846
armarx::detail::ControlThreadOutputBufferEntry
Definition: ControlThreadOutputBuffer.h:182
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:855
controller
Definition: AddOperation.h:39
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::calibrateFTSensor
void calibrateFTSensor(const Ice::Current &) override
Definition: KeypointsAdmittanceController.cpp:546
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::getKinematicChainName
std::string getKinematicChainName(const Ice::Current &) override
Definition: KeypointsAdmittanceController.cpp:152
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::torqueSensors
std::vector< const SensorValue1DoFActuatorTorque * > torqueSensors
devices
Definition: KeypointsAdmittanceController.h:94
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::onPublish
void onPublish(const SensorAndControl &, const DebugDrawerInterfacePrx &, const DebugObserverInterfacePrx &) override
Definition: KeypointsAdmittanceController.cpp:257
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::getClassName
std::string getClassName(const Ice::Current &) const override
Definition: KeypointsAdmittanceController.cpp:146
armarx::NJointControllerBase::isControllerActive
bool isControllerActive(const Ice::Current &=Ice::emptyCurrent) const final override
Definition: NJointControllerBase.h:778
armarx::NJointControllerBase::runTask
void runTask(const std::string &taskName, Task &&task)
Executes a given task in a separate thread from the Application ThreadPool.
Definition: NJointControllerBase.h:754
armarx::NJointControllerWithTripleBuffer< law::KeypointsAdmittanceController::Config >::rtUpdateControlStruct
bool rtUpdateControlStruct()
Definition: NJointControllerWithTripleBuffer.h:38
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::configFileName
std::string configFileName
variables
Definition: KeypointsAdmittanceController.h:102
armarx::NJointControllerWithTripleBuffer< law::KeypointsAdmittanceController::Config >::writeControlStruct
void writeControlStruct()
Definition: NJointControllerWithTripleBuffer.h:44
armarx::TripleBuffer::getReadBuffer
const T & getReadBuffer() const
Definition: TripleBuffer.h:108
filename
std::string filename
Definition: VisualizationRobot.cpp:86
ArmarXObjectScheduler.h
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::ftSensorBuffer
TripleBuffer< common::FTSensor::FTBufferData > ftSensorBuffer
Definition: KeypointsAdmittanceController.h:109
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::NJointKeypointsAdmittanceController
NJointKeypointsAdmittanceController(const RobotUnitPtr &robotUnit, const NJointControllerConfigPtr &config, const VirtualRobot::RobotPtr &)
Definition: KeypointsAdmittanceController.cpp:42
ControlTarget1DoFActuator.h
armarx::NJointControllerWithTripleBuffer< law::KeypointsAdmittanceController::Config >::controlDataMutex
MutexType controlDataMutex
Definition: NJointControllerWithTripleBuffer.h:73
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:196
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::kinematicChainName
std::string kinematicChainName
Definition: KeypointsAdmittanceController.h:112
armarx::to_string
const std::string & to_string(const std::string &s)
Definition: StringHelpers.h:41
CycleUtil.h
NJointController.h
ARMARX_CHECK_EXPRESSION
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
Definition: ExpressionException.h:73
KeypointsAdmittanceController.h
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:181
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::rtRun
void rtRun(const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration) override
TODO make protected and use attorneys.
Definition: KeypointsAdmittanceController.cpp:179
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::velocitySensors
std::vector< const SensorValue1DoFActuatorVelocity * > velocitySensors
Definition: KeypointsAdmittanceController.h:95
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::setTCPCoMInFTFrame
void setTCPCoMInFTFrame(const Eigen::Vector3f &, const Ice::Current &) override
Definition: KeypointsAdmittanceController.cpp:536
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::controlStatusBuffer
TripleBuffer< law::KeypointsAdmittanceController::Status > controlStatusBuffer
set buffers
Definition: KeypointsAdmittanceController.h:108
IceUtil::Handle< class RobotUnit >
IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface >
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::positionSensors
std::vector< const SensorValue1DoFActuatorPosition * > positionSensors
Definition: KeypointsAdmittanceController.h:96
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::setControlParameters
void setControlParameters(const std::string &, const Eigen::VectorXf &, const Ice::Current &) override
Definition: KeypointsAdmittanceController.cpp:464
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::targets
std::vector< ControlTarget1DoFActuatorTorque * > targets
Definition: KeypointsAdmittanceController.h:97
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::rtFirstRun
std::atomic_bool rtFirstRun
Definition: KeypointsAdmittanceController.h:111
armarx::TripleBuffer::getUpToDateReadBuffer
const T & getUpToDateReadBuffer() const
Definition: TripleBuffer.h:116
ARMARX_CHECK_EQUAL
#define ARMARX_CHECK_EQUAL(lhs, rhs)
This macro evaluates whether lhs is equal (==) rhs and if it turns out to be false it will throw an E...
Definition: ExpressionException.h:130
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:193
armarx::control::njoint_controller::task_space::NJointKeypointsAdmittanceController::rtReady
std::atomic_bool rtReady
Definition: KeypointsAdmittanceController.h:113
armarx::TripleBuffer::reinitAllBuffers
std::enable_if< std::is_copy_constructible< U >::value >::type reinitAllBuffers(const T &init)
Definition: TripleBuffer.h:171
armarx::ManagedIceObject::getObjectScheduler
ArmarXObjectSchedulerPtr getObjectScheduler() const
Definition: ManagedIceObject.cpp:776
SensorValue1DoFActuator.h
armarx::NJointControllerBase::useSensorValue
const SensorValueBase * useSensorValue(const std::string &sensorDeviceName) const
Get a const ptr to the given SensorDevice's SensorValue.
Definition: NJointController.cpp:383
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:19