WholeBodyTrajectoryController.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  * @author Fabian Reister (fabian dot reister at kit dot edu)
17  * @date 2024
18  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19  * GNU General Public License
20  */
21 
23 
24 #include <cstdint>
25 #include <optional>
26 #include <set>
27 
28 #include <SimoxUtility/algorithm/string/string_conversion_eigen.h>
29 #include <SimoxUtility/json/eigen_conversion.h>
30 #include <SimoxUtility/json/json.h>
31 #include <SimoxUtility/math/convert/mat4f_to_rpy.h>
32 
40 
46 
48 #include <armarx/control/interface/ConfigurableNJointControllerInterface.h>
49 #include <armarx/control/njoint_controller/joint_space/aron/WholeBodyTrajectoryControllerConfig.aron.generated.h>
50 
51 #include <range/v3/view/zip.hpp>
52 
54 {
55 
58 
59  Controller::Controller(const RobotUnitPtr& robotUnit,
60  const NJointControllerConfigPtr& config,
61  const VirtualRobot::RobotPtr& robot) :
63  pidPlatform_(initialConfigData().pidPlatform.Kp,
64  initialConfigData().pidPlatform.Ki,
65  initialConfigData().pidPlatform.Kd,
66  initialConfigData().pidPlatform.maxControlValue,
67  initialConfigData().pidPlatform.maxDerivation),
68  opidPlatform_(initialConfigData().opidPlatform.Kp,
69  initialConfigData().opidPlatform.Ki,
70  initialConfigData().opidPlatform.Kd,
71  initialConfigData().opidPlatform.maxControlValue,
72  initialConfigData().opidPlatform.maxDerivation,
73  true)
74  {
75  ARMARX_IMPORTANT << "Creating "
76  << common::ControllerTypeNames.to_name(
78 
79  ARMARX_CHECK_EXPRESSION(robotUnit);
80 
81  ARMARX_INFO << "Using RT robot";
82  robot_ = useSynchronizedRtRobot();
83  ARMARX_CHECK_NOT_NULL(robot_);
84 
85  ARMARX_INFO << "Created RT robot";
86 
87 
88  // initialize control targets
89  {
90  ARMARX_INFO << "Initializing control targets";
91  controlTargets_.platformTarget =
92  useControlTarget(robotUnit->getRobotPlatformName(),
93  ControlModes::HolonomicPlatformVelocity)
95  ARMARX_CHECK_EXPRESSION(controlTargets_.platformTarget)
96  << "The actuator " << robotUnit->getRobotPlatformName() << " has no control mode "
97  << ControlModes::HolonomicPlatformVelocity;
98 
99  for (const auto& jointName : initialConfigData().jointNames)
100  {
101  auto* const controlTarget = useControlTarget<ControlTarget1DoFActuatorVelocity>(
102  jointName, ControlModes::Velocity1DoF);
103  ARMARX_CHECK_NOT_NULL(controlTarget) << jointName;
104 
105  controlTargets_.jointTargets.push_back(controlTarget);
106  }
107  ARMARX_INFO << VAROUT(initialConfigData().jointNames);
108 
109  for (const auto& jointName : initialConfigData().handJointNames)
110  {
111  auto* const controlTarget = useControlTarget<ControlTarget1DoFActuatorPosition>(
112  jointName, ControlModes::Position1DoF);
113  ARMARX_CHECK_NOT_NULL(controlTarget) << jointName;
114 
115  controlTargets_.handTargets.push_back(controlTarget);
116  }
117  ARMARX_INFO << VAROUT(initialConfigData().handJointNames);
118  }
119 
120  // initialize sensor values
121  {
122  ARMARX_INFO << "Initializing sensor values";
123 
124  // initialize joint sensor values
125  {
126  for (const auto& jointName : initialConfigData().jointNames)
127  {
128  const SensorValueBase* sv = useSensorValue(jointName);
129  jointSensorValues_.push_back(sv->asA<SensorValue1DoFActuator>());
130  }
131  }
132 
133  // initialize global pose sensor value
134  {
135  const SensorValueBase* sv =
137  svGlobalRobotLocalization_ =
139  }
140  }
141 
142  // initialize arm PID controller
143  {
144  ARMARX_INFO << "Initializing PID controller";
145 
146  std::vector<bool> isJointLimitless;
147  for (const auto& jointName : initialConfigData().jointNames)
148  {
149  const auto node = robot_->getRobotNode(jointName);
150  isJointLimitless.push_back(node->isLimitless());
151  }
152 
153  pidArm_.emplace(initialConfigData().pidArm.Kp,
154  initialConfigData().pidArm.Ki,
155  initialConfigData().pidArm.Kd,
156  initialConfigData().pidArm.maxControlValue,
157  initialConfigData().pidArm.maxDerivation,
158  false,
159  isJointLimitless);
160 
161  const std::size_t nDofArm = initialConfigData().jointNames.size();
162  pidArm_->preallocate(nDofArm);
163  }
164 
165  // preallocate other PID controllers
166  {
167  ARMARX_TRACE;
168  pidPlatform_.preallocate(2);
169  }
170 
171  // initialize jointNames
172  {
173  ARMARX_TRACE;
174  jointNames_ = initialConfigData().jointNames;
175  }
176 
177  // initialize helper nodes etc
178  {
179  ARMARX_INFO << "Initializing helper nodes";
180  // FIXME remove hard coded string
181  const std::string tcpNodeName = "Hand R TCP";
182 
183  // maybe this is causing issues (cloning rt robot in non rt part)
184  ARMARX_INFO << "Debug robot";
185  debugRobot_ = robot->clone();
186  ARMARX_INFO << "cloned.";
187 
188  ARMARX_CHECK_NOT_NULL(debugRobot_);
189  publishTcpNode_ = debugRobot_->getRobotNode(tcpNodeName);
190  ARMARX_CHECK_NOT_NULL(publishTcpNode_);
191 
192  rtTcpNode_ = robot_->getRobotNode(tcpNodeName);
193  ARMARX_CHECK_NOT_NULL(rtTcpNode_);
194  }
195 
196  // initialize trajectory
197  ARMARX_INFO << "Initializing trajectory";
199  trajectory_.emplace(initialConfigData().trajectory);
200 
201  reinitTripleBuffer({});
202 
203  // init debug data (for onPublish), preallocate memory (very important here!)
204  {
205  ARMARX_INFO << "Initializing debug data";
206  const DebugData initDebugData{
207  .localTimestamp = 0,
208  .platformPosDiff = 0,
209  .platformOriDiff = 0,
210  .jointPosDiff = std::vector<float>(initialConfigData().jointNames.size(), 0),
211  .targetState = trajectory_->initialPoint(),
212  .currentTcpPose = Eigen::Isometry3f{rtTcpNode_->getGlobalPose()},
213  .currentPlatformPose = Eigen::Isometry3f{robot_->getGlobalPose()},
214  .isControllerActive = false};
215 
216  bufferRtToOnPublish_.reinitAllBuffers(initDebugData);
217  }
218 
219  ARMARX_INFO << "Init done.";
220  }
221 
222  std::string
223  Controller::getClassName(const Ice::Current& iceCurrent) const
224  {
225  return common::ControllerTypeNames.to_name(
227  }
228 
229  void
230  Controller::rtRun(const IceUtil::Time& sensorValuesTimestamp,
231  const IceUtil::Time& timeSinceLastIteration)
232  {
234 
235  auto& debugData = bufferRtToOnPublish_.getWriteBuffer();
236 
237  // const armarx::DateTime timestamp(sensorValuesTimestamp);
238  const std::int64_t timestamp = armarx::rtNow().toMicroSeconds();
239 
240  ARMARX_CHECK_NOT_NULL(trajectory_);
241 
242  // trajectory replay finished?
243  // if (not trajectory_->isValid(timestamp))
244  // {
245  // std::cerr << "Timestamp is not valid!" << std::endl;
246  // std::cerr << timestamp << std::endl;
247  // std::cerr << armarx::rtNow() << std::endl;
248 
249  // std::cerr << armarx::rtNow() << std::endl;
250 
251 
252  // // platform: set to velocity zero
253  // controlTargets_.platformTarget->velocityX = 0;
254  // controlTargets_.platformTarget->velocityY = 0;
255  // controlTargets_.platformTarget->velocityRotation = 0;
256 
257  // // joints: we are in position control mode so we just keep the last target
258 
259  // return;
260  // }
261 
262  const auto trajPointOpt = trajectory_->at(timestamp);
263 
264  ARMARX_TRACE;
265 
266  if (not trajPointOpt.has_value()) // or not trajectory_->timeBounds().isWithin(timestamp))
267  {
268  // ARMARX_WARNING << "Timestamp is not within bounds!";
269 
270  // platform: set to velocity zero
271  controlTargets_.platformTarget->velocityX = 0;
272  controlTargets_.platformTarget->velocityY = 0;
273  controlTargets_.platformTarget->velocityRotation = 0;
274 
275  // joints: we are in velocity control mode so we set the target to zero
276  for (auto* const jointControlTarget : controlTargets_.jointTargets)
277  {
278  jointControlTarget->velocity = 0;
279  }
280 
281  return;
282  }
283 
284  ARMARX_TRACE;
285  const Trajectory::TrajectoryPoint& trajPoint = trajPointOpt.value();
286 
287  debugData.localTimestamp = trajPoint.timestampMicroSeconds;
288  debugData.targetState = trajPoint;
289  debugData.currentTcpPose = Eigen::Isometry3f{rtTcpNode_->getGlobalPose()};
290  debugData.currentPlatformPose = Eigen::Isometry3f{robot_->getGlobalPose()};
291  debugData.isControllerActive = isControllerActive();
292 
293  // update control devices: platform; See: NJointHolonomicPlatformGlobalPositionController
294  {
295  ARMARX_CHECK_EQUAL(trajPoint.jointValuesPlatform.size(), 3);
296  ARMARX_CHECK_EQUAL(trajPoint.jointVelocitiesPlatform.size(), 3);
297 
298  const Eigen::Vector2f global_P_robot_target{trajPoint.jointValuesPlatform.at(0),
299  trajPoint.jointValuesPlatform.at(1)};
300  const double targetOrientationGlobal = trajPoint.jointValuesPlatform.at(2);
301 
302  ARMARX_CHECK_NOT_NULL(svGlobalRobotLocalization_);
303  const auto global_T_robot = svGlobalRobotLocalization_->global_T_root;
304  const Eigen::Vector3f rpy = simox::math::mat4f_to_rpy(global_T_robot);
305  const float globalOrientation = rpy.z();
306  const Eigen::Vector2f global_P_robot = global_T_robot.block<2, 1>(0, 3);
307 
308  const float measuredOrientation = globalOrientation;
309 
310  pidPlatform_.update(
311  timeSinceLastIteration.toSecondsDouble(), global_P_robot, global_P_robot_target);
312  opidPlatform_.update(timeSinceLastIteration.toSecondsDouble(),
313  static_cast<double>(measuredOrientation),
314  targetOrientationGlobal);
315 
316  {
317  debugData.platformPosDiff = (global_P_robot_target - global_P_robot).norm();
318  debugData.platformOriDiff =
319  static_cast<float>(targetOrientationGlobal) - measuredOrientation;
320  }
321 
322 
323  ARMARX_TRACE;
324  {
325  // The given velocity describes the velocity in the local frame of the robot relative to robot's global pose.
326  // The velocity targets that we must generate however are relative to the robot's platform frame.
327  // This means that we must rotate the given velocity targets to the robot's platform frame.
328 
329  const Eigen::Rotation2Df local_R_global(-measuredOrientation);
330  const Eigen::Vector2f& vPosError = local_R_global * pidPlatform_.getControlValue();
331  const Eigen::Vector2f vVelFFRobotFrame =
332  local_R_global * Eigen::Vector2f(trajPoint.jointVelocitiesPlatform.at(0),
333  trajPoint.jointVelocitiesPlatform.at(1));
334 
335  const auto& vFF = trajPoint.jointVelocitiesPlatform;
336 
337  // The feed forward values are in the local frame of the robot. This means that if the robot is rotated compared to desired orientation,
338  // then the robot will move in the wrong direction.
339 
340  // To fix this, we rotate the feed forward values to the global frame of the robot.
341  // const Eigen::Rotation2Df global_R_local_target(-targetOrientationGlobal);
342  // const Eigen::Rotation2Df local_R_local_target =
343  // global_R_local.inverse() * global_R_local_target;
344  // const Eigen::Vector2f vFF_local_target =
345  // local_R_local_target * Eigen::Vector2f(vFF.at(0), vFF.at(1));
346 
347  constexpr float ffFactorPlatform = 1.0; // FIXME check without as well
348 
349 
350  // controlTargets_.platformTarget->velocityX = vFF.at(0) + vPosError.x();
351  // controlTargets_.platformTarget->velocityY = vFF.at(1) + vPosError.y();
352  controlTargets_.platformTarget->velocityX =
353  ffFactorPlatform * vVelFFRobotFrame.x() + vPosError.x();
354  controlTargets_.platformTarget->velocityY =
355  ffFactorPlatform * vVelFFRobotFrame.y() + vPosError.y();
356  // controlTargets_.platformTarget->velocityRotation =
357  // vFF.at(2) + static_cast<float>(opidPlatform_.getControlValue());
358 
359  // FIXME remove 0
360 
361  controlTargets_.platformTarget->velocityRotation =
362  ffFactorPlatform * vFF.at(2) +
363  static_cast<float>(opidPlatform_.getControlValue());
364  }
365  }
366 
367  // update control devices: joints
368  ARMARX_TRACE;
369  {
370  ARMARX_CHECK_EQUAL(controlTargets_.jointTargets.size(), trajPoint.jointValues.size());
371  ARMARX_CHECK_EQUAL(controlTargets_.jointTargets.size(),
372  trajPoint.jointVelocities.size());
373 
374  ARMARX_CHECK_NOT_NULL(pidArm_);
375 
376 
377  const auto toEigen = [](const std::vector<double>& vec) -> Eigen::VectorXf
378  {
379  Eigen::VectorXf eigenVec(vec.size());
380  for (std::size_t i = 0; i < vec.size(); i++)
381  {
382  eigenVec(i) = static_cast<float>(vec.at(i));
383  }
384  return eigenVec;
385  };
386 
387  // update PID controller (internal update)
388  {
389 
390  const Eigen::VectorXf jointPositionTargets = toEigen(trajPoint.jointValues);
391 
392  // set joint position measured based on sensor values
393  Eigen::VectorXf jointPositionMeasured(jointSensorValues_.size());
394  for (std::size_t i = 0; i < jointSensorValues_.size(); i++)
395  {
396  jointPositionMeasured(i) = jointSensorValues_.at(i)->position;
397  }
398 
399  // update debug data structure
400  ARMARX_CHECK_EQUAL(debugData.jointPosDiff.size(), jointSensorValues_.size());
401  for (std::size_t i = 0; i < jointSensorValues_.size(); i++)
402  {
403  debugData.jointPosDiff.at(i) =
404  std::abs(jointPositionTargets(i) - jointPositionMeasured(i));
405  }
406 
407  // PID control for position error
408  pidArm_->update(timeSinceLastIteration.toSecondsDouble(),
409  jointPositionMeasured,
410  jointPositionTargets);
411  }
412 
413  const Eigen::VectorXf& jointVelocityForPosError = pidArm_->getControlValue();
414 
415  for (std::size_t i = 0; i < controlTargets_.jointTargets.size(); i++)
416  {
417  auto* const jointControlTarget = controlTargets_.jointTargets.at(i);
418 
419  // FIXME check if within bounds etc
420  // const double jointPosTarget = trajPoint.jointValues.at(i);
421  const double jointVelTarget = trajPoint.jointVelocities.at(i);
422 
423 
424  // update control target
425  jointControlTarget->velocity =
426  static_cast<float>(jointVelTarget) + jointVelocityForPosError(i);
427 
428  if (not jointControlTarget->isValid())
429  {
430  ARMARX_WARNING << "Invalid control target for " << VAROUT(i)
431  << ". Value: " << jointControlTarget->velocity;
432  }
433  }
434  }
435 
436  ARMARX_TRACE;
437  // update control devices: hand
438  {
439  ARMARX_CHECK_EQUAL(controlTargets_.handTargets.size(),
440  trajPoint.handJointValues.size());
441  for (std::size_t i = 0; i < controlTargets_.handTargets.size(); i++)
442  {
443  auto* const handControlTarget = controlTargets_.handTargets.at(i);
444  const double jointPosTarget = trajPoint.handJointValues.at(i);
445  handControlTarget->position = static_cast<float>(jointPosTarget);
446  }
447  }
448 
449  bufferRtToOnPublish_.commitWrite();
450 
451  // advance
452  // trajIdx_++;
453  }
454 
455  void
457  {
458  ARMARX_CHECK_NOT_NULL(trajectory_);
459  // FIXME is this the correct clock?
460  const std::int64_t timestampMicroSeconds = armarx::rtNow().toMicroSeconds();
461 
462  trajectory_->setStartTime(timestampMicroSeconds);
463 
464  ARMARX_CHECK(
465  whatever_.empty()); // controller is single-shot. Should be recreated for each run.
466  }
467 
468  void
470  const DebugDrawerInterfacePrx& debugDrawer,
471  const DebugObserverInterfacePrx& debugObservers)
472  {
473  StringVariantBaseMap datafields;
474 
475  const auto& debugData = bufferRtToOnPublish_.getUpToDateReadBuffer();
476 
477  datafields["localTimestamp"] = new Variant(debugData.localTimestamp);
478 
479  datafields["platform/dpos"] = new Variant(debugData.platformPosDiff);
480  datafields["platform/dori"] = new Variant(debugData.platformOriDiff);
481 
482  ARMARX_CHECK_EQUAL(jointNames_.size(), debugData.jointPosDiff.size());
483  for (const auto& [jointName, diff] :
484  ranges::views::zip(jointNames_, debugData.jointPosDiff))
485  {
486  datafields[jointName + "/dpos"] = new Variant(diff);
487  }
488 
489  const float tcpDiff = [&]() -> float
490  {
491  namespace rv = ranges::views;
492 
493  // set target joint values
494  std::map<std::string, float> targetJointValues;
495  for (const auto& [jointName, jointValue] :
496  rv::zip(jointNames_, debugData.targetState.jointValues))
497  {
498  targetJointValues.emplace(jointName, jointValue);
499  }
500 
501  const Eigen::Isometry3f targetGlobalPose =
502  Eigen::Translation3f{
503  static_cast<float>(debugData.targetState.jointValuesPlatform.at(0)),
504  static_cast<float>(debugData.targetState.jointValuesPlatform.at(1)),
505  0} *
506  Eigen::AngleAxisf{
507  static_cast<float>(debugData.targetState.jointValuesPlatform.at(2)),
508  Eigen::Vector3f::UnitZ()};
509 
510  debugRobot_->setJointValues(targetJointValues);
511  debugRobot_->setGlobalPose(targetGlobalPose.matrix());
512 
513  const Eigen::Isometry3f targetTcpPose(publishTcpNode_->getGlobalPose());
514 
515  const Eigen::Isometry3f tcpDiffTf = debugData.currentTcpPose.inverse() * targetTcpPose;
516 
517  auto batchPrx = debugDrawer->ice_batchOneway();
518 
519  // visu tcp poses
520  {
521 
522  batchPrx->setSphereDebugLayerVisu(
523  "tcp_target",
524  new armarx::Vector3(Eigen::Vector3f{targetTcpPose.translation()}),
525  ::armarx::DrawColor{1, 0, 0, 0},
526  10);
527 
528  batchPrx->setSphereDebugLayerVisu(
529  "tcp_current",
530  new armarx::Vector3(Eigen::Vector3f{debugData.currentTcpPose.translation()}),
531  ::armarx::DrawColor{0, 1, 0, 0},
532  10);
533 
534  batchPrx->setPoseDebugLayerVisu("tcp_target_pose", toIce(targetTcpPose.matrix()));
535  batchPrx->setPoseDebugLayerVisu("tcp_current_pose",
536  toIce(debugData.currentTcpPose.matrix()));
537  }
538 
539  // visu platform poses
540  {
541  batchPrx->setSphereDebugLayerVisu(
542  "platform_target",
543  new armarx::Vector3(Eigen::Vector3f{targetGlobalPose.translation()}),
544  ::armarx::DrawColor{1, 0, 0, 0},
545  10);
546 
547  batchPrx->setSphereDebugLayerVisu("platform_current",
548  new armarx::Vector3(Eigen::Vector3f{
549  debugData.currentPlatformPose.translation()}),
550  ::armarx::DrawColor{0, 1, 0, 0},
551  10);
552 
553  batchPrx->setPoseDebugLayerVisu("platform_target_pose",
554  toIce(targetGlobalPose.matrix()));
555 
556  batchPrx->setPoseDebugLayerVisu("platform_current_pose",
557  toIce(debugData.currentPlatformPose.matrix()));
558  }
559 
560  batchPrx->ice_flushBatchRequests();
561 
562  // TODO if we are interested in the orientation diff, implement it here
563 
564  return tcpDiffTf.translation().norm();
565  }();
566 
567  datafields["tcpDiff"] = new Variant(tcpDiff);
568 
569  debugObservers->setDebugChannel(common::ControllerTypeNames.to_name(
571  datafields);
572 
573  // log data
574  if (whateverFlag_.load())
575  {
576  whatever_.push_back(debugData);
577  }
578  }
579 
580  namespace arondto
581  {
582  void
583  to_json(nlohmann::json& j, const TrajectoryPoint& trajectoryPoint)
584  {
585  j["timestampMicroSeconds"] = trajectoryPoint.timestampMicroSeconds;
586  j["jointValues"] = trajectoryPoint.jointValues;
587  j["jointValuesPlatform"] = trajectoryPoint.jointValuesPlatform;
588  j["handJointValues"] = trajectoryPoint.handJointValues;
589  j["jointVelocities"] = trajectoryPoint.jointVelocities;
590  j["jointVelocitiesPlatform"] = trajectoryPoint.jointVelocitiesPlatform;
591  }
592  } // namespace arondto
593 
594  void
595  to_json(nlohmann::json& j, const DebugData& debugData)
596  {
597  j["localTimestamp"] = debugData.localTimestamp;
598  j["platformPosDiff"] = debugData.platformPosDiff;
599  j["platformOriDiff"] = debugData.platformOriDiff;
600  j["jointPosDiff"] = debugData.jointPosDiff;
601  j["targetState"] = debugData.targetState;
602  j["currentTcpPose"] = Eigen::Matrix4f{debugData.currentTcpPose.matrix()};
603  j["currentPlatformPose"] = Eigen::Matrix4f{debugData.currentPlatformPose.matrix()};
604  j["isControllerActive"] = debugData.isControllerActive;
605  }
606 
607  void
609  {
610  ARMARX_IMPORTANT << "Disconnecting controller " << getClassName() << "...";
611  whateverFlag_.store(false);
612 
613  nlohmann::json j;
614  j["data"] = whatever_;
615 
616  const std::string filename = armarx::Clock::Now().toDateTimeString() + ".json";
617 
618  const armarx::PackagePath packagePath{"grasping_on_the_move",
619  "controller_execution/" + filename};
620 
621  ARMARX_INFO << "Writing debug data to " << packagePath.toSystemPath();
622 
623  std::ofstream ofs(packagePath.toSystemPath());
624  ofs << std::setw(4) << j << std::endl;
625  ofs.close();
626  }
627 } // namespace armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller
armarx::NJointControllerWithTripleBuffer< Target >::reinitTripleBuffer
void reinitTripleBuffer(const Target &initial)
Definition: NJointControllerWithTripleBuffer.h:68
armarx::SensorValueGlobalRobotPose
Definition: GlobalRobotPoseSensorDevice.h:41
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::DebugData::currentPlatformPose
Eigen::Isometry3f currentPlatformPose
Definition: WholeBodyTrajectoryController.h:223
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::Controller::onDisconnectNJointController
virtual void onDisconnectNJointController()
Definition: WholeBodyTrajectoryController.cpp:608
armarx::ControlTargetHolonomicPlatformVelocity
Brief description of class ControlTargetHolonomicPlatformVelocity.
Definition: ControlTargetHolonomicPlatformVelocity.h:38
armarx::ControlTargetBase::asA
const T * asA() const
Definition: ControlTargetBase.h:76
armarx::Variant
The Variant class is described here: Variants.
Definition: Variant.h:224
armarx::TripleBuffer::getWriteBuffer
T & getWriteBuffer()
Definition: TripleBuffer.h:90
armarx::NJointControllerRegistration
Definition: NJointControllerRegistry.h:74
armarx::NJointControllerBase::useSynchronizedRtRobot
const VirtualRobot::RobotPtr & useSynchronizedRtRobot(bool updateCollisionModel=false)
Requests a VirtualRobot for use in rtRun *.
Definition: NJointController.cpp:293
armarx::StringVariantBaseMap
std::map< std::string, VariantBasePtr > StringVariantBaseMap
Definition: ManagedIceObject.h:111
ARMARX_IMPORTANT
#define ARMARX_IMPORTANT
Definition: Logging.h:183
armarx::viz::toEigen
Eigen::Matrix4f toEigen(data::GlobalPose const &pose)
Definition: Interaction.h:46
armarx::SensorValueBase::asA
const T * asA() const
Definition: SensorValueBase.h:82
armarx::SensorValueBase
The SensorValueBase class.
Definition: SensorValueBase.h:40
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::Controller::getClassName
std::string getClassName(const Ice::Current &iceCurrent=Ice::emptyCurrent) const override
Definition: WholeBodyTrajectoryController.cpp:223
armarx::TripleBuffer::commitWrite
void commitWrite()
Definition: TripleBuffer.h:146
armarx::control::njoint_controller::core::ConfigurableNJointControllerBase
Definition: ConfigurableNJointControllerBase.h:33
armarx::GlobalRobotLocalizationSensorDevice::DeviceName
static std::string DeviceName()
Definition: GlobalRobotPoseSensorDevice.cpp:109
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::DebugData::currentTcpPose
Eigen::Isometry3f currentTcpPose
Definition: WholeBodyTrajectoryController.h:222
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
DateTime.h
Pose.h
ARMARX_CHECK_NOT_NULL
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
Definition: ExpressionException.h:206
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::DebugData::isControllerActive
bool isControllerActive
Definition: WholeBodyTrajectoryController.h:225
armarx::MultiDimPIDControllerTemplate::update
void update(const double deltaSec, const PIDVectorX &measuredValue, const PIDVectorX &targetValue)
Definition: MultiDimPIDController.h:75
armarx::MultiDimPIDControllerTemplate::preallocate
void preallocate(size_t size)
Definition: MultiDimPIDController.h:66
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::DebugData::platformPosDiff
float platformPosDiff
Definition: WholeBodyTrajectoryController.h:215
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller
This file is part of ArmarX.
Definition: WholeBodyTrajectoryController.cpp:53
ARMARX_CHECK_NOT_EMPTY
#define ARMARX_CHECK_NOT_EMPTY(c)
Definition: ExpressionException.h:224
ice_conversions.h
armarx::PIDController::getControlValue
double getControlValue() const
Definition: PIDController.cpp:273
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::arondto::to_json
void to_json(nlohmann::json &j, const TrajectoryPoint &trajectoryPoint)
Definition: WholeBodyTrajectoryController.cpp:583
armarx::control::common::ControllerType::WholeBodyTrajectoryController
@ WholeBodyTrajectoryController
armarx::SensorValueGlobalRobotPose::global_T_root
Transformation global_T_root
Definition: GlobalRobotPoseSensorDevice.h:45
type.h
ARMARX_CHECK
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
Definition: ExpressionException.h:82
armarx::PIDController::update
void update(double deltaSec, double measuredValue, double targetValue)
Definition: PIDController.cpp:211
Clock.h
armarx::control::common::ControllerTypeNames
const simox::meta::EnumNames< ControllerType > ControllerTypeNames
Definition: type.h:110
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::Controller::rtRun
void rtRun(const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration) override
TODO make protected and use attorneys.
Definition: WholeBodyTrajectoryController.cpp:230
armarx::detail::ControlThreadOutputBufferEntry
Definition: ControlThreadOutputBuffer.h:177
armarx::toIce
void toIce(std::map< IceKeyT, IceValueT > &iceMap, const boost::container::flat_map< CppKeyT, CppValueT > &cppMap)
Definition: ice_conversions_boost_templates.h:15
ARMARX_TRACE
#define ARMARX_TRACE
Definition: trace.h:69
armarx::abs
std::vector< T > abs(const std::vector< T > &v)
Definition: VectorHelpers.h:253
armarx::NJointControllerBase::isControllerActive
bool isControllerActive(const Ice::Current &=Ice::emptyCurrent) const final override
Definition: NJointControllerBase.h:777
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::Trajectory::TrajectoryPoint
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::arondto::TrajectoryPoint TrajectoryPoint
Definition: WholeBodyTrajectoryController.h:62
armarx::control::njoint_controller::core::ConfigurableNJointControllerBase< arondto::Config >::initialConfigData
const AronConfigT & initialConfigData() const
Definition: ConfigurableNJointControllerBase.h:63
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::Controller::onPublish
void onPublish(const SensorAndControl &, const DebugDrawerInterfacePrx &, const DebugObserverInterfacePrx &) override
Definition: WholeBodyTrajectoryController.cpp:469
ControlModes.h
armarx::NJointControllerWithTripleBuffer< Target >::rtUpdateControlStruct
bool rtUpdateControlStruct()
Definition: NJointControllerWithTripleBuffer.h:38
armarx::Vector3
The Vector3 class.
Definition: Pose.h:112
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::Registration
const NJointControllerRegistration< Controller > Registration(common::ControllerTypeNames.to_name(common::ControllerType::WholeBodyTrajectoryController))
filename
std::string filename
Definition: VisualizationRobot.cpp:83
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::DebugData::jointPosDiff
std::vector< float > jointPosDiff
Definition: WholeBodyTrajectoryController.h:218
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::DebugData
Definition: WholeBodyTrajectoryController.h:211
ControlTarget1DoFActuator.h
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
forward_declarations.h
ExpressionException.h
ControlTargetHolonomicPlatformVelocity.h
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
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
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::to_json
void to_json(nlohmann::json &j, const DebugData &debugData)
Definition: WholeBodyTrajectoryController.cpp:595
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::Controller::Controller
Controller(const RobotUnitPtr &robotUnit, const NJointControllerConfigPtr &config, const VirtualRobot::RobotPtr &robot)
Definition: WholeBodyTrajectoryController.cpp:59
armarx::MultiDimPIDControllerTemplate::getControlValue
const PIDVectorX & getControlValue() const
Definition: MultiDimPIDController.h:186
VAROUT
#define VAROUT(x)
Definition: StringHelpers.h:182
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::DebugData::localTimestamp
std::int64_t localTimestamp
Definition: WholeBodyTrajectoryController.h:213
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::DebugData::platformOriDiff
float platformOriDiff
Definition: WholeBodyTrajectoryController.h:216
IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface >
WholeBodyTrajectoryController.h
armarx::core::time::Clock::Now
static DateTime Now()
Current time on the virtual clock.
Definition: Clock.cpp:97
armarx::SensorValue1DoFActuator
Definition: SensorValue1DoFActuator.h:76
Logging.h
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::DebugData::targetState
arondto::TrajectoryPoint targetState
Definition: WholeBodyTrajectoryController.h:220
armarx::TripleBuffer::getUpToDateReadBuffer
const T & getUpToDateReadBuffer() const
Definition: TripleBuffer.h:108
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:186
armarx::PackagePath
Definition: PackagePath.h:55
armarx::TripleBuffer::reinitAllBuffers
std::enable_if< std::is_copy_constructible< U >::value >::type reinitAllBuffers(const T &init)
Definition: TripleBuffer.h:153
armarx::control::njoint_controller::joint_space::whole_body_trajectory_controller::Controller::rtPreActivateController
void rtPreActivateController() override
This function is called before the controller is activated.
Definition: WholeBodyTrajectoryController.cpp:456
NJointControllerRegistry.h
armarx::core::time::DateTime::toDateTimeString
std::string toDateTimeString() const
Definition: DateTime.cpp:81
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:18
PackagePath.h
norm
double norm(const Point &a)
Definition: point.hpp:94
armarx::rtNow
IceUtil::Time rtNow()
Definition: RtTiming.h:40