File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
include/mecanum_drive_controller Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 2727#ifndef MECANUM_DRIVE_CONTROLLER__ODOMETRY_HPP_
2828#define MECANUM_DRIVE_CONTROLLER__ODOMETRY_HPP_
2929
30- #include < cmath>
31-
3230#include " rclcpp/time.hpp"
3331#include " rcpputils/rolling_mean_accumulator.hpp"
3432
Original file line number Diff line number Diff line change 2121// Based on: https://ecam-eurobot.github.io/Tutorials/mechanical/mecanum.html
2222// Author: Maciej Stępień
2323
24+ #include < cmath>
25+
2426#include " mecanum_drive_controller/odometry.hpp"
2527
2628namespace mecanum_drive_controller
@@ -94,7 +96,11 @@ bool Odometry::updateFromVelocity(
9496 const rclcpp::Time & time)
9597{
9698 const double dt = time.seconds () - timestamp_.seconds ();
97-
99+ if (dt < 0.0001 )
100+ {
101+ return false ; // Interval too small to integrate with
102+ }
103+ // Compute linear and angular diff:
98104 const double linear_x = (front_left_vel + front_right_vel + rear_left_vel + rear_right_vel) / 4 .;
99105 const double linear_y = (-front_left_vel + front_right_vel + rear_left_vel - rear_right_vel) / 4 .;
100106 const double angular = (-front_left_vel + front_right_vel - rear_left_vel + rear_right_vel) /
You can’t perform that action at this time.
0 commit comments