CartesianNaturalPositionControllerProxy.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T),
5  * Karlsruhe Institute of Technology (KIT), all rights reserved.
6  *
7  * ArmarX is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  *
11  * ArmarX is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * @author armar-user (armar-user at kit dot edu)
20  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21  * GNU General Public License
22  */
23 
28 //#include <RobotAPI/libraries/aron/core/navigator/Navigator.h>
29 
30 #include <VirtualRobot/math/Helpers.h>
31 #include <VirtualRobot/MathTools.h>
32 
33 using namespace armarx;
34 
35 
36 
37 CartesianNaturalPositionControllerProxy::CartesianNaturalPositionControllerProxy(const NaturalIK& ik, const NaturalIK::ArmJoints& arm, const RobotUnitInterfacePrx& robotUnit, const std::string& controllerName, NJointCartesianNaturalPositionControllerConfigPtr config)
38  : _ik(ik), _robotUnit(robotUnit), _controllerName(controllerName), _config(config), _arm(arm)
39 {
40  _runCfg = _config->runCfg;
41  _velocityBaseSettings.basePosVel = _runCfg.maxTcpPosVel;
42  _velocityBaseSettings.baseOriVel = _runCfg.maxTcpOriVel;
43  _velocityBaseSettings.baseJointVelocity = CalculateMaxJointVelocity(arm.rns, _runCfg.maxTcpPosVel);
44  _userNullspaceTargets = std::vector<float>(arm.rns->getSize(), std::nanf(""));
45  _naturalNullspaceTargets = std::vector<float>(arm.rns->getSize(), std::nanf(""));
46  updateBaseKpValues(_runCfg);
47  VirtualRobot::RobotNodeSetPtr rns = arm.rns;
48  for (size_t i = 0; i < rns->getSize(); i++)
49  {
50  VirtualRobot::RobotNodePtr rn = rns->getNode(i);
51  if (rn == arm.elbow)
52  {
53  break;
54  }
55  _rnsToElb.emplace_back(rn);
56  }
57 
58  {
59  WaypointConfig wpc;
60  wpc.referencePosVel = 80;
61  wpc.thresholdTcpPosReached = 5;
62  _defaultWaypointConfigs["default"] = wpc;
63  }
64  _ftOffset.force = Eigen::Vector3f::Zero();
65  _ftOffset.torque = Eigen::Vector3f::Zero();
66 }
67 
68 NJointCartesianNaturalPositionControllerConfigPtr CartesianNaturalPositionControllerProxy::MakeConfig(const std::string& rns, const std::string& elbowNode)
69 {
70  NJointCartesianNaturalPositionControllerConfigPtr cfg = new NJointCartesianNaturalPositionControllerConfig();
71  cfg->rns = rns;
72  cfg->elbowNode = elbowNode;
73  return cfg;
74 }
75 
77 {
78  NJointControllerInterfacePrx ctrl = _robotUnit->getNJointController(_controllerName);
79  if (ctrl)
80  {
81  _controllerCreated = false;
82  _controller = NJointCartesianNaturalPositionControllerInterfacePrx::checkedCast(ctrl);
83  _controller->setConfig(_runCfg);
84  }
85  else
86  {
87  ctrl = _robotUnit->createNJointController("NJointCartesianNaturalPositionController", _controllerName, _config);
88  _controller = NJointCartesianNaturalPositionControllerInterfacePrx::checkedCast(ctrl);
89  _controllerCreated = true;
90  }
91  if (_activateControllerOnInit)
92  {
93  _controller->activateController();
94  }
95 }
96 
97 bool CartesianNaturalPositionControllerProxy::setTarget(const Eigen::Matrix4f& tcpTarget, NaturalDiffIK::Mode setOri, std::optional<float> minElbowHeight)
98 {
99  ScopedJointValueRestore jvr(_arm.rns);
100  _tcpTarget = tcpTarget;
101  _setOri = setOri;
102  _fwd = _ik.solveSoechtingIK(math::Helpers::Position(tcpTarget), minElbowHeight);
103  //VirtualRobot::IKSolver::CartesianSelection mode = setOri ? VirtualRobot::IKSolver::All : VirtualRobot::IKSolver::Position;
104  NaturalDiffIK::Result ikResult = NaturalDiffIK::CalculateDiffIK(tcpTarget, _fwd.elbow, _arm.rns, _arm.tcp, _arm.elbow, setOri, _natikParams.diffIKparams);
105  if (!ikResult.reached)
106  {
107  ARMARX_ERROR << "could not solve natural IK for target: " << tcpTarget;
108  return false;
109  }
110  _elbTarget = _arm.elbow->getPoseInRootFrame();
111  _controller->setTarget(_tcpTarget, _arm.elbow->getPositionInRootFrame(), setOri == NaturalDiffIK::Mode::All);
112  if (_setJointNullspaceFromNaturalIK)
113  {
114  for (size_t i = 0; i < _rnsToElb.size(); i++)
115  {
116  _naturalNullspaceTargets.at(i) = ikResult.jointValues(i);
117  }
118  }
119  updateNullspaceTargets();
120  updateDynamicKp();
121  return true;
122 }
123 
124 void CartesianNaturalPositionControllerProxy::setNullspaceTarget(const std::vector<float>& nullspaceTargets)
125 {
126  ARMARX_CHECK(_arm.rns->getSize() == nullspaceTargets.size());
127  _userNullspaceTargets = nullspaceTargets;
128  updateNullspaceTargets();
129 }
130 
132 {
133  return math::Helpers::Position(_tcpTarget);
134 }
135 
137 {
138  return math::Helpers::Position(_elbTarget);
139 }
140 
142 {
143  return CartesianPositionController::GetPositionError(_tcpTarget, _arm.tcp);
144 }
145 
147 {
148  if (_setOri == NaturalDiffIK::Mode::Position)
149  {
150  return 0;
151  }
152  return CartesianPositionController::GetOrientationError(_tcpTarget, _arm.tcp);
153 }
154 
156 {
157  return CartesianPositionController::GetPositionError(_elbTarget, _arm.elbow);
158 }
159 
161 {
162  return isLastWaypoint() && currentWaypoint().reached(_arm.tcp);
163 }
164 
166 {
167  _ftOffset = _controller->getAverageFTValue();
168  _controller->setFTOffset(_ftOffset);
169 }
170 
171 void CartesianNaturalPositionControllerProxy::enableFTLimit(float force, float torque, bool useCurrentFTasOffset)
172 {
174  {
175  this->useCurrentFTasOffset();
176  }
177  _controller->setFTLimit(force, torque);
178 }
179 
181 {
182  _controller->clearFTLimit();
183  //_controller->resetFTOffset();
184 }
185 
187 {
188  FTSensorValue ft = _controller->getCurrentFTValue();
189  if (substactOffset)
190  {
191  ft.force = ft.force - _ftOffset.force;
192  ft.torque = ft.torque - _ftOffset.torque;
193  }
194  return ft;
195 }
197 {
198  FTSensorValue ft = _controller->getAverageFTValue();
199  if (substactOffset)
200  {
201  ft.force = ft.force - _ftOffset.force;
202  ft.torque = ft.torque - _ftOffset.torque;
203  }
204  return ft;
205 }
206 
208 {
209  _controller->stopMovement();
210  _controller->clearFTLimit();
211  _controller->setNullspaceControlEnabled(true);
212  clearWaypoints();
213 }
214 
215 
216 
217 void CartesianNaturalPositionControllerProxy::updateDynamicKp()
218 {
219  if (_dynamicKp.enabled)
220  {
221  float error = (math::Helpers::Position(_tcpTarget) - _fwd.wrist).norm();
222  float KpElb, KpJla;
223  ARMARX_IMPORTANT << VAROUT(error);
224  _dynamicKp.calculate(error, KpElb, KpJla);
225  //ARMARX_IMPORTANT << VAROUT()
226  _runCfg.elbowKp = KpElb;
227  _runCfg.jointLimitAvoidanceKp = KpJla;
228  _controller->setConfig(_runCfg);
229  ARMARX_IMPORTANT << VAROUT(_runCfg.elbowKp) << VAROUT(_runCfg.jointLimitAvoidanceKp);
230 
231  }
232 }
233 
234 void CartesianNaturalPositionControllerProxy::updateNullspaceTargets()
235 {
236  std::vector<float> nsTargets = _userNullspaceTargets;
237  for (size_t i = 0; i < _naturalNullspaceTargets.size(); i++)
238  {
239  if (std::isnan(nsTargets.at(i)))
240  {
241  nsTargets.at(i) = _naturalNullspaceTargets.at(i);
242  }
243  }
244  _controller->setNullspaceTarget(nsTargets);
245 }
246 
247 void CartesianNaturalPositionControllerProxy::DynamicKp::calculate(float error, float& KpElb, float& KpJla)
248 {
249  float f = std::exp(-0.5f * (error * error) / (sigmaMM * sigmaMM));
250  KpElb = f * maxKp;
251  KpJla = (1 - f) * maxKp;
252 }
253 
254 void CartesianNaturalPositionControllerProxy::setRuntimeConfig(CartesianNaturalPositionControllerConfig runCfg)
255 {
256  _controller->setConfig(runCfg);
257  this->_runCfg = runCfg;
258 }
259 
260 CartesianNaturalPositionControllerConfig CartesianNaturalPositionControllerProxy::getRuntimeConfig()
261 {
262  return _runCfg;
263 }
264 
266 {
267  if (_waypoints.size() == 0)
268  {
269  _waypointChanged = true;
270  }
271  _waypoints.emplace_back(waypoint);
272 }
273 
274 CartesianNaturalPositionControllerProxy::Waypoint CartesianNaturalPositionControllerProxy::createWaypoint(const Eigen::Vector3f& tcpTarget, const std::vector<float>& userNullspaceTargets, std::optional<float> minElbowHeight)
275 {
276  return createWaypoint(tcpTarget, minElbowHeight).setNullspaceTargets(userNullspaceTargets);
277 }
278 
279 CartesianNaturalPositionControllerProxy::Waypoint CartesianNaturalPositionControllerProxy::createWaypoint(const Eigen::Vector3f& tcpTarget, std::optional<float> minElbowHeight)
280 {
281  Waypoint w;
282  w.config = _defaultWaypointConfigs["default"];
283  w.targets.tcpTarget = math::Helpers::CreatePose(tcpTarget, Eigen::Matrix3f::Identity());
285  w.targets.minElbowHeight = minElbowHeight;
286  w.targets.userNullspaceTargets = std::vector<float>(_arm.rns->getSize(), std::nanf(""));
287  return w;
288 }
289 
291 {
292  Waypoint w;
293  w.config = _defaultWaypointConfigs["default"];
294  w.targets.tcpTarget = tcpTarget;
296  w.targets.minElbowHeight = minElbowHeight;
297  w.targets.userNullspaceTargets = std::vector<float>(_arm.rns->getSize(), std::nanf(""));
298  return w;
299 }
300 
302 {
303  _waypoints.clear();
304  _currentWaypointIndex = 0;
305 }
306 
308 {
309  _defaultWaypointConfigs["default"] = config;
310 }
311 
313 {
314  std::stringstream ss;
315  ss.precision(2);
316  ss << std::fixed << "Waypoint: " << (_currentWaypointIndex + 1) << "/" << _waypoints.size() << " distance: " << getTcpPositionError() << " mm " << VirtualRobot::MathTools::rad2deg(getTcpOrientationError()) << " deg";
317  return ss.str();
318 }
319 
320 std::vector<float> CartesianNaturalPositionControllerProxy::CalculateMaxJointVelocity(const VirtualRobot::RobotNodeSetPtr& rns, float maxPosVel)
321 {
322  size_t len = rns->getSize();
323  std::vector<Eigen::Vector3f> positions;
324  for (size_t i = 0; i < len; i++)
325  {
326  positions.push_back(rns->getNode(i)->getPositionInRootFrame());
327  }
328  positions.push_back(rns->getTCP()->getPositionInRootFrame());
329 
330  std::vector<float> dists;
331  for (size_t i = 0; i < len; i++)
332  {
333  dists.push_back((positions.at(i) - positions.at(i + 1)).norm());
334  }
335 
336  std::vector<float> result(len, 0);
337  float dist = 0;
338  for (int i = len - 1; i >= 0; i--)
339  {
340  dist += dists.at(i);
341  result.at(i) = maxPosVel / dist;
342  }
343  return result;
344 }
345 
346 std::vector<float> CartesianNaturalPositionControllerProxy::ScaleVec(const std::vector<float>& vec, float scale)
347 {
348  std::vector<float> result(vec.size(), 0);
349  for (size_t i = 0; i < vec.size(); i++)
350  {
351  result.at(i) = vec.at(i) * scale;
352  }
353  return result;
354 }
355 
357 {
358  _activateControllerOnInit = value;
359 }
360 
362 {
363  VelocityBaseSettings& v = _velocityBaseSettings;
364  KpBaseSettings& k = _kpBaseSettings;
365  float scale = referencePosVel / v.basePosVel;
366  _runCfg.maxTcpPosVel = v.basePosVel * v.scaleTcpPosVel * scale;
367  _runCfg.maxTcpOriVel = v.baseOriVel * v.scaleTcpOriVel * scale;
368  _runCfg.maxElbPosVel = v.basePosVel * v.scaleElbPosVel * scale;
369  _runCfg.maxJointVelocity = ScaleVec(v.baseJointVelocity, v.scaleJointVelocities * scale);
370  _runCfg.maxNullspaceVelocity = ScaleVec(v.baseJointVelocity, v.scaleNullspaceVelocities * scale);
371  _runCfg.KpPos = k.baseKpTcpPos; // * scale;
372  _runCfg.KpOri = k.baseKpTcpOri; // * scale;
373  _runCfg.elbowKp = k.baseKpElbPos; // * scale;
374  _runCfg.jointLimitAvoidanceKp = k.baseKpJla; // * scale;
375  _runCfg.nullspaceTargetKp = k.baseKpNs; // * scale;
376  _runCfg.maxNullspaceAcceleration = k.maxNullspaceAcceleration; // * scale;
377  _runCfg.maxPositionAcceleration = k.maxPositionAcceleration; // * scale;
378  _runCfg.maxOrientationAcceleration = k.maxOrientationAcceleration; // * scale;
379 
380  _controller->setConfig(_runCfg);
381 }
382 
383 void CartesianNaturalPositionControllerProxy::updateBaseKpValues(const CartesianNaturalPositionControllerConfig& runCfg)
384 {
385  _kpBaseSettings.baseKpTcpPos = _runCfg.KpPos;
386  _kpBaseSettings.baseKpTcpOri = _runCfg.KpOri;
387  _kpBaseSettings.baseKpElbPos = _runCfg.elbowKp;
388  _kpBaseSettings.baseKpJla = _runCfg.jointLimitAvoidanceKp;
389  _kpBaseSettings.baseKpNs = _runCfg.nullspaceTargetKp;
390  _kpBaseSettings.maxNullspaceAcceleration = _runCfg.maxNullspaceAcceleration;
391  _kpBaseSettings.maxPositionAcceleration = _runCfg.maxPositionAcceleration;
392  _kpBaseSettings.maxOrientationAcceleration = _runCfg.maxOrientationAcceleration;
393 }
394 
396 {
397  if (_controllerCreated)
398  {
399  // delete controller only if it was created
400  _controller->deactivateAndDeleteController();
401  }
402  else
403  {
404  // if the controller existed, only deactivate it
405  _controller->deactivateController();
406  }
407  _controllerCreated = false;
408 }
409 
411 {
412  if (_waypoints.size() == 0)
413  {
414  return true;
415  }
416 
417  Waypoint& w = currentWaypoint();
418  if (!isLastWaypoint() && w.reached(_arm.tcp))
419  {
420  _currentWaypointIndex++;
421  _waypointChanged = true;
422  }
423  if (_waypointChanged)
424  {
425  _waypointChanged = false;
426  ARMARX_IMPORTANT << "Waypoint changed. Setting new target: ";
427  return onWaypointChanged();
428  }
429  return true;
430 
431 }
432 bool CartesianNaturalPositionControllerProxy::onWaypointChanged()
433 {
434  Waypoint& w = currentWaypoint();
435  setMaxVelocities(w.config.referencePosVel);
436  _userNullspaceTargets = w.targets.userNullspaceTargets;
437  ARMARX_IMPORTANT << "Waypoint target position: " << math::Helpers::GetPosition(w.targets.tcpTarget).transpose();
438  return setTarget(w.targets.tcpTarget, w.targets.setOri, w.targets.minElbowHeight);
439 }
440 
442 {
443  ARMARX_CHECK(_waypoints.size() > 0);
444  return _waypoints.at(_currentWaypointIndex);
445 }
446 
448 {
449  return _waypoints.size() == 0 || _currentWaypointIndex == _waypoints.size() - 1;
450 }
451 
452 NJointCartesianNaturalPositionControllerInterfacePrx CartesianNaturalPositionControllerProxy::getInternalController()
453 {
454  return _controller;
455 }
456 
458 {
459  _dynamicKp = dynamicKp;
460  updateDynamicKp();
461 }
462 
464 {
465  return _dynamicKp;
466 }
467 
468 
469 bool CartesianNaturalPositionControllerProxy::Waypoint::reached(const VirtualRobot::RobotNodePtr& tcp)
470 {
471  return CartesianPositionController::Reached(targets.tcpTarget, tcp, targets.setOri == NaturalDiffIK::Mode::All, config.thresholdTcpPosReached, config.thresholdTcpPosReached / config.rad2mmFactor);
472 }
473 
475 {
476  this->config = config;
477  return *this;
478 }
479 
481 {
482  ARMARX_CHECK(this->targets.userNullspaceTargets.size() == userNullspaceTargets.size());
483  this->targets.userNullspaceTargets = userNullspaceTargets;
484  return *this;
485 }
486 
487 /*
488 aron::AronObjectPtr CartesianNaturalPositionControllerProxy::Waypoint::toAron()
489 {
490  aron::AronObjectPtr obj = new aron::AronObject();
491  aron::Navigator nav(obj);
492  nav.appendMatrix4f("tcpTarget", tcpTarget);
493  nav.appendVector3f("elbTarget", elbTarget);
494  nav.appendVec("userNullspaceTargets", userNullspaceTargets);
495  nav.appendVec("naturalNullspaceTargets", naturalNullspaceTargets);
496  nav.appendBool("setOri", setOri == NaturalDiffIK::Mode::All);
497  nav.appendFloat("referencePosVel", referencePosVel);
498  nav.appendFloat("thresholdTcpPosReached", thresholdTcpPosReached);
499  nav.appendFloat("thresholdTcpOriReached", thresholdTcpOriReached);
500  nav.appendBool("resetFTonEnter", resetFTonEnter);
501  nav.appendBool("resetFTonExit", resetFTonExit);
502  nav.appendFloat("forceTheshold", forceTheshold);
503  return obj;
504 }
505 
506 void CartesianNaturalPositionControllerProxy::Waypoint::fromAron(aron::AronObjectPtr aron)
507 {
508  aron::Navigator nav(aron);
509  tcpTarget = nav.atKey("tcpTarget").asMatrix4f();
510  elbTarget = nav.atKey("elbTarget").asVector3f();
511  userNullspaceTargets = nav.atKey("userNullspaceTargets").asVecFloat();
512  naturalNullspaceTargets = nav.atKey("naturalNullspaceTargets").asVecFloat();
513  setOri = nav.atKey("setOri").asBool() ? NaturalDiffIK::Mode::All : NaturalDiffIK::Mode::Position;
514  referencePosVel = nav.atKey("referencePosVel").asFloat();
515  thresholdTcpPosReached = nav.atKey("thresholdTcpPosReached").asFloat();
516  thresholdTcpOriReached = nav.atKey("thresholdTcpOriReached").asFloat();
517  resetFTonEnter = nav.atKey("resetFTonEnter").asBool();
518  resetFTonExit = nav.atKey("resetFTonExit").asBool();
519  forceTheshold = nav.atKey("forceTheshold").asFloat();
520 
521 }*/
522 
524  : jointValues(rns->getJointValues()), rns(rns)
525 {
526 }
527 
529 {
530  //ARMARX_IMPORTANT << "restoring joint values";
531  rns->setJointValues(jointValues);
532 }
533 
534 
armarx::CartesianNaturalPositionControllerProxy::KpBaseSettings::baseKpNs
float baseKpNs
Definition: CartesianNaturalPositionControllerProxy.h:55
armarx::CartesianNaturalPositionControllerProxy::setTarget
bool setTarget(const Eigen::Matrix4f &tcpTarget, NaturalDiffIK::Mode setOri, std::optional< float > minElbowHeight=std::nullopt)
Definition: CartesianNaturalPositionControllerProxy.cpp:97
armarx::CartesianNaturalPositionControllerProxy::cleanup
void cleanup()
Definition: CartesianNaturalPositionControllerProxy.cpp:395
armarx::CartesianNaturalPositionControllerProxy::KpBaseSettings::maxPositionAcceleration
float maxPositionAcceleration
Definition: CartesianNaturalPositionControllerProxy.h:56
armarx::NaturalDiffIK::Mode::All
@ All
armarx::CartesianNaturalPositionControllerProxy::getRuntimeConfig
CartesianNaturalPositionControllerConfig getRuntimeConfig()
Definition: CartesianNaturalPositionControllerProxy.cpp:260
CartesianNaturalPositionControllerProxy.h
ARMARX_IMPORTANT
#define ARMARX_IMPORTANT
Definition: Logging.h:183
armarx::CartesianNaturalPositionControllerProxy::WaypointTargets::setOri
NaturalDiffIK::Mode setOri
Definition: CartesianNaturalPositionControllerProxy.h:84
armarx::CartesianNaturalPositionControllerProxy::enableFTLimit
void enableFTLimit(float force, float torque, bool useCurrentFTasOffset)
Definition: CartesianNaturalPositionControllerProxy.cpp:171
armarx::CartesianNaturalPositionControllerProxy::WaypointConfig
Definition: CartesianNaturalPositionControllerProxy.h:74
armarx::CartesianNaturalPositionControllerProxy::WaypointTargets::minElbowHeight
std::optional< float > minElbowHeight
Definition: CartesianNaturalPositionControllerProxy.h:85
armarx::NaturalDiffIK::Mode::Position
@ Position
armarx::NaturalIK::ArmJoints::tcp
VirtualRobot::RobotNodePtr tcp
Definition: NaturalIK.h:64
armarx::NaturalIK::SoechtingForwardPositions::wrist
Eigen::Vector3f wrist
Definition: NaturalIK.h:93
armarx::CartesianNaturalPositionControllerProxy::isFinalWaypointReached
bool isFinalWaypointReached()
Definition: CartesianNaturalPositionControllerProxy.cpp:160
armarx::CartesianNaturalPositionControllerProxy::getInternalController
NJointCartesianNaturalPositionControllerInterfacePrx getInternalController()
Definition: CartesianNaturalPositionControllerProxy.cpp:452
armarx::CartesianNaturalPositionControllerProxy::ScopedJointValueRestore::~ScopedJointValueRestore
~ScopedJointValueRestore()
Definition: CartesianNaturalPositionControllerProxy.cpp:528
armarx::CartesianNaturalPositionControllerProxy::VelocityBaseSettings::basePosVel
float basePosVel
Definition: CartesianNaturalPositionControllerProxy.h:70
armarx::NaturalDiffIK::Mode
Mode
Definition: NaturalDiffIK.h:36
armarx::NaturalIK::ArmJoints::elbow
VirtualRobot::RobotNodePtr elbow
Definition: NaturalIK.h:62
armarx::NaturalDiffIK::Result::reached
bool reached
Definition: NaturalDiffIK.h:78
armarx::CartesianNaturalPositionControllerProxy::DynamicKp::sigmaMM
float sigmaMM
Definition: CartesianNaturalPositionControllerProxy.h:45
armarx::CartesianNaturalPositionControllerProxy::VelocityBaseSettings::baseJointVelocity
Ice::FloatSeq baseJointVelocity
Definition: CartesianNaturalPositionControllerProxy.h:69
armarx::CartesianNaturalPositionControllerProxy::DynamicKp::calculate
void calculate(float error, float &KpElb, float &KpJla)
Definition: CartesianNaturalPositionControllerProxy.cpp:247
armarx::CartesianNaturalPositionControllerProxy::getCurrentElbowTargetPosition
Eigen::Vector3f getCurrentElbowTargetPosition()
Definition: CartesianNaturalPositionControllerProxy.cpp:136
armarx::CartesianNaturalPositionControllerProxy::clearWaypoints
void clearWaypoints()
Definition: CartesianNaturalPositionControllerProxy.cpp:301
armarx::CartesianPositionController::GetOrientationError
static float GetOrientationError(const Eigen::Matrix4f &targetPose, const VirtualRobot::RobotNodePtr &tcp, const VirtualRobot::RobotNodePtr &referenceFrame=nullptr)
Definition: CartesianPositionController.cpp:114
armarx::CartesianNaturalPositionControllerProxy::KpBaseSettings
Definition: CartesianNaturalPositionControllerProxy.h:49
armarx::NaturalIK::ArmJoints
Definition: NaturalIK.h:59
armarx::CartesianNaturalPositionControllerProxy::currentWaypoint
Waypoint & currentWaypoint()
Definition: CartesianNaturalPositionControllerProxy.cpp:441
armarx::CartesianNaturalPositionControllerProxy::DynamicKp
Definition: CartesianNaturalPositionControllerProxy.h:41
armarx::CartesianNaturalPositionControllerProxy::getCurrentTargetPosition
Eigen::Vector3f getCurrentTargetPosition()
Definition: CartesianNaturalPositionControllerProxy.cpp:131
ARMARX_CHECK
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
Definition: ExpressionException.h:82
armarx::CartesianNaturalPositionControllerProxy::VelocityBaseSettings::baseOriVel
float baseOriVel
Definition: CartesianNaturalPositionControllerProxy.h:71
armarx::CartesianNaturalPositionControllerProxy::Waypoint::reached
bool reached(const VirtualRobot::RobotNodePtr &tcp)
Definition: CartesianNaturalPositionControllerProxy.cpp:469
armarx::CartesianNaturalPositionControllerProxy::DynamicKp::maxKp
float maxKp
Definition: CartesianNaturalPositionControllerProxy.h:44
armarx::NaturalIK
The NaturalIK class.
Definition: NaturalIK.h:49
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:523
armarx::CartesianNaturalPositionControllerProxy::setMaxVelocities
void setMaxVelocities(float referencePosVel)
Definition: CartesianNaturalPositionControllerProxy.cpp:361
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
armarx::CartesianNaturalPositionControllerProxy::addWaypoint
void addWaypoint(const Waypoint &waypoint)
Definition: CartesianNaturalPositionControllerProxy.cpp:265
armarx::NaturalIK::Parameters::diffIKparams
NaturalDiffIK::Parameters diffIKparams
Definition: NaturalIK.h:55
armarx::CartesianNaturalPositionControllerProxy::Waypoint::setConfig
Waypoint & setConfig(const WaypointConfig &config)
Definition: CartesianNaturalPositionControllerProxy.cpp:474
armarx::CartesianPositionController::GetPositionError
static float GetPositionError(const Eigen::Matrix4f &targetPose, const VirtualRobot::RobotNodePtr &tcp, const VirtualRobot::RobotNodePtr &referenceFrame=nullptr)
Definition: CartesianPositionController.cpp:103
armarx::CartesianNaturalPositionControllerProxy::WaypointConfig::referencePosVel
float referencePosVel
Definition: CartesianNaturalPositionControllerProxy.h:76
armarx::CartesianNaturalPositionControllerProxy::updateBaseKpValues
void updateBaseKpValues(const CartesianNaturalPositionControllerConfig &runCfg)
Definition: CartesianNaturalPositionControllerProxy.cpp:383
armarx::NaturalDiffIK::Result::jointValues
Eigen::VectorXf jointValues
Definition: NaturalDiffIK.h:71
armarx::CartesianNaturalPositionControllerProxy::getStatusText
std::string getStatusText()
Definition: CartesianNaturalPositionControllerProxy.cpp:312
armarx::CartesianNaturalPositionControllerProxy::VelocityBaseSettings
Definition: CartesianNaturalPositionControllerProxy.h:61
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
armarx::CartesianNaturalPositionControllerProxy::WaypointTargets::userNullspaceTargets
std::vector< float > userNullspaceTargets
Definition: CartesianNaturalPositionControllerProxy.h:86
armarx::CartesianNaturalPositionControllerProxy::disableFTLimit
void disableFTLimit()
Definition: CartesianNaturalPositionControllerProxy.cpp:180
armarx::CartesianNaturalPositionControllerProxy::getCurrentFTValue
FTSensorValue getCurrentFTValue(bool substactOffset)
Definition: CartesianNaturalPositionControllerProxy.cpp:186
armarx::CartesianNaturalPositionControllerProxy::update
bool update()
Definition: CartesianNaturalPositionControllerProxy.cpp:410
armarx::NaturalIK::ArmJoints::rns
VirtualRobot::RobotNodeSetPtr rns
Definition: NaturalIK.h:61
armarx::CartesianNaturalPositionControllerProxy::Waypoint::setNullspaceTargets
Waypoint & setNullspaceTargets(const std::vector< float > &userNullspaceTargets)
Definition: CartesianNaturalPositionControllerProxy.cpp:480
armarx::CartesianNaturalPositionControllerProxy::getDynamicKp
DynamicKp getDynamicKp()
Definition: CartesianNaturalPositionControllerProxy.cpp:463
armarx::CartesianNaturalPositionControllerProxy::KpBaseSettings::baseKpElbPos
float baseKpElbPos
Definition: CartesianNaturalPositionControllerProxy.h:53
CartesianPositionController.h
armarx::CartesianNaturalPositionControllerProxy::KpBaseSettings::baseKpTcpPos
float baseKpTcpPos
Definition: CartesianNaturalPositionControllerProxy.h:51
armarx::CartesianNaturalPositionControllerProxy::createWaypoint
Waypoint createWaypoint(const Eigen::Vector3f &tcpTarget, const std::vector< float > &userNullspaceTargets, std::optional< float > minElbowHeight=std::nullopt)
Definition: CartesianNaturalPositionControllerProxy.cpp:274
armarx::CartesianNaturalPositionControllerProxy::ScaleVec
static std::vector< float > ScaleVec(const std::vector< float > &vec, float scale)
Definition: CartesianNaturalPositionControllerProxy.cpp:346
armarx::CartesianNaturalPositionControllerProxy::DynamicKp::enabled
bool enabled
Definition: CartesianNaturalPositionControllerProxy.h:43
armarx::NaturalIK::SoechtingForwardPositions::elbow
Eigen::Vector3f elbow
Definition: NaturalIK.h:92
ExpressionException.h
armarx::CartesianNaturalPositionControllerProxy::getElbPositionError
float getElbPositionError()
Definition: CartesianNaturalPositionControllerProxy.cpp:155
armarx::CartesianNaturalPositionControllerProxy::setNullspaceTarget
void setNullspaceTarget(const std::vector< float > &nullspaceTargets)
Definition: CartesianNaturalPositionControllerProxy.cpp:124
armarx::CartesianNaturalPositionControllerProxy::MakeConfig
static NJointCartesianNaturalPositionControllerConfigPtr MakeConfig(const std::string &rns, const std::string &elbowNode)
Definition: CartesianNaturalPositionControllerProxy.cpp:68
armarx::ctrlutil::v
double v(double t, double v0, double a0, double j)
Definition: CtrlUtil.h:39
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
armarx::CartesianNaturalPositionControllerProxy::getTcpOrientationError
float getTcpOrientationError()
Definition: CartesianNaturalPositionControllerProxy.cpp:146
armarx::CartesianNaturalPositionControllerProxy::Waypoint::targets
WaypointTargets targets
Definition: CartesianNaturalPositionControllerProxy.h:93
armarx::CartesianNaturalPositionControllerProxy::WaypointConfig::thresholdTcpPosReached
float thresholdTcpPosReached
Definition: CartesianNaturalPositionControllerProxy.h:77
armarx::CartesianNaturalPositionControllerProxy::useCurrentFTasOffset
void useCurrentFTasOffset()
Definition: CartesianNaturalPositionControllerProxy.cpp:165
VAROUT
#define VAROUT(x)
Definition: StringHelpers.h:182
armarx::CartesianNaturalPositionControllerProxy::KpBaseSettings::maxNullspaceAcceleration
float maxNullspaceAcceleration
Definition: CartesianNaturalPositionControllerProxy.h:58
armarx::CartesianNaturalPositionControllerProxy::stopClear
void stopClear()
Definition: CartesianNaturalPositionControllerProxy.cpp:207
armarx::CartesianNaturalPositionControllerProxy::Waypoint::config
WaypointConfig config
Definition: CartesianNaturalPositionControllerProxy.h:94
armarx::CartesianNaturalPositionControllerProxy::init
void init()
Definition: CartesianNaturalPositionControllerProxy.cpp:76
IceInternal::ProxyHandle<::IceProxy::armarx::RobotUnitInterface >
armarx::CartesianNaturalPositionControllerProxy::Waypoint
Definition: CartesianNaturalPositionControllerProxy.h:90
armarx::CartesianNaturalPositionControllerProxy::setDynamicKp
void setDynamicKp(DynamicKp dynamicKp)
Definition: CartesianNaturalPositionControllerProxy.cpp:457
armarx::NaturalDiffIK::CalculateDiffIK
static Result CalculateDiffIK(const Eigen::Matrix4f &targetPose, const Eigen::Vector3f &elbowTarget, VirtualRobot::RobotNodeSetPtr rns, VirtualRobot::RobotNodePtr tcp, VirtualRobot::RobotNodePtr elbow, Mode setOri, Parameters params=Parameters())
Definition: NaturalDiffIK.cpp:44
armarx::CartesianNaturalPositionControllerProxy::setRuntimeConfig
void setRuntimeConfig(CartesianNaturalPositionControllerConfig runCfg)
Definition: CartesianNaturalPositionControllerProxy.cpp:254
armarx::CartesianPositionController::Reached
static bool Reached(const Eigen::Matrix4f &targetPose, const VirtualRobot::RobotNodePtr &tcp, bool checkOri, float thresholdPosReached, float thresholdOriReached, const VirtualRobot::RobotNodePtr &referenceFrame=nullptr)
Definition: CartesianPositionController.cpp:127
armarx::NaturalDiffIK::Result
Definition: NaturalDiffIK.h:69
armarx::CartesianNaturalPositionControllerProxy::setDefaultWaypointConfig
void setDefaultWaypointConfig(const WaypointConfig &config)
Definition: CartesianNaturalPositionControllerProxy.cpp:307
armarx::CartesianNaturalPositionControllerProxy::isLastWaypoint
bool isLastWaypoint()
Definition: CartesianNaturalPositionControllerProxy.cpp:447
Logging.h
armarx::navigation::core::Position
Eigen::Vector3f Position
Definition: basic_types.h:36
armarx::CartesianNaturalPositionControllerProxy::getTcpPositionError
float getTcpPositionError()
Definition: CartesianNaturalPositionControllerProxy.cpp:141
armarx::CartesianNaturalPositionControllerProxy::WaypointTargets::tcpTarget
Eigen::Matrix4f tcpTarget
Definition: CartesianNaturalPositionControllerProxy.h:83
armarx::CartesianNaturalPositionControllerProxy::getAverageFTValue
FTSensorValue getAverageFTValue(bool substactOffset)
Definition: CartesianNaturalPositionControllerProxy.cpp:196
armarx::CartesianNaturalPositionControllerProxy::KpBaseSettings::baseKpTcpOri
float baseKpTcpOri
Definition: CartesianNaturalPositionControllerProxy.h:52
armarx::CartesianNaturalPositionControllerProxy::CalculateMaxJointVelocity
static std::vector< float > CalculateMaxJointVelocity(const VirtualRobot::RobotNodeSetPtr &rns, float maxPosVel)
Definition: CartesianNaturalPositionControllerProxy.cpp:320
armarx::CartesianNaturalPositionControllerProxy::ScopedJointValueRestore
Definition: CartesianNaturalPositionControllerProxy.h:107
armarx::CartesianNaturalPositionControllerProxy::CartesianNaturalPositionControllerProxy
CartesianNaturalPositionControllerProxy(const NaturalIK &_ik, const NaturalIK::ArmJoints &arm, const RobotUnitInterfacePrx &_robotUnit, const std::string &_controllerName, NJointCartesianNaturalPositionControllerConfigPtr _config)
Definition: CartesianNaturalPositionControllerProxy.cpp:37
armarx::NaturalIK::solveSoechtingIK
NaturalIK::SoechtingForwardPositions solveSoechtingIK(const Eigen::Vector3f &targetPos, std::optional< float > minElbowHeight=std::nullopt)
Definition: NaturalIK.cpp:39
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::CartesianNaturalPositionControllerProxy::KpBaseSettings::baseKpJla
float baseKpJla
Definition: CartesianNaturalPositionControllerProxy.h:54
armarx::CartesianNaturalPositionControllerProxy::KpBaseSettings::maxOrientationAcceleration
float maxOrientationAcceleration
Definition: CartesianNaturalPositionControllerProxy.h:57
armarx::CartesianNaturalPositionControllerProxy::setActivateControllerOnInit
void setActivateControllerOnInit(bool value)
Definition: CartesianNaturalPositionControllerProxy.cpp:356
armarx::CartesianNaturalPositionControllerProxy::ScopedJointValueRestore::ScopedJointValueRestore
ScopedJointValueRestore(const VirtualRobot::RobotNodeSetPtr &rns)
Definition: CartesianNaturalPositionControllerProxy.cpp:523
norm
double norm(const Point &a)
Definition: point.hpp:94