The Odometry class handles odometry readings (2D pose and velocity with related timestamp) More...
#include <odometry.h>
Public Types | |
typedef boost::function< void(double, double, double)> | IntegrationFunction |
Integration function, used to integrate the odometry: | |
Public Member Functions | |
double | getAngular () const |
angular velocity getter | |
double | getHeading () const |
heading getter | |
double | getLinearX () const |
linearX velocity getter | |
double | getLinearY () const |
linearY velocity getter | |
double | getX () const |
x position getter | |
double | getY () const |
y position getter | |
void | init (const ros::Time &time) |
Initialize the odometry. | |
Odometry (size_t velocity_rolling_window_size=10) | |
Constructor Timestamp will get the current time value Value will be set to zero. | |
void | setWheelsParams (double wheels_k, double wheels_radius) |
Sets the wheels parameters: mecanum geometric param and radius. | |
bool | update (double wheel0_vel, double wheel1_vel, double wheel2_vel, double wheel3_vel, const ros::Time &time) |
Updates the odometry class with latest wheels position. | |
void | updateOpenLoop (double linearX, double linearY, double angular, const ros::Time &time) |
Updates the odometry class with latest velocity command. | |
Private Types | |
typedef bacc::accumulator_set < double, bacc::stats < bacc::tag::rolling_mean > > | RollingMeanAcc |
Rolling mean accumulator and window: | |
typedef bacc::tag::rolling_window | RollingWindow |
Private Member Functions | |
void | integrateExact (double linearX, double linearY, double angular) |
Integrates the velocities (linear and angular) using exact method. | |
Private Attributes | |
double | angular_ |
RollingMeanAcc | angular_acc_ |
double | heading_ |
IntegrationFunction | integrate_fun_ |
Integration funcion, used to integrate the odometry: | |
double | linearX_ |
Current velocity: | |
RollingMeanAcc | linearX_acc_ |
double | linearY_ |
RollingMeanAcc | linearY_acc_ |
ros::Time | timestamp_ |
Current timestamp: | |
size_t | velocity_rolling_window_size_ |
Rolling mean accumulators for the linar and angular velocities: | |
double | wheels_k_ |
Wheels kinematic parameters [m]: | |
double | wheels_radius_ |
double | x_ |
Current pose: | |
double | y_ |
The Odometry class handles odometry readings (2D pose and velocity with related timestamp)
Definition at line 60 of file odometry.h.
typedef boost::function<void(double, double, double)> mecanum_drive_controller::Odometry::IntegrationFunction |
Integration function, used to integrate the odometry:
Definition at line 65 of file odometry.h.
typedef bacc::accumulator_set<double, bacc::stats<bacc::tag::rolling_mean> > mecanum_drive_controller::Odometry::RollingMeanAcc [private] |
Rolling mean accumulator and window:
Definition at line 164 of file odometry.h.
typedef bacc::tag::rolling_window mecanum_drive_controller::Odometry::RollingWindow [private] |
Definition at line 165 of file odometry.h.
mecanum_drive_controller::Odometry::Odometry | ( | size_t | velocity_rolling_window_size = 10 | ) |
Constructor Timestamp will get the current time value Value will be set to zero.
velocity_rolling_window_size | Rolling window size used to compute the velocity mean |
Definition at line 54 of file odometry.cpp.
double mecanum_drive_controller::Odometry::getAngular | ( | ) | const [inline] |
double mecanum_drive_controller::Odometry::getHeading | ( | ) | const [inline] |
double mecanum_drive_controller::Odometry::getLinearX | ( | ) | const [inline] |
double mecanum_drive_controller::Odometry::getLinearY | ( | ) | const [inline] |
double mecanum_drive_controller::Odometry::getX | ( | ) | const [inline] |
double mecanum_drive_controller::Odometry::getY | ( | ) | const [inline] |
void mecanum_drive_controller::Odometry::init | ( | const ros::Time & | time | ) |
void mecanum_drive_controller::Odometry::integrateExact | ( | double | linearX, |
double | linearY, | ||
double | angular | ||
) | [private] |
Integrates the velocities (linear and angular) using exact method.
linearX | Linear velocity along X [m] (linear displacement, i.e. m/s * dt) computed by encoders |
linearY | Linear velocity along Y [m] (linear displacement, i.e. m/s * dt) computed by encoders |
angular | Angular velocity [rad] (angular displacement, i.e. m/s * dt) computed by encoders |
Integrate angular velocity.
The odometry pose should be published in the /odom frame (unlike the odometry twist which is a body twist). Project the twist in the odometry basis (we cannot integrate linearX, linearY, angular 'as are' because they correspond to a body twist).
Integrate linear velocity.
Definition at line 132 of file odometry.cpp.
void mecanum_drive_controller::Odometry::setWheelsParams | ( | double | wheels_k, |
double | wheels_radius | ||
) |
Sets the wheels parameters: mecanum geometric param and radius.
wheels_k | Wheels geometric param (used in mecanum wheels' ik) [m] |
wheels_radius | Wheels radius [m] |
Definition at line 124 of file odometry.cpp.
bool mecanum_drive_controller::Odometry::update | ( | double | wheel0_vel, |
double | wheel1_vel, | ||
double | wheel2_vel, | ||
double | wheel3_vel, | ||
const ros::Time & | time | ||
) |
Updates the odometry class with latest wheels position.
wheel0_vel | Wheel velocity [rad] |
wheel1_vel | Wheel velocity [rad] |
wheel2_vel | Wheel velocity [rad] |
wheel3_vel | Wheel velocity [rad] |
time | Current time |
We cannot estimate the speed with very small time intervals:
Compute forward kinematics (i.e. compute mobile robot's body twist out of its wheels velocities): NOTE: we use the IK of the mecanum wheels which we invert using a pseudo-inverse. NOTE: in the diff drive the velocity is filtered out, but we prefer to return it raw and let the user perform post-processing at will. We prefer this way of doing as filtering introduces delay (which makes it difficult to interpret and compare behavior curves).
Integrate odometry.
Definition at line 85 of file odometry.cpp.
void mecanum_drive_controller::Odometry::updateOpenLoop | ( | double | linearX, |
double | linearY, | ||
double | angular, | ||
const ros::Time & | time | ||
) |
Updates the odometry class with latest velocity command.
linearX | Linear velocity [m/s] |
angular | Angular velocity [rad/s] |
time | Current time |
Save last linear and angular velocity:
Integrate odometry:
Definition at line 110 of file odometry.cpp.
double mecanum_drive_controller::Odometry::angular_ [private] |
Definition at line 186 of file odometry.h.
Definition at line 196 of file odometry.h.
double mecanum_drive_controller::Odometry::heading_ [private] |
Definition at line 181 of file odometry.h.
Integration funcion, used to integrate the odometry:
Definition at line 199 of file odometry.h.
double mecanum_drive_controller::Odometry::linearX_ [private] |
Current velocity:
Definition at line 184 of file odometry.h.
Definition at line 194 of file odometry.h.
double mecanum_drive_controller::Odometry::linearY_ [private] |
Definition at line 185 of file odometry.h.
Definition at line 195 of file odometry.h.
Current timestamp:
Definition at line 176 of file odometry.h.
size_t mecanum_drive_controller::Odometry::velocity_rolling_window_size_ [private] |
Rolling mean accumulators for the linar and angular velocities:
Definition at line 193 of file odometry.h.
double mecanum_drive_controller::Odometry::wheels_k_ [private] |
Wheels kinematic parameters [m]:
Definition at line 189 of file odometry.h.
double mecanum_drive_controller::Odometry::wheels_radius_ [private] |
Definition at line 190 of file odometry.h.
double mecanum_drive_controller::Odometry::x_ [private] |
Current pose:
Definition at line 179 of file odometry.h.
double mecanum_drive_controller::Odometry::y_ [private] |
Definition at line 180 of file odometry.h.