19 #ifndef TRICYCLE_CONTROLLER__ODOMETRY_HPP_
20 #define TRICYCLE_CONTROLLER__ODOMETRY_HPP_
24 #include <rclcpp/duration.hpp>
26 #if RCPPUTILS_VERSION_MAJOR >= 2 && RCPPUTILS_VERSION_MINOR >= 6
27 #include "rcpputils/rolling_mean_accumulator.hpp"
29 #include "rcppmath/rolling_mean_accumulator.hpp"
32 namespace tricycle_controller
37 explicit Odometry(
size_t velocity_rolling_window_size = 10);
39 bool update(
double left_vel,
double right_vel,
const rclcpp::Duration & dt);
40 void updateOpenLoop(
double linear,
double angular,
const rclcpp::Duration & dt);
43 double getX()
const {
return x_; }
44 double getY()
const {
return y_; }
45 double getHeading()
const {
return heading_; }
46 double getLinear()
const {
return linear_; }
47 double getAngular()
const {
return angular_; }
49 void setWheelParams(
double wheel_separation,
double wheel_radius);
50 void setVelocityRollingWindowSize(
size_t velocity_rolling_window_size);
54 #if RCPPUTILS_VERSION_MAJOR >= 2 && RCPPUTILS_VERSION_MINOR >= 6
55 using RollingMeanAccumulator = rcpputils::RollingMeanAccumulator<double>;
57 using RollingMeanAccumulator = rcppmath::RollingMeanAccumulator<double>;
60 void integrateRungeKutta2(
double linear,
double angular);
61 void integrateExact(
double linear,
double angular);
62 void resetAccumulators();
78 size_t velocity_rolling_window_size_;
79 RollingMeanAccumulator linear_accumulator_;
80 RollingMeanAccumulator angular_accumulator_;
Definition: odometry.hpp:35
void updateOpenLoop(double linear, double angular, const rclcpp::Duration &dt)
Definition: odometry.cpp:57