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

Rover pivot turn fix #8885

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions APMrover2/Rover.h
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ class Rover : public AP_HAL::HAL::Callbacks {
void update_sensor_status_flags(void);

// Steering.cpp
bool use_pivot_steering_at_next_WP(float yaw_error_cd);
bool use_pivot_steering(float yaw_error_cd);
void set_servos(void);

Expand Down
18 changes: 18 additions & 0 deletions APMrover2/Steering.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
#include "Rover.h"

/*
work out if we are going to use pivot steering at next waypoint
*/
bool Rover::use_pivot_steering_at_next_WP(float yaw_error_cd)
{
// check cases where we clearly cannot use pivot steering
if (!g2.motors.have_skid_steering() || g.pivot_turn_angle <= 0) {
return false;
}

// if error is larger than pivot_turn_angle then use pivot steering at next WP
if (fabsf(yaw_error_cd) * 0.01f > g.pivot_turn_angle) {
return true;
}

return false;
}

/*
work out if we are going to use pivot steering
*/
Expand Down
2 changes: 1 addition & 1 deletion APMrover2/mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void Mode::set_desired_location(const struct Location& destination, float next_l
if (is_zero(turn_angle_cd)) {
// if not turning can continue at full speed
_desired_speed_final = _desired_speed;
} else if (rover.use_pivot_steering(turn_angle_cd)) {
} else if (rover.use_pivot_steering_at_next_WP(turn_angle_cd)) {
// pivoting so we will stop
_desired_speed_final = 0.0f;
} else {
Expand Down