Skip to content

Commit b4d79ab

Browse files
Check dt in updateFromVelocity (backport #1481) (#1486)
Co-authored-by: Tony Najjar <tony.najjar.1997@gmail.com>
1 parent bbb2ff5 commit b4d79ab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

diff_drive_controller/src/odometry.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ bool Odometry::update(double left_pos, double right_pos, const rclcpp::Time & ti
7474
bool Odometry::updateFromVelocity(double left_vel, double right_vel, const rclcpp::Time & time)
7575
{
7676
const double dt = time.seconds() - timestamp_.seconds();
77-
77+
if (dt < 0.0001)
78+
{
79+
return false; // Interval too small to integrate with
80+
}
7881
// Compute linear and angular diff:
7982
const double linear = (left_vel + right_vel) * 0.5;
8083
// Now there is a bug about scout angular velocity

0 commit comments

Comments
 (0)