Skip to content

Rover: Better handling of stopped leader in Follow mode #30012

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
11 changes: 9 additions & 2 deletions Rover/mode_follow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,15 @@ void ModeFollow::update()
desired_velocity_ne.x = vel_of_target.x + (dist_vec_offs.x * kp);
desired_velocity_ne.y = vel_of_target.y + (dist_vec_offs.y * kp);

// if desired velocity is zero stop vehicle
if (is_zero(desired_velocity_ne.x) && is_zero(desired_velocity_ne.y)) {
// if the desired velocity is less than 3cm/sec, stop vehicle
if (desired_velocity_ne.length() < 0.03f) {
_reached_destination = true;
stop_vehicle();
return;
}

//if the target vehicle velocity is less than 3cm/sec and the distance to the target vehicle is less than the turn radius, stop vehicle
if (vel_of_target.length() < 0.03f && dist_vec_offs.length() < g2.turn_radius) {
_reached_destination = true;
stop_vehicle();
return;
Expand Down
Loading