45 #include <boost/bind.hpp> 49 namespace bacc = boost::accumulators;
58 , wheel_separation_h_(0.0)
60 , rear_wheel_old_pos_(0.0)
61 , velocity_rolling_window_size_(velocity_rolling_window_size)
62 , linear_acc_(
RollingWindow::window_size = velocity_rolling_window_size)
63 , angular_acc_(
RollingWindow::window_size = velocity_rolling_window_size)
64 , integrate_fun_(
boost::bind(&
Odometry::integrateExact, this, _1, _2))
78 const double rear_wheel_cur_pos = rear_wheel_pos *
wheel_radius_;
87 rear_wheel_old_pos_ = rear_wheel_cur_pos;
90 const double linear = rear_wheel_est_vel;
121 const double dt = (time -
timestamp_).toSec();
141 const double direction =
heading_ + angular * 0.5;
144 x_ += linear * cos(direction);
145 y_ += linear * sin(direction);
156 if (fabs(angular) < 1e-6)
161 const double heading_old =
heading_;
162 const double r = linear/angular;
165 y_ += -r * (cos(
heading_) - cos(heading_old));
RollingMeanAcc angular_acc_
void init(const ros::Time &time)
Initialize the odometry.
bacc::tag::rolling_window RollingWindow
Odometry(size_t velocity_rolling_window_size=10)
Constructor Timestamp will get the current time value Value will be set to zero.
size_t velocity_rolling_window_size_
Rolling mean accumulators for the linar and angular velocities:
double rear_wheel_old_pos_
Previous wheel position/state [rad]:
The Odometry class handles odometry readings (2D pose and velocity with related timestamp) ...
bacc::accumulator_set< double, bacc::stats< bacc::tag::rolling_mean > > RollingMeanAcc
Rolling mean accumulator and window:
void integrateRungeKutta2(double linear, double angular)
Integrates the velocities (linear and angular) using 2nd order Runge-Kutta.
void resetAccumulators()
Reset linear and angular accumulators.
void setWheelParams(double wheel_reparation_h, double wheel_radius)
Sets the wheel parameters: radius and separation.
double linear_
Current velocity:
void integrateExact(double linear, double angular)
Integrates the velocities (linear and angular) using exact method.
RollingMeanAcc linear_acc_
void updateOpenLoop(double linear, double angular, const ros::Time &time)
Updates the odometry class with latest velocity command.
ros::Time timestamp_
Current timestamp:
double wheel_separation_h_
Wheel kinematic parameters [m]:
void setVelocityRollingWindowSize(size_t velocity_rolling_window_size)
Velocity rolling window size setter.
bool update(double rear_wheel_pos, double front_steer_pos, const ros::Time &time)
Updates the odometry class with latest wheels position.
IntegrationFunction integrate_fun_
Integration funcion, used to integrate the odometry: