Skip to content
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

fix(steering-odometry): handle infinite turning radius properly #1285

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions steering_controllers_library/src/steering_odometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,17 @@ double SteeringOdometry::get_linear_velocity_double_traction_axle(
const double steer_pos)
{
double turning_radius = wheelbase_ / std::tan(steer_pos);
double vel_wheel_r = right_traction_wheel_vel * wheel_radius_;
double vel_wheel_l = left_traction_wheel_vel * wheel_radius_;
reinzor marked this conversation as resolved.
Show resolved Hide resolved

if (std::isinf(turning_radius))
bmagyar marked this conversation as resolved.
Show resolved Hide resolved
{
return (vel_wheel_r + vel_wheel_l) * 0.5;
}

// overdetermined, we take the average
double vel_r = right_traction_wheel_vel * wheel_radius_ * turning_radius /
(turning_radius + wheel_track_ * 0.5);
double vel_l = left_traction_wheel_vel * wheel_radius_ * turning_radius /
(turning_radius - wheel_track_ * 0.5);
double vel_r = vel_wheel_r * turning_radius / (turning_radius + wheel_track_ * 0.5);
double vel_l = vel_wheel_l * turning_radius / (turning_radius - wheel_track_ * 0.5);
reinzor marked this conversation as resolved.
Show resolved Hide resolved
return (vel_r + vel_l) * 0.5;
}

Expand Down
Loading