-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect odometry when turning vehicle with bicycle steering controller. #789
Comments
I tried to understand the code, but failed..
@reydelsol would you like to help to sort that stuff out, ideally including simple tests for the functions? |
or maybe @petkovich is around and can clarify this? |
I am also confused so I started studying the steering libraries, and I'll leave here what I find in hopes that this might be useful in expediting the process of implementing the proposal here:
Lines 144 to 146 in f62fc3a
should Also, in ros2_controllers/steering_controllers_library/src/steering_controllers_library.cpp Lines 229 to 232 in f62fc3a
but in ros2_controllers/steering_controllers_library/src/steering_controllers_library.cpp Lines 265 to 268 in f62fc3a
Am I missing something or is this a bug?
ros2_controllers/steering_controllers_library/src/steering_controllers_library.cpp Lines 411 to 418 in f62fc3a
More investigation is needed to fully figure out the structure of the code before the proposal can be implemented, but I'm afraid I don't have the time to continue right now. |
This should be fixed with #1150 et al. Please reopen if this still doesn't work out. |
Describe the bug
Driving a robot with the bicycle steering controller produces incorrect odometry when turning.
To Reproduce
This was found during development of a hardware interface for a vehicle modeled with a bicycle controller. A minimal example is not provided, but appears to demonstrate similar behavior to #675. The bug is believed to stem from a mismatch of units in steering_odometry.cpp and may affect other ROS2 controllers:
The function update_odometry calls an integrate_exact function with inputs of linear change and angular velocity,
SteeringOdometry::integrate_exact(linear_velocity * dt, angular);
a. This differs from a call to the same function in update_open_loop which passes linear and angular change,
SteeringOdometry::integrate_exact(linear * dt, angular * dt);
b. The integrate_exact function calculates odometry’s heading_, x_, and y_ from a division of linear change and angular velocity. The heading_ angle is incremented by units of angular velocity. For a controller update rate of 100 Hz, dt = .01, the heading would change 100x faster than the reality.
c. This issue was not found for a linear-only change, as integrate_exact calls integrate_runge_kutta_2 for near-zero angular change.
The function update_from_velocity appears to calculate the angular velocity.
a. The equation matches that of theta_dot for a bicycle kinematic model, 𝜃_dot = 𝑣 / (L / tan(𝛿)) = 𝑣 * tan(𝛿) / L
b. The variable is named, “angular,” unlike the linear_velocity counterpart in this function. The unit 1/s appears to be lost as it is passed to integrate_exact() via update_odometry().
c. Note that other calls to update_odometry in this file also pass “angular” to update_odometry, so the issue may affect other models.
Expected behavior
It is expected that the odometry would update at a slower rate and better represent the position of the robot’s dead reckoning. The odometry reported for our vehicle had it spin 5+ times in a circle within seconds (see screenshots).
Screenshots
The odometry appears to loop multiple times in 10 seconds, forming a circle:
The expected behavior for a 20 degree steer would be more of a slope away from the forward direction:
Environment (please complete the following information):
Additional context
A comment on this closed issue may also be relevant, #611.
The text was updated successfully, but these errors were encountered: