mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-18 06:38:29 -04:00
AC_Avoid: move check for zero-desired-velocity into adjust_velocity_polygon
This is the method which divides by the length of this vector; the check belongs in here.
This commit is contained in:
parent
3177d24429
commit
cd6e5b48a1
@ -356,11 +356,6 @@ void AC_Avoid::adjust_velocity_polygon_fence(float kP, float accel_cmss, Vector2
|
||||
return;
|
||||
}
|
||||
|
||||
// exit immediately if no desired velocity
|
||||
if (desired_vel_cms.is_zero()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// get polygon boundary
|
||||
uint16_t num_points;
|
||||
const Vector2f* boundary = _fence.get_boundary_points(num_points);
|
||||
@ -381,11 +376,6 @@ void AC_Avoid::adjust_velocity_beacon_fence(float kP, float accel_cmss, Vector2f
|
||||
return;
|
||||
}
|
||||
|
||||
// exit immediately if no desired velocity
|
||||
if (desired_vel_cms.is_zero()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// get boundary from beacons
|
||||
uint16_t num_points;
|
||||
const Vector2f* boundary = _beacon->get_boundary_points(num_points);
|
||||
@ -418,11 +408,6 @@ void AC_Avoid::adjust_velocity_proximity(float kP, float accel_cmss, Vector2f &d
|
||||
return;
|
||||
}
|
||||
|
||||
// exit immediately if no desired velocity
|
||||
if (desired_vel_cms.is_zero()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// get boundary from proximity sensor
|
||||
uint16_t num_points;
|
||||
const Vector2f *boundary = _proximity.get_boundary_points(num_points);
|
||||
@ -439,6 +424,11 @@ void AC_Avoid::adjust_velocity_polygon(float kP, float accel_cmss, Vector2f &des
|
||||
return;
|
||||
}
|
||||
|
||||
// exit immediately if no desired velocity
|
||||
if (desired_vel_cms.is_zero()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const AP_AHRS &_ahrs = AP::ahrs();
|
||||
|
||||
// do not adjust velocity if vehicle is outside the polygon fence
|
||||
|
Loading…
Reference in New Issue
Block a user