Skip to content

Commit b491ba0

Browse files
tonynajjarmamueluth
authored andcommitted
Check dt in updateFromVelocity (ros-controls#1481)
Signed-off-by: Tony Najjar <tony.najjar.1997@gmail.com>
1 parent 3d43b6f commit b491ba0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

diff_drive_controller/src/odometry.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ bool Odometry::update(double left_pos, double right_pos, const rclcpp::Time & ti
7676
bool Odometry::updateFromVelocity(double left_vel, double right_vel, const rclcpp::Time & time)
7777
{
7878
const double dt = time.seconds() - timestamp_.seconds();
79-
79+
if (dt < 0.0001)
80+
{
81+
return false; // Interval too small to integrate with
82+
}
8083
// Compute linear and angular diff:
8184
const double linear = (left_vel + right_vel) * 0.5;
8285
// Now there is a bug about scout angular velocity

0 commit comments

Comments
 (0)