28 #include <SimoxUtility/math.h>
32 armarx::PlatformUnitInterfacePrx platform_unit,
41 armarx::PlatformUnitInterfacePrx platform_unit,
44 m_platform_unit{platform_unit},
54 m_platform_unit->stopPlatform();
60 const Eigen::Vector2f& target_pos,
61 const float target_ori)
63 setTarget(
Target{target_pos, target_ori});
71 m_waypoints.push_back(
target);
72 m_current_waypoint_index = 0;
73 m_waypoint_changed =
true;
81 return m_waypoints.at(m_current_waypoint_index);
89 if (isCurrentTargetNear() and not isLastWaypoint())
91 m_current_waypoint_index++;
92 m_waypoint_changed =
true;
98 if (m_waypoint_changed)
104 const float pos_thresh = m_cfg.pos_reached_threshold;
105 const float ori_thresh = m_cfg.ori_reached_threshold;
109 m_platform_unit->moveTo(
target.pos.x(),
target.pos.y(),
target.ori, pos_thresh, ori_thresh);
111 m_waypoint_changed =
false;
119 addWaypoint(
Target{waypoint_pos, waypoint_ori});
126 m_waypoints = waypoints;
127 m_current_waypoint_index = 0;
128 m_waypoint_changed =
true;
135 m_waypoints.push_back(waypoint);
143 return m_current_waypoint_index + 1 >= m_waypoints.size();
151 return getPositionError() < m_cfg.pos_near_threshold and getOrientationError() < m_cfg.ori_near_threshold;
159 return getPositionError() < m_cfg.pos_reached_threshold and getOrientationError() < m_cfg.ori_reached_threshold;
167 return isLastWaypoint() and isCurrentTargetNear();
175 return isLastWaypoint() and isCurrentTargetReached();
182 m_platform_unit->setMaxVelocities(max_vel, max_angular_vel);
190 const Eigen::Vector2f agent_pos = m_robot->getGlobalPosition().head<2>();
191 return (getCurrentTarget().pos - agent_pos).
norm();
199 using namespace simox::math;
201 const float agent_ori =
202 periodic_clamp<float>(mat4f_to_rpy(m_robot->getGlobalPose()).z(), -
M_PI,
M_PI);
203 return std::fabs(periodic_clamp<float>(getCurrentTarget().ori - agent_ori, -
M_PI,
M_PI));