From e023400fdaf6f435ca94cdb6ef24481a162fd733 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Wed, 21 Aug 2019 15:05:03 +0900 Subject: [PATCH] Rover: rename nav_enabled to tack_enabled tack_enabled is more precise than nav_enabled so it describes the feature more accurately --- APMrover2/mode_loiter.cpp | 2 +- APMrover2/sailboat.cpp | 14 +++++++------- APMrover2/sailboat.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/APMrover2/mode_loiter.cpp b/APMrover2/mode_loiter.cpp index 4bc89fcf40..b26080dcf7 100644 --- a/APMrover2/mode_loiter.cpp +++ b/APMrover2/mode_loiter.cpp @@ -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 diff --git a/APMrover2/sailboat.cpp b/APMrover2/sailboat.cpp index 075bccd318..01f50b3ba8 100644 --- a/APMrover2/sailboat.cpp +++ b/APMrover2/sailboat.cpp @@ -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; } diff --git a/APMrover2/sailboat.h b/APMrover2/sailboat.h index 78d347995f..38f3ad17ce 100644 --- a/APMrover2/sailboat.h +++ b/APMrover2/sailboat.h @@ -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();