15 #include "nav2_collision_monitor/kinematics.hpp"
19 namespace nav2_collision_monitor
22 void transformPoints(
const Pose & pose, std::vector<Point> & points)
24 const double cos_theta = std::cos(pose.theta);
25 const double sin_theta = std::sin(pose.theta);
27 for (Point & point : points) {
37 const double mul_x = point.x - pose.x;
38 const double mul_y = point.y - pose.y;
39 point.x = mul_x * cos_theta + mul_y * sin_theta;
40 point.y = -mul_x * sin_theta + mul_y * cos_theta;
44 void projectState(
const double & dt, Pose & pose, Velocity & velocity)
46 const double theta = velocity.tw * dt;
47 const double cos_theta = std::cos(theta);
48 const double sin_theta = std::sin(theta);
54 pose.x = pose.x + velocity.x * dt;
55 pose.y = pose.y + velocity.y * dt;
57 pose.theta = pose.theta + theta;
64 const double velocity_upd_x = velocity.x * cos_theta - velocity.y * sin_theta;
65 const double velocity_upd_y = velocity.x * sin_theta + velocity.y * cos_theta;
66 velocity.x = velocity_upd_x;
67 velocity.y = velocity_upd_y;