Plane: added RALLY_LIMIT_KM
this will prevent an embarressing use of a rally point from the wrong airfield
This commit is contained in:
parent
4c32f4dbdb
commit
5bf1463e7a
@ -96,6 +96,7 @@ public:
|
||||
k_param_waypoint_max_radius,
|
||||
k_param_ground_steer_alt,
|
||||
k_param_ground_steer_dps,
|
||||
k_param_rally_limit_km,
|
||||
|
||||
// 110: Telemetry control
|
||||
//
|
||||
@ -316,6 +317,7 @@ public:
|
||||
#endif
|
||||
|
||||
AP_Int8 rally_total;
|
||||
AP_Float rally_limit_km;
|
||||
|
||||
// Fly-by-wire
|
||||
//
|
||||
|
@ -265,6 +265,14 @@ const AP_Param::Info var_info[] PROGMEM = {
|
||||
// @User: Advanced
|
||||
GSCALAR(rally_total, "RALLY_TOTAL", 0),
|
||||
|
||||
// @Param: RALLY_LIMIT_KM
|
||||
// @DisplayName: Rally Limit
|
||||
// @Description: Maximum distance to rally point. If the closest rally point is more than this number of kilometers from the current position and the home location is closer than any of the rally points from the current position then do RTL to home rather than to the closest rally point. This prevents a leftover rally point from a different airfield being used accidentally. If this is set to 0 then the closest rally point is always used.
|
||||
// @User: Advanced
|
||||
// @Units: kilometers
|
||||
// @Increment: 0.1
|
||||
GSCALAR(rally_limit_km, "RALLY_LIMIT_KM", 5),
|
||||
|
||||
// @Param: ARSPD_FBW_MIN
|
||||
// @DisplayName: Fly By Wire Minimum Airspeed
|
||||
// @Description: Airspeed corresponding to minimum throttle in auto throttle modes (FBWB, CRUISE, AUTO, GUIDED, LOITER, CIRCLE and RTL). This is a calibrated (apparent) airspeed.
|
||||
|
@ -53,6 +53,12 @@ static bool find_best_rally_point(const Location &myloc, const Location &homeloc
|
||||
}
|
||||
}
|
||||
|
||||
if (min_dis > g.rally_limit_km*1000.0f &&
|
||||
get_distance(myloc, homeloc) < min_dis) {
|
||||
// return false, which makes home be used instead
|
||||
return false;
|
||||
}
|
||||
|
||||
return min_dis >= 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user