Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef ODOMETRY_H_
00043 #define ODOMETRY_H_
00044
00045 #include <ros/time.h>
00046 #include <boost/accumulators/accumulators.hpp>
00047 #include <boost/accumulators/statistics/stats.hpp>
00048 #include <boost/accumulators/statistics/rolling_mean.hpp>
00049 #include <boost/function.hpp>
00050
00051 namespace mecanum_drive_controller
00052 {
00053
00054 namespace bacc = boost::accumulators;
00055
00060 class Odometry
00061 {
00062 public:
00063
00065 typedef boost::function<void(double, double, double)> IntegrationFunction;
00066
00073 Odometry(size_t velocity_rolling_window_size = 10);
00074
00079 void init(const ros::Time &time);
00080
00090 bool update(double wheel0_vel, double wheel1_vel, double wheel2_vel, double wheel3_vel, const ros::Time &time);
00091
00098 void updateOpenLoop(double linearX, double linearY, double angular, const ros::Time &time);
00099
00104 double getHeading() const
00105 {
00106 return heading_;
00107 }
00108
00113 double getX() const
00114 {
00115 return x_;
00116 }
00117
00122 double getY() const
00123 {
00124 return y_;
00125 }
00126
00131 double getLinearX() const
00132 {
00133 return linearX_;
00134 }
00135
00140 double getLinearY() const
00141 {
00142 return linearY_;
00143 }
00144
00149 double getAngular() const
00150 {
00151 return angular_;
00152 }
00153
00159 void setWheelsParams(double wheels_k, double wheels_radius);
00160
00161 private:
00162
00164 typedef bacc::accumulator_set<double, bacc::stats<bacc::tag::rolling_mean> > RollingMeanAcc;
00165 typedef bacc::tag::rolling_window RollingWindow;
00166
00173 void integrateExact(double linearX, double linearY, double angular);
00174
00176 ros::Time timestamp_;
00177
00179 double x_;
00180 double y_;
00181 double heading_;
00182
00184 double linearX_;
00185 double linearY_;
00186 double angular_;
00187
00189 double wheels_k_;
00190 double wheels_radius_;
00191
00193 size_t velocity_rolling_window_size_;
00194 RollingMeanAcc linearX_acc_;
00195 RollingMeanAcc linearY_acc_;
00196 RollingMeanAcc angular_acc_;
00197
00199 IntegrationFunction integrate_fun_;
00200 };
00201
00202 }
00203
00204 #endif