The Odometry class handles odometry readings (2D pose and velocity with related timestamp)
More...
#include <odometry.h>
|
typedef bacc::accumulator_set< double, bacc::stats< bacc::tag::rolling_mean > > | RollingMeanAcc |
| Rolling mean accumulator and window: More...
|
|
typedef bacc::tag::rolling_window | RollingWindow |
|
The Odometry class handles odometry readings (2D pose and velocity with related timestamp)
Definition at line 59 of file odometry.h.
Integration function, used to integrate the odometry:
Definition at line 64 of file odometry.h.
Rolling mean accumulator and window:
Definition at line 159 of file odometry.h.
diff_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.
- Parameters
-
velocity_rolling_window_size | Rolling window size used to compute the velocity mean |
Definition at line 50 of file odometry.cpp.
double diff_drive_controller::Odometry::getAngular |
( |
| ) |
const |
|
inline |
angular velocity getter
- Returns
- angular velocity [rad/s]
Definition at line 137 of file odometry.h.
double diff_drive_controller::Odometry::getHeading |
( |
| ) |
const |
|
inline |
heading getter
- Returns
- heading [rad]
Definition at line 101 of file odometry.h.
double diff_drive_controller::Odometry::getLinear |
( |
| ) |
const |
|
inline |
linear velocity getter
- Returns
- linear velocity [m/s]
Definition at line 128 of file odometry.h.
double diff_drive_controller::Odometry::getX |
( |
| ) |
const |
|
inline |
x position getter
- Returns
- x position [m]
Definition at line 110 of file odometry.h.
double diff_drive_controller::Odometry::getY |
( |
| ) |
const |
|
inline |
y position getter
- Returns
- y position [m]
Definition at line 119 of file odometry.h.
void diff_drive_controller::Odometry::init |
( |
const ros::Time & |
time | ) |
|
Initialize the odometry.
- Parameters
-
Definition at line 69 of file odometry.cpp.
void diff_drive_controller::Odometry::integrateExact |
( |
double |
linear, |
|
|
double |
angular |
|
) |
| |
|
private |
Integrates the velocities (linear and angular) using exact method.
Other possible integration method provided by the class.
- Parameters
-
linear | Linear velocity m computed by encoders |
angular | Angular velocity rad computed by encoders |
linear | |
angular | |
Exact integration (should solve problems when angular is zero):
Definition at line 155 of file odometry.cpp.
void diff_drive_controller::Odometry::integrateRungeKutta2 |
( |
double |
linear, |
|
|
double |
angular |
|
) |
| |
|
private |
Integrates the velocities (linear and angular) using 2nd order Runge-Kutta.
- Parameters
-
linear | Linear velocity m computed by encoders |
angular | Angular velocity rad computed by encoders |
Runge-Kutta 2nd order integration:
Definition at line 140 of file odometry.cpp.
void diff_drive_controller::Odometry::resetAccumulators |
( |
| ) |
|
|
private |
Reset linear and angular accumulators.
Definition at line 170 of file odometry.cpp.
void diff_drive_controller::Odometry::setVelocityRollingWindowSize |
( |
size_t |
velocity_rolling_window_size | ) |
|
Velocity rolling window size setter.
- Parameters
-
velocity_rolling_window_size | Velocity rolling window size |
Definition at line 133 of file odometry.cpp.
void diff_drive_controller::Odometry::setWheelParams |
( |
double |
wheel_separation, |
|
|
double |
left_wheel_radius, |
|
|
double |
right_wheel_radius |
|
) |
| |
Sets the wheel parameters: radius and separation.
- Parameters
-
wheel_separation | Separation between left and right wheels [m] |
left_wheel_radius | Left wheel radius [m] |
right_wheel_radius | Right wheel radius [m] |
Definition at line 126 of file odometry.cpp.
bool diff_drive_controller::Odometry::update |
( |
double |
left_pos, |
|
|
double |
right_pos, |
|
|
const ros::Time & |
time |
|
) |
| |
Updates the odometry class with latest wheels position.
- Parameters
-
left_pos | Left wheel position [rad] |
right_pos | Right wheel position [rad] |
time | Current time |
- Returns
- true if the odometry is actually updated
Get current wheel joint positions:
Estimate velocity of wheels using old and current position:
Update old position with current:
Compute linear and angular diff:
Integrate odometry:
We cannot estimate the speed with very small time intervals:
Estimate speeds using a rolling mean to filter them out:
Definition at line 76 of file odometry.cpp.
void diff_drive_controller::Odometry::updateOpenLoop |
( |
double |
linear, |
|
|
double |
angular, |
|
|
const ros::Time & |
time |
|
) |
| |
Updates the odometry class with latest velocity command.
- Parameters
-
linear | Linear velocity [m/s] |
angular | Angular velocity [rad/s] |
time | Current time |
Save last linear and angular velocity:
Integrate odometry:
Definition at line 114 of file odometry.cpp.
double diff_drive_controller::Odometry::angular_ |
|
private |
double diff_drive_controller::Odometry::heading_ |
|
private |
Integration funcion, used to integrate the odometry:
Definition at line 208 of file odometry.h.
double diff_drive_controller::Odometry::left_wheel_old_pos_ |
|
private |
Previou wheel position/state [rad]:
Definition at line 199 of file odometry.h.
double diff_drive_controller::Odometry::left_wheel_radius_ |
|
private |
double diff_drive_controller::Odometry::linear_ |
|
private |
double diff_drive_controller::Odometry::right_wheel_old_pos_ |
|
private |
double diff_drive_controller::Odometry::right_wheel_radius_ |
|
private |
ros::Time diff_drive_controller::Odometry::timestamp_ |
|
private |
size_t diff_drive_controller::Odometry::velocity_rolling_window_size_ |
|
private |
Rolling mean accumulators for the linar and angular velocities:
Definition at line 203 of file odometry.h.
double diff_drive_controller::Odometry::wheel_separation_ |
|
private |
Wheel kinematic parameters [m]:
Definition at line 194 of file odometry.h.
double diff_drive_controller::Odometry::x_ |
|
private |
double diff_drive_controller::Odometry::y_ |
|
private |
The documentation for this class was generated from the following files: