15 #ifndef MECANUM_DRIVE_CONTROLLER__ODOMETRY_HPP_
16 #define MECANUM_DRIVE_CONTROLLER__ODOMETRY_HPP_
18 #include "geometry_msgs/msg/twist.hpp"
19 #include "realtime_tools/realtime_buffer.hpp"
20 #include "realtime_tools/realtime_publisher.hpp"
22 #define PLANAR_POINT_DIM 3
24 namespace mecanum_drive_controller
41 void init(
const rclcpp::Time & time, std::array<double, PLANAR_POINT_DIM> base_frame_offset);
51 const double wheel_front_left_vel,
const double wheel_rear_left_vel,
52 const double wheel_rear_right_vel,
const double wheel_front_right_vel,
const double dt);
55 double getX()
const {
return position_x_in_base_frame_; }
57 double getY()
const {
return position_y_in_base_frame_; }
59 double getRz()
const {
return orientation_z_in_base_frame_; }
61 double getVx()
const {
return velocity_in_base_frame_linear_x; }
63 double getVy()
const {
return velocity_in_base_frame_linear_y; }
67 return velocity_in_base_frame_angular_z;
76 const double sum_of_robot_center_projection_on_X_Y_axis,
const double wheels_radius);
80 rclcpp::Time timestamp_;
83 std::array<double, PLANAR_POINT_DIM> base_frame_offset_;
86 double position_x_in_base_frame_;
87 double position_y_in_base_frame_;
88 double orientation_z_in_base_frame_;
90 double velocity_in_base_frame_linear_x;
91 double velocity_in_base_frame_linear_y;
92 double velocity_in_base_frame_angular_z;
98 double sum_of_robot_center_projection_on_X_Y_axis_;
99 double wheels_radius_;
The Odometry class handles odometry readings (2D pose and velocity with related timestamp)
Definition: odometry.hpp:29
std::function< void(double, double, double)> IntegrationFunction
Integration function, used to integrate the odometry:
Definition: odometry.hpp:32
double getVx() const
Definition: odometry.hpp:61
void init(const rclcpp::Time &time, std::array< double, PLANAR_POINT_DIM > base_frame_offset)
Initialize the odometry.
Definition: odometry.cpp:35
double getX() const
Definition: odometry.hpp:55
bool update(const double wheel_front_left_vel, const double wheel_rear_left_vel, const double wheel_rear_right_vel, const double wheel_front_right_vel, const double dt)
Updates the odometry class with latest wheels position.
Definition: odometry.cpp:47
double getRz() const
Definition: odometry.hpp:59
void setWheelsParams(const double sum_of_robot_center_projection_on_X_Y_axis, const double wheels_radius)
Sets the wheels parameters: mecanum geometric param and radius.
Definition: odometry.cpp:117
double getY() const
Definition: odometry.hpp:57
double getVy() const
Definition: odometry.hpp:63
double getWz() const
Definition: odometry.hpp:65
Odometry()
Constructor Timestamp will get the current time value Value will be set to zero.
Definition: odometry.cpp:22