15 #ifndef NAV2_GRACEFUL_CONTROLLER__EGO_POLAR_COORDS_HPP_
16 #define NAV2_GRACEFUL_CONTROLLER__EGO_POLAR_COORDS_HPP_
20 #include "angles/angles.h"
21 #include "geometry_msgs/msg/pose.hpp"
22 #include "tf2/utils.h"
23 #include "tf2/transform_datatypes.h"
24 #include "tf2_geometry_msgs/tf2_geometry_msgs.hpp"
26 namespace nav2_graceful_controller
41 const float & r_in = 0.0,
42 const float & phi_in = 0.0,
43 const float & delta_in = 0.0)
44 : r(r_in), phi(phi_in), delta(delta_in) {}
57 const geometry_msgs::msg::Pose & target,
58 const geometry_msgs::msg::Pose & current = geometry_msgs::msg::Pose(),
bool backward =
false)
61 float dX = target.position.x - current.position.x;
62 float dY = target.position.y - current.position.y;
65 float line_of_sight = backward ? (std::atan2(-dY, dX) + M_PI) : std::atan2(-dY, dX);
67 r = sqrt(dX * dX + dY * dY);
68 phi = angles::normalize_angle(tf2::getYaw(target.orientation) + line_of_sight);
69 delta = angles::normalize_angle(tf2::getYaw(current.orientation) + line_of_sight);
Egocentric polar coordinates defined as the difference between the robot pose and the target pose rel...
EgocentricPolarCoordinates(const geometry_msgs::msg::Pose &target, const geometry_msgs::msg::Pose ¤t=geometry_msgs::msg::Pose(), bool backward=false)
Construct a new egocentric polar coordinates as the difference between the robot pose and the target ...