ObstacleAwarePlatformUnit.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 RobotAPI::ArmarXObjects::ObstacleAwarePlatformUnit
17  * @author Christian R. G. Dreher <c.dreher@kit.edu>
18  * @date 2021
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 
25 
26 
27 // STD/STL
28 #include <algorithm>
29 #include <cmath>
30 #include <limits>
31 #include <numeric>
32 
33 // Eigen
34 #include <Eigen/Core>
35 #include <Eigen/Geometry>
36 
37 // Simox
38 #include <SimoxUtility/math.h>
39 
40 // ArmarX
42 
43 
44 namespace
45 {
46 
47  void
48  invalidate(float& v)
49  {
50  v = std::numeric_limits<float>::infinity();
51  }
52 
53 
54  void
55  invalidate(Eigen::Vector2f& v)
56  {
57  v.x() = std::numeric_limits<float>::infinity();
58  v.y() = std::numeric_limits<float>::infinity();
59  }
60 
61 
62  void
63  invalidate(Eigen::Vector3f& v)
64  {
65  v.x() = std::numeric_limits<float>::infinity();
66  v.y() = std::numeric_limits<float>::infinity();
67  v.z() = std::numeric_limits<float>::infinity();
68  }
69 
70  template<typename T>
71  void invalidate(std::deque<T>& d)
72  {
73  d.clear();
74  }
75 
76 
77  std::string
79  {
80  switch (mode)
81  {
83  return "position";
85  return "velocity";
87  default:
88  return "unset";
89  }
90  }
91 
92 }
93 
94 
95 const std::string
96 armarx::ObstacleAwarePlatformUnit::default_name = "ObstacleAwarePlatformUnit";
97 
98 
100 
101 
103 
104 
105 void
107 {
108  ARMARX_DEBUG << "Initializing " << getName() << ".";
109 
110  ARMARX_DEBUG << "Initialized " << getName() << ".";
111 }
112 
113 
114 void
116 {
117  ARMARX_DEBUG << "Starting " << getName() << ".";
118 
119  if (!hasRobot("robot"))
120  {
121  m_robot = addRobot("robot", VirtualRobot::RobotIO::eStructure);
122  }
123 
124  invalidate(m_control_data.target_vel);
125  invalidate(m_control_data.target_rot_vel);
126  invalidate(m_control_data.target_pos);
127  invalidate(m_control_data.target_ori);
128  invalidate(m_viz.start);
129 
130  ARMARX_DEBUG << "Started " << getName() << ".";
131 }
132 
133 
134 void
136 {
137  ARMARX_DEBUG << "Exiting " << getName() << ".";
138 
139  schedule_high_level_control_loop(control_mode::none);
140 
141  ARMARX_DEBUG << "Exited " << getName() << ".";
142 }
143 
144 
145 std::string
147 const
148 {
149  return default_name;
150 }
151 
152 
153 void
155  const float target_pos_x,
156  const float target_pos_y,
157  const float target_ori,
158  const float pos_reached_threshold,
159  const float ori_reached_threshold,
160  const Ice::Current&)
161 {
162  using namespace simox::math;
163 
164  std::scoped_lock l{m_control_data.mutex};
165 
166  m_control_data.target_pos = Eigen::Vector2f{target_pos_x, target_pos_y};
167  m_control_data.target_ori = periodic_clamp<float>(target_ori, -M_PI, M_PI);
168  m_control_data.pos_reached_threshold = pos_reached_threshold;
169  m_control_data.ori_reached_threshold = ori_reached_threshold;
170 
171  invalidate(m_control_data.target_vel);
172  invalidate(m_control_data.target_rot_vel);
173 
174  m_rot_pid_controller.reset();
175 
176  schedule_high_level_control_loop(control_mode::position);
177 }
178 
179 
180 void
182  const float target_vel_x,
183  const float target_vel_y,
184  const float target_rot_vel,
185  const Ice::Current&)
186 {
187  using namespace simox::math;
188 
189  std::scoped_lock l{m_control_data.mutex};
190 
191  m_control_data.target_vel = Eigen::Vector2f{target_vel_x, target_vel_y};
192  m_control_data.target_rot_vel = periodic_clamp<float>(target_rot_vel, -M_PI, M_PI);
193 
194  invalidate(m_control_data.target_pos);
195  invalidate(m_control_data.target_ori);
196 
197  ARMARX_CHECK(m_control_data.target_vel.allFinite());
198  ARMARX_CHECK(std::isfinite(m_control_data.target_rot_vel));
199 
200  schedule_high_level_control_loop(control_mode::velocity);
201 }
202 
203 
204 void
206  const float target_pos_delta_x,
207  const float target_pos_delta_y,
208  const float target_delta_ori,
209  const float pos_reached_threshold,
210  const float ori_reached_threshold,
211  const Ice::Current& current)
212 {
213  using namespace simox::math;
214 
215  // Transform relative to global.
216  std::unique_lock lock{m_control_data.mutex};
217  synchronizeLocalClone(m_robot);
218  const Eigen::Vector2f agent_pos = m_robot->getGlobalPosition().head<2>();
219  const float agent_ori = mat4f_to_rpy(m_robot->getGlobalPose()).z();
220  lock.unlock();
221 
222  // Use moveTo.
223  moveTo(
224  agent_pos.x() + target_pos_delta_x,
225  agent_pos.y() + target_pos_delta_y,
226  agent_ori + target_delta_ori,
227  pos_reached_threshold,
228  ori_reached_threshold,
229  current);
230 }
231 
232 
233 void
235  float max_pos_vel,
236  float max_rot_vel,
237  const Ice::Current&)
238 {
239  // ensure positiveness
240  max_pos_vel = std::max(max_pos_vel, 0.F);
241  max_rot_vel = std::max(max_rot_vel, 0.F);
242 
243  std::scoped_lock l{m_control_data.mutex};
244  m_control_data.max_vel = max_pos_vel;
245  m_control_data.max_rot_vel = max_rot_vel;
246  m_platform->setMaxVelocities(max_pos_vel, max_rot_vel);
247 }
248 
249 
250 void
252 {
253  schedule_high_level_control_loop(control_mode::none);
254  m_platform->stopPlatform();
255 }
256 
257 
258 void
259 armarx::ObstacleAwarePlatformUnit::schedule_high_level_control_loop(control_mode mode)
260 {
261  std::scoped_lock l{m_control_loop.mutex};
262 
263  // If the control mode didn't change, there's nothing to do.
264  if (m_control_loop.mode == mode)
265  {
266  return;
267  }
268 
269  // If a control loop is runnung, stop it and wait for termination.
270  if (m_control_loop.mode != mode and m_control_loop.task)
271  {
272  ARMARX_VERBOSE << "Stopping " << ::to_string(m_control_loop.mode) << " control.";
273  const bool join = true;
274  m_control_loop.task->stop(join);
275  }
276 
277  // If the new control mode is none, no new control loop needs to be created.
278  if (mode == control_mode::none)
279  {
280  ARMARX_VERBOSE << "Going into stand-by.";
281  return;
282  }
283 
284  // Start next control loop.
285  ARMARX_VERBOSE << "Starting " << ::to_string(mode) << " control.";
286  m_control_loop.mode = mode;
287  m_control_loop.task = new RunningTask<ObstacleAwarePlatformUnit>(
288  this,
289  &ObstacleAwarePlatformUnit::high_level_control_loop);
290  m_control_loop.task->start();
291 }
292 
293 
294 void
295 armarx::ObstacleAwarePlatformUnit::high_level_control_loop()
296 {
297  const control_mode mode = m_control_loop.mode;
298  ARMARX_VERBOSE << "Started " << ::to_string(mode) << " control.";
299 
300  try
301  {
302  CycleUtil cu{m_control_loop.cycle_time};
303  while (not m_control_loop.task->isStopped())
304  {
305  const velocities vels = get_velocities();
306 
307  // Debug.
309  m["err_dist"] = new Variant{vels.err_dist};
310  m["err_angular_dist"] = new Variant{vels.err_angular_dist};
311 
312  m["target_global_x"] = new Variant{vels.target_global.x()};
313  m["target_global_y"] = new Variant{vels.target_global.y()};
314  m["target_global_abs"] = new Variant{vels.target_global.norm()};
315 
316  m["target_local_x"] = new Variant{vels.target_local.x()};
317  m["target_local_y"] = new Variant{vels.target_local.y()};
318  m["target_local_abs"] = new Variant(vels.target_local.norm());
319  m["target_rot"] = new Variant{vels.target_rot};
320 
321  m["modulated_global_x"] = new Variant{vels.modulated_global.x()};
322  m["modulated_global_y"] = new Variant{vels.modulated_global.y()};
323  m["modulated_global_abs"] = new Variant{vels.modulated_global.norm()};
324 
325  m["modulated_local_x"] = new Variant{vels.modulated_local.x()};
326  m["modulated_local_y"] = new Variant{vels.modulated_local.y()};
327  m["modulated_local_abs"] = new Variant{vels.modulated_local.norm()};
328 
329 // m["max_rot_vel"] = new Variant{m_control_data.max_rot_vel};
330 // m["max_lin_vel"] = new Variant{m_control_data.max_vel};
331 
332 // m["rot_desired"] = new Variant{m_control_data.target_ori};
333 // m["rot_measured"] = new Variant{m_control_data.agent_ori};
334 
335 // m["pos_x_desired"] = new Variant{m_control_data.target_pos.x()};
336 // m["pos_x_measured"] = new Variant{m_control_data.agent_pos.y()};
337 
338 // m["pos_y_desired"] = new Variant{m_control_data.target_pos.x()};
339 // m["pos_y_measured"] = new Variant{m_control_data.agent_pos.y()};
340 
341  setDebugObserverChannel("ObstacleAwarePlatformCtrl", m);
342 
343  m_platform->move(vels.modulated_local.x(), vels.modulated_local.y(), vels.target_rot);
344  visualize(vels);
345  cu.waitForCycleDuration();
346  }
347  }
348  catch (const std::exception& e)
349  {
350  ARMARX_ERROR << "Error occured while running control loop.\n"
351  << e.what();
352  }
353  catch (...)
354  {
355  ARMARX_ERROR << "Unknown error occured while running control loop.";
356  }
357 
358  m_platform->move(0, 0, 0);
359  m_platform->stopPlatform();
360  m_control_loop.mode = control_mode::none;
361 
362  visualize();
363 
364  ARMARX_VERBOSE << "Stopped " << ::to_string(mode) << " control.";
365 }
366 
367 
368 armarx::ObstacleAwarePlatformUnit::velocities
369 armarx::ObstacleAwarePlatformUnit::get_velocities()
370 {
371  using namespace simox::math;
372 
373  // Acquire control_data mutex to ensure data remains consistent.
374  std::scoped_lock l{m_control_data.mutex};
375  // Update agent and get target velocities.
376  update_agent_dependent_values();
377  const Eigen::Vector2f target_vel = get_target_velocity();
378  const float target_rot_vel = get_target_rotational_velocity();
379 
380  const Eigen::Vector2f extents = Eigen::Affine3f(m_robot->getRobotNode("PlatformCornerFrontLeft")->getPoseInRootFrame()).translation().head<2>();
381 
382  // Apply obstacle avoidance and apply post processing to get the modulated velocity.
383  const Eigen::Vector2f modulated_vel = [this, &target_vel, &extents]
384  {
385  const VirtualRobot::Circle circle = VirtualRobot::projectedBoundingCircle(*m_robot);
386  ARMARX_DEBUG << "Circle approximation: " << circle.radius;
387  m_viz.boundingCircle = circle;
388  const float distance = m_obsman->distanceToObstacle(m_control_data.agent_pos /*circle.center*/, circle.radius, m_control_data.target_pos);
389 
390  ARMARX_DEBUG << "Distance to obstacle: " << distance;
391 
392  // https://www.wolframalpha.com/input/?i=line+through+%281000%2C+0%29+and+%282000%2C+1%29
393  float modifier = std::clamp((distance / 1000) - 1., 0.0, 1.0);
394 
395  const Eigen::Vector2f vel = modifier * target_vel;
396  return vel.norm() > 20 ? vel : Eigen::Vector2f{0, 0};
397  }();
398 
399  ARMARX_CHECK(modulated_vel.allFinite()) << "Velocity contains non-finite values.";
400  ARMARX_CHECK(std::isfinite(target_rot_vel)) << "Rotation velocity is non-finite.";
401 
402  ARMARX_DEBUG << "Target velocity: " << target_vel.transpose()
403  << "; norm: " << target_vel.norm() << "; " << target_rot_vel;
404  ARMARX_DEBUG << "Modulated velocity: " << modulated_vel.transpose() << modulated_vel.norm();
405 
406  const auto r = Eigen::Rotation2D(m_control_data.agent_ori).toRotationMatrix().inverse();
407 
408  velocities vels;
409  vels.target_local = r * target_vel;
410  vels.target_global = target_vel;
411  vels.modulated_local = r * modulated_vel;
412  vels.modulated_global = modulated_vel;
413  vels.target_rot = target_rot_vel;
414  vels.err_dist = m_control_data.target_dist;
415  vels.err_angular_dist = m_control_data.target_angular_dist;
416 
417  return vels;
418 }
419 
420 
421 Eigen::Vector2f
422 armarx::ObstacleAwarePlatformUnit::get_target_velocity()
423 const
424 {
425  using namespace simox::math;
426 
427  Eigen::Vector2f uncapped_target_vel = Eigen::Vector2f::Zero();
428 
429  if (m_control_loop.mode == control_mode::position /*and not target_position_reached()*/)
430  {
431  uncapped_target_vel =
432  (m_control_data.target_pos - m_control_data.agent_pos) * m_control_data.kp;
433  }
434  else if (m_control_loop.mode == control_mode::velocity)
435  {
436  uncapped_target_vel = m_control_data.target_vel;
437  }
438 
439  ARMARX_CHECK(uncapped_target_vel.allFinite());
440 
441  return norm_max(uncapped_target_vel, m_control_data.max_vel);
442 }
443 
444 
445 float
446 armarx::ObstacleAwarePlatformUnit::get_target_rotational_velocity()
447 const
448 {
449  using namespace simox::math;
450 
451  float uncapped_target_rot_vel = 0;
452 
453  if (m_control_loop.mode == control_mode::position /*and not target_orientation_reached()*/)
454  {
455  m_rot_pid_controller.update(m_control_data.agent_ori, m_control_data.target_ori);
456  uncapped_target_rot_vel = m_rot_pid_controller.getControlValue();
457  }
458  else if (m_control_loop.mode == control_mode::velocity)
459  {
460  uncapped_target_rot_vel = m_control_data.target_rot_vel;
461  }
462 
463  ARMARX_CHECK(std::isfinite(uncapped_target_rot_vel));
464 
465  return std::clamp(uncapped_target_rot_vel, -m_control_data.max_rot_vel, m_control_data.max_rot_vel);
466 
467  // return std::copysign(std::min(std::fabs(uncapped_target_rot_vel), m_control_data.max_rot_vel),
468  // uncapped_target_rot_vel);
469 }
470 
471 
472 void
473 armarx::ObstacleAwarePlatformUnit::update_agent_dependent_values()
474 {
475  using namespace simox::math;
476 
477  synchronizeLocalClone(m_robot);
478  m_control_data.agent_pos = m_robot->getGlobalPosition().head<2>();
479  m_control_data.agent_ori =
480  periodic_clamp<float>(mat4f_to_rpy(m_robot->getGlobalPose()).z(), -M_PI, M_PI);
481 
482  ARMARX_CHECK_GREATER(m_control_data.agent_ori, -M_PI);
483  ARMARX_CHECK_LESS(m_control_data.agent_ori, M_PI);
484 
485  // Update distances in position mode.
486  if (m_control_loop.mode == control_mode::position)
487  {
488  ARMARX_CHECK_GREATER(m_control_data.target_ori, -M_PI);
489  ARMARX_CHECK_LESS(m_control_data.target_ori, M_PI);
490  ARMARX_CHECK(m_control_data.target_pos.allFinite());
491  ARMARX_CHECK(std::isfinite(m_control_data.target_ori));
492 
493  m_control_data.target_dist =
494  (m_control_data.target_pos - m_control_data.agent_pos).norm();
495  m_control_data.target_angular_dist =
496  periodic_clamp<float>(m_control_data.target_ori - m_control_data.agent_ori,
497  -M_PI, M_PI);
498 
499  ARMARX_CHECK_GREATER(m_control_data.target_angular_dist, -M_PI);
500  ARMARX_CHECK_LESS(m_control_data.target_angular_dist, M_PI);
501 
502  ARMARX_DEBUG << "Distance to target: " << m_control_data.target_dist << " mm and "
503  << m_control_data.target_angular_dist << " rad.";
504  }
505  // Otherwise invalidate them.
506  else
507  {
508  invalidate(m_control_data.target_dist);
509  invalidate(m_control_data.target_angular_dist);
510  }
511 }
512 
513 
514 bool
515 armarx::ObstacleAwarePlatformUnit::target_position_reached()
516 const
517 {
518  if (m_control_loop.mode == control_mode::position)
519  {
520  return m_control_data.target_dist < m_control_data.pos_reached_threshold;
521  }
522 
523  // Cannot reach any target in non-position mode.
524  return false;
525 }
526 
527 
528 bool
529 armarx::ObstacleAwarePlatformUnit::target_orientation_reached()
530 const
531 {
532  if (m_control_loop.mode == control_mode::position)
533  {
534  return std::fabs(m_control_data.target_angular_dist) < m_control_data.ori_reached_threshold;
535  }
536 
537  // Cannot reach any target in non-position mode.
538  return false;
539 }
540 
541 
542 bool
543 armarx::ObstacleAwarePlatformUnit::target_reached()
544 const
545 {
546  if (m_control_loop.mode == control_mode::position)
547  {
548  return target_position_reached() and target_orientation_reached();
549  }
550 
551  return false;
552 }
553 
554 
555 bool
556 armarx::ObstacleAwarePlatformUnit::is_near_target(const Eigen::Vector2f& control_velocity)
557 const noexcept
558 {
559  if (m_control_data.target_dist < m_control_data.pos_near_threshold)
560  {
561  const Eigen::Vector2f target_direction = m_control_data.target_pos - m_control_data.agent_pos;
562  const Eigen::Vector2f control_direction = control_velocity / control_velocity.norm();
563 
564  const float sim = simox::math::cosine_similarity(target_direction, control_direction);
565 
566  // if almost pointing into same direction
567  if (sim > cos(M_PI_4))
568  {
569  return true;
570  }
571  }
572 
573  return false;
574 }
575 
576 
577 void
578 armarx::ObstacleAwarePlatformUnit::visualize()
579 {
580  const Eigen::Vector2f zero = Eigen::Vector2f::Zero();
581  velocities vels;
582  vels.target_local = zero;
583  vels.target_global = zero;
584  vels.modulated_local = zero;
585  vels.modulated_global = zero;
586  vels.target_rot = 0;
587 
588  visualize(vels);
589 }
590 
591 
592 void
593 armarx::ObstacleAwarePlatformUnit::visualize(const velocities& vels)
594 {
595  using namespace armarx::viz;
596 
597  if (not m_viz.enabled)
598  {
599  return;
600  }
601 
602  Eigen::Vector3f agent_pos{m_control_data.agent_pos.x(), m_control_data.agent_pos.y(), 0};
603 
604  // Progress. Only draw in position control mode.
605  Layer l_prog = arviz.layer("progress");
606  if (m_control_loop.mode == control_mode::position)
607  {
608  const float min_keypoint_dist = 50;
609 
610  {
611  l_prog.add(Cylinder{"boundingCylinder"}
612  .position(agent_pos)
613  .color(Color::cyan(255, 64))
614  .pose(simox::math::pos_rpy_to_mat4f(agent_pos, -M_PI_2, 0, 0) * Eigen::Isometry3f(Eigen::Translation3f(0, -1000, 0)).matrix())
615  .radius(m_viz.boundingCircle.radius)
616  .height(2000));
617  }
618 
619  // If no start is set, use current agent pos.
620  if (not m_viz.start.allFinite())
621  {
622  m_viz.start = agent_pos;
623  }
624 
625  const Eigen::Vector3f& last_keypoint_pos =
626  m_viz.path.size() >= 1 ? m_viz.path.back() : m_viz.start;
627 
628  // Keep a certain distance between path keypoints.
629  if ((last_keypoint_pos - agent_pos).norm() > min_keypoint_dist)
630  {
631  m_viz.path.push_back(agent_pos);
632  }
633 
634  // Draw path.
635  if (not target_reached())
636  {
637  // Start.
638  l_prog.add(Sphere{"start"}
639  .position(m_viz.start)
640  .color(Color::cyan(255, 64))
641  .radius(40));
642 
643  // Path.
644  for (unsigned i = 0; i < m_viz.path.size(); ++i)
645  {
646  l_prog.add(Sphere{"path_" + std::to_string(i + 1)}
647  .position(m_viz.path[i])
648  .color(Color::magenta(255, 128))
649  .radius(20));
650  }
651 
652  // Goal.
653  const Eigen::Vector3f target{m_control_data.target_pos.x(),
654  m_control_data.target_pos.y(),
655  0};
656  l_prog.add(Arrow{"goal"}
657  .fromTo(target + Eigen::Vector3f{0, 0, 220},
658  target + Eigen::Vector3f{0, 0, 40})
659  .color(Color::red(255, 128))
660  .width(20));
661  }
662  else
663  {
664  m_viz.path.clear();
665  invalidate(m_viz.start);
666  }
667  }
668 
669  // Velocities.
670  Layer l_vels = arviz.layer("velocities");
671  if (m_control_loop.mode != control_mode::none)
672  {
673  const float min_velocity = 15;
674  const Eigen::Vector3f from1{agent_pos + Eigen::Vector3f{0, 0, 2000}};
675  const Eigen::Vector3f from2 = from1 + Eigen::Vector3f{0, 0, 200};
676  const Eigen::Vector3f original{vels.target_global.x(), vels.target_global.y(), 0};
677  const Eigen::Vector3f modulated{vels.modulated_global.x(), vels.modulated_global.y(), 0};
678 
679  if (original.norm() > min_velocity)
680  {
681  l_vels.add(Arrow{"original"}
682  .fromTo(from1, from1 + original * 5)
683  .color(Color::green(255, 128))
684  .width(25));
685  }
686 
687  if (modulated.norm() > min_velocity)
688  {
689  l_vels.add(Arrow{"modulated"}
690  .fromTo(from2, from2 + modulated * 5)
691  .color(Color::cyan(255, 128))
692  .width(25));
693  }
694 
695  // TODO rotation arrow
696  }
697 
698  // Agent.
699  Layer l_agnt = arviz.layer("agent");
700  if (m_control_loop.mode != control_mode::none)
701  {
702  l_agnt.add(Sphere{"agent"}
703  .position(agent_pos)
704  .color(Color::red(255, 128))
705  .radius(50));
706 
707  // Agent safety margin.
708  if (m_control_data.agent_safety_margin > 0)
709  {
710  l_agnt.add(Cylinder{"agent_safety_margin"}
711  .pose(simox::math::pos_rpy_to_mat4f(agent_pos, -M_PI_2, 0, 0))
712  .color(Color::red(255, 64))
713  .radius(m_control_data.agent_safety_margin)
714  .height(2));
715  }
716  }
717 
718  arviz.commit({l_prog, l_vels, l_agnt});
719 }
720 
721 
724 {
726 
727  def->component(m_platform, "Platform");
728  def->component(m_obsman, "ObstacleAvoidingPlatformUnit");
729 
730  // Settings.
731  def->optional(m_control_data.min_vel_near_target, "min_vel_near_target", "Velocity in [mm/s] "
732  "the robot should at least set when near the target");
733  def->optional(m_control_data.min_vel_general, "min_vel_general", "Velocity in [mm/s] the robot "
734  "should at least set on general");
735  def->optional(m_control_data.pos_near_threshold, "pos_near_threshold", "Distance in [mm] after "
736  "which the robot is considered to be near the target for min velocity, "
737  "smoothing, etc.");
738 
739  // Control parameters.
740  def->optional(m_control_data.kp, "control.pos.kp");
741  def->optional(m_rot_pid_controller.Kp, "control.rot.kp");
742  def->optional(m_rot_pid_controller.Ki, "control.rot.ki");
743  def->optional(m_rot_pid_controller.Kd, "control.rot.kd");
744  def->optional(m_control_loop.cycle_time, "control.pose.cycle_time", "Control loop cycle time.");
745 
746  // Obstacle avoidance parameter.
747  def->optional(m_control_data.agent_safety_margin, "doa.agent_safety_margin");
748 
749  return def;
750 }
ARMARX_VERBOSE
#define ARMARX_VERBOSE
Definition: Logging.h:180
armarx::ObstacleAwarePlatformUnit::control_mode
control_mode
Definition: ObstacleAwarePlatformUnit.h:69
Eigen
Definition: Elements.h:36
ObstacleAwarePlatformUnit.h
armarx::StringVariantBaseMap
std::map< std::string, VariantBasePtr > StringVariantBaseMap
Definition: ManagedIceObject.h:111
armarx::ObstacleAwarePlatformUnit::control_mode::none
@ none
armarx::ObstacleAwarePlatformUnit::control_mode::position
@ position
armarx::ObstacleAwarePlatformUnit::default_name
static const std::string default_name
Definition: ObstacleAwarePlatformUnit.h:242
boost::target
Vertex target(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:688
ARMARX_CHECK_GREATER
#define ARMARX_CHECK_GREATER(lhs, rhs)
This macro evaluates whether lhs is greater (>) than rhs and if it turns out to be false it will thro...
Definition: ExpressionException.h:116
armarx::ObstacleAwarePlatformUnit::moveRelative
void moveRelative(float target_pos_delta_x, float target_pos_delta_y, float target_delta_ori, float pos_reached_threshold, float ori_reached_threshold, const Ice::Current &=Ice::Current{}) override
Definition: ObstacleAwarePlatformUnit.cpp:205
armarx::navigation::components::laser_scanner_feature_extraction::Circle
memory::Circle Circle
Definition: FeatureExtractor.h:42
armarx::viz::Arrow
Definition: Elements.h:198
armarx::ObstacleAwarePlatformUnit::moveTo
void moveTo(float target_pos_x, float target_pos_y, float target_ori, float pos_reached_threshold, float ori_reached_threshold, const Ice::Current &=Ice::Current{}) override
Definition: ObstacleAwarePlatformUnit.cpp:154
ARMARX_CHECK_LESS
#define ARMARX_CHECK_LESS(lhs, rhs)
This macro evaluates whether lhs is less (<) than rhs and if it turns out to be false it will throw a...
Definition: ExpressionException.h:102
armarx::viz::Cylinder::height
Cylinder & height(float h)
Definition: Elements.h:85
armarx::viz::Layer::add
void add(ElementT const &element)
Definition: Layer.h:29
armarx::ObstacleAwarePlatformUnit::ObstacleAwarePlatformUnit
ObstacleAwarePlatformUnit()
armarx::viz::Sphere
Definition: Elements.h:134
ARMARX_CHECK
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
Definition: ExpressionException.h:82
clamp
double clamp(double x, double a, double b)
Definition: point.hpp:125
armarx::ObstacleAwarePlatformUnit::control_mode::velocity
@ velocity
armarx::viz::ElementOps::position
DerivedT & position(float x, float y, float z)
Definition: ElementOps.h:127
armarx::ObstacleAwarePlatformUnit::onInitPlatformUnit
void onInitPlatformUnit() override
Definition: ObstacleAwarePlatformUnit.cpp:106
std::isfinite
bool isfinite(const std::vector< T, Ts... > &v)
Definition: algorithm.h:327
armarx::ObstacleAwarePlatformUnit::~ObstacleAwarePlatformUnit
~ObstacleAwarePlatformUnit() override
M_PI
#define M_PI
Definition: MathTools.h:17
armarx::viz::Arrow::width
Arrow & width(float w)
Definition: Elements.h:211
armarx::ObstacleAwarePlatformUnit::createPropertyDefinitions
PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: ObstacleAwarePlatformUnit.cpp:723
ARMARX_DEBUG
#define ARMARX_DEBUG
Definition: Logging.h:177
armarx::viz::Cylinder
Definition: Elements.h:74
armarx::viz::Sphere::radius
Sphere & radius(float r)
Definition: Elements.h:138
max
T max(T t1, T t2)
Definition: gdiam.h:48
armarx::ObstacleAwarePlatformUnit::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: ObstacleAwarePlatformUnit.cpp:146
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
armarx::viz::Color::red
static Color red(int r=255, int a=255)
Definition: Color.h:79
armarx::viz::Color::cyan
static Color cyan(int c=255, int a=255)
Green + Blue.
Definition: Color.h:98
armarx::to_string
const std::string & to_string(const std::string &s)
Definition: StringHelpers.h:40
armarx::viz::Arrow::fromTo
Arrow & fromTo(const Eigen::Vector3f &from, const Eigen::Vector3f &to)
Definition: Elements.h:218
armarx::ctrlutil::v
double v(double t, double v0, double a0, double j)
Definition: CtrlUtil.h:39
armarx::navigation::algorithms::visualize
void visualize(const algorithms::Costmap &costmap, viz::Layer &layer, const std::string &name, const float zOffset)
Definition: visualization.cpp:20
armarx::ObstacleAwarePlatformUnit::setMaxVelocities
void setMaxVelocities(float max_pos_vel, float max_rot_vel, const Ice::Current &=Ice::Current{}) override
Definition: ObstacleAwarePlatformUnit.cpp:234
armarx::viz::Color::magenta
static Color magenta(int m=255, int a=255)
Red + Blue.
Definition: Color.h:110
armarx::viz::ElementOps::pose
DerivedT & pose(Eigen::Matrix4f const &pose)
Definition: ElementOps.h:159
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::viz::ElementOps::color
DerivedT & color(Color color)
Definition: ElementOps.h:195
F
Definition: ExportDialogControllerTest.cpp:16
armarx::ObstacleAwarePlatformUnit::move
void move(float target_vel_x, float target_vel_y, float target_rot_vel, const Ice::Current &=Ice::Current{}) override
Definition: ObstacleAwarePlatformUnit.cpp:181
distance
double distance(const Point &a, const Point &b)
Definition: point.hpp:88
armarx::ManagedIceObject::getName
std::string getName() const
Retrieve name of object.
Definition: ManagedIceObject.cpp:107
armarx::ObstacleAwarePlatformUnit::onExitPlatformUnit
void onExitPlatformUnit() override
Definition: ObstacleAwarePlatformUnit.cpp:135
armarx::viz::Color::green
static Color green(int g=255, int a=255)
Definition: Color.h:84
armarx::ObstacleAwarePlatformUnit::onStartPlatformUnit
void onStartPlatformUnit() override
Definition: ObstacleAwarePlatformUnit.cpp:115
armarx::viz::Layer
Definition: Layer.h:12
Variant.h
armarx::PlatformUnit::createPropertyDefinitions
PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PlatformUnit.cpp:35
armarx::viz
This file is part of ArmarX.
Definition: ArVizStorage.cpp:416
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::ObstacleAwarePlatformUnit::stopPlatform
void stopPlatform(const Ice::Current &=Ice::Current{}) override
Definition: ObstacleAwarePlatformUnit.cpp:251
norm
double norm(const Point &a)
Definition: point.hpp:94