mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
Rover: Added reversing loiter_type parameter
This commit is contained in:
parent
d8445928d1
commit
e7c2528654
@ -511,7 +511,7 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = {
|
||||
// @Param: LOIT_TYPE
|
||||
// @DisplayName: Loiter type
|
||||
// @Description: Loiter behaviour when moving to the target point
|
||||
// @Values: 0:Forward or reverse to target point,1:Always face bow towards target point
|
||||
// @Values: 0:Forward or reverse to target point,1:Always face bow towards target point,2:Always face stern towards target point
|
||||
// @User: Standard
|
||||
AP_GROUPINFO("LOIT_TYPE", 25, ParametersG2, loit_type, 0),
|
||||
|
||||
|
@ -44,7 +44,7 @@ void ModeLoiter::update()
|
||||
_desired_yaw_cd = rover.current_loc.get_bearing_to(_destination);
|
||||
float yaw_error_cd = wrap_180_cd(_desired_yaw_cd - ahrs.yaw_sensor);
|
||||
// if destination is behind vehicle, reverse towards it
|
||||
if (fabsf(yaw_error_cd) > 9000 && g2.loit_type == 0) {
|
||||
if ((fabsf(yaw_error_cd) > 9000 && g2.loit_type == 0) || g2.loit_type == 2){
|
||||
_desired_yaw_cd = wrap_180_cd(_desired_yaw_cd + 18000);
|
||||
yaw_error_cd = wrap_180_cd(_desired_yaw_cd - ahrs.yaw_sensor);
|
||||
_desired_speed = -_desired_speed;
|
||||
|
Loading…
Reference in New Issue
Block a user