Rover: rename nav_enabled to tack_enabled
tack_enabled is more precise than nav_enabled so it describes the feature more accurately
This commit is contained in:
parent
bf7432cf2e
commit
e023400fda
@ -25,7 +25,7 @@ void ModeLoiter::update()
|
||||
// if within loiter radius slew desired speed towards zero and use existing desired heading
|
||||
if (_distance_to_destination <= g2.loit_radius) {
|
||||
// sailboats should not stop unless motoring
|
||||
const float desired_speed_within_radius = rover.g2.sailboat.nav_enabled() ? 0.1f : 0.0f;
|
||||
const float desired_speed_within_radius = rover.g2.sailboat.tack_enabled() ? 0.1f : 0.0f;
|
||||
_desired_speed = attitude_control.get_desired_speed_accel_limited(desired_speed_within_radius, rover.G_Dt);
|
||||
} else {
|
||||
// P controller with hard-coded gain to convert distance to desired speed
|
||||
|
@ -97,7 +97,7 @@ Sailboat::Sailboat()
|
||||
}
|
||||
|
||||
// Should we use sailboat navigation?
|
||||
bool Sailboat::nav_enabled() const
|
||||
bool Sailboat::tack_enabled() const
|
||||
{
|
||||
return (enable == 2) &&
|
||||
(throttle_state != Sailboat_Throttle::FORCE_MOTOR) &&
|
||||
@ -111,7 +111,7 @@ void Sailboat::init()
|
||||
rover.g2.crash_angle.set_default(0);
|
||||
}
|
||||
|
||||
if (nav_enabled()) {
|
||||
if (tack_enabled()) {
|
||||
rover.g2.loit_type.set_default(1);
|
||||
rover.g2.loit_radius.set_default(5);
|
||||
rover.g2.wp_nav.set_default_overshoot(10);
|
||||
@ -224,7 +224,7 @@ float Sailboat::get_VMG() const
|
||||
// handle user initiated tack while in acro mode
|
||||
void Sailboat::handle_tack_request_acro()
|
||||
{
|
||||
if (!nav_enabled() || currently_tacking) {
|
||||
if (!tack_enabled() || currently_tacking) {
|
||||
return;
|
||||
}
|
||||
// set tacking heading target to the current angle relative to the true wind but on the new tack
|
||||
@ -243,7 +243,7 @@ float Sailboat::get_tack_heading_rad() const
|
||||
// handle user initiated tack while in autonomous modes (Auto, Guided, RTL, SmartRTL, etc)
|
||||
void Sailboat::handle_tack_request_auto()
|
||||
{
|
||||
if (!nav_enabled() || currently_tacking) {
|
||||
if (!tack_enabled() || currently_tacking) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -262,14 +262,14 @@ void Sailboat::clear_tack()
|
||||
// returns true if boat is currently tacking
|
||||
bool Sailboat::tacking() const
|
||||
{
|
||||
return nav_enabled() && currently_tacking;
|
||||
return tack_enabled() && currently_tacking;
|
||||
}
|
||||
|
||||
// returns true if sailboat should take a indirect navigation route to go upwind
|
||||
// desired_heading should be in centi-degrees
|
||||
bool Sailboat::use_indirect_route(float desired_heading_cd) const
|
||||
{
|
||||
if (!nav_enabled()) {
|
||||
if (!tack_enabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ bool Sailboat::use_indirect_route(float desired_heading_cd) const
|
||||
// this function assumes the caller has already checked sailboat_use_indirect_route(desired_heading_cd) returned true
|
||||
float Sailboat::calc_heading(float desired_heading_cd)
|
||||
{
|
||||
if (!nav_enabled()) {
|
||||
if (!tack_enabled()) {
|
||||
return desired_heading_cd;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
bool sail_enabled() const { return enable > 0;}
|
||||
|
||||
// true if sailboat navigation (aka tacking) is enabled
|
||||
bool nav_enabled() const;
|
||||
bool tack_enabled() const;
|
||||
|
||||
// setup
|
||||
void init();
|
||||
|
Loading…
Reference in New Issue
Block a user