From 2af685443766a9347ce8f0a8993b1e9b2c28dee6 Mon Sep 17 00:00:00 2001 From: Iampete1 Date: Sat, 10 Apr 2021 21:19:52 +0100 Subject: [PATCH] Rover: move wind logging to windvane --- Rover/Log.cpp | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/Rover/Log.cpp b/Rover/Log.cpp index 2c8b068e6e..af3b63a15a 100644 --- a/Rover/Log.cpp +++ b/Rover/Log.cpp @@ -140,36 +140,27 @@ void Rover::Log_Write_Sail() return; } - // get wind direction - float wind_dir_abs = logger.quiet_nanf(); - float wind_dir_rel = logger.quiet_nanf(); - float wind_speed_true = logger.quiet_nanf(); - float wind_speed_apparent = logger.quiet_nanf(); + float wind_dir_tack = logger.quiet_nanf(); + uint8_t current_tack = 0; if (rover.g2.windvane.enabled()) { - wind_dir_abs = degrees(g2.windvane.get_true_wind_direction_rad()); - wind_dir_rel = degrees(g2.windvane.get_apparent_wind_direction_rad()); - wind_speed_true = g2.windvane.get_true_wind_speed(); - wind_speed_apparent = g2.windvane.get_apparent_wind_speed(); + wind_dir_tack = degrees(g2.windvane.get_tack_threshold_wind_dir_rad()); + current_tack = uint8_t(g2.windvane.get_current_tack()); } // @LoggerMessage: SAIL // @Description: Sailboat information // @Field: TimeUS: Time since system startup -// @Field: WndDrTru: True wind direction -// @Field: WndDrApp: Apparent wind direction, in body-frame -// @Field: WndSpdTru: True wind speed -// @Field: WndSpdApp: Apparent wind Speed -// @Field: MainOut: Normalized mainsail output +// @Field: Tack: Current tack, 0 = port, 1 = starboard +// @Field: TackThr: Apparent wind angle used for tack threshold +// @Field: MainOut: Normalized mainsail output // @Field: WingOut: Normalized wingsail output // @Field: VMG: Velocity made good (speed at which vehicle is making progress directly towards destination) - logger.Write("SAIL", "TimeUS,WndDrTru,WndDrApp,WndSpdTru,WndSpdApp,MainOut,WingOut,VMG", - "shhnn%%n", "F0000000", "Qfffffff", + logger.Write("SAIL", "TimeUS,Tack,TackThr,MainOut,WingOut,VMG", + "s-d%%n", "F00000", "QBffff", AP_HAL::micros64(), - (double)wind_dir_abs, - (double)wind_dir_rel, - (double)wind_speed_true, - (double)wind_speed_apparent, + current_tack, + (double)wind_dir_tack, (double)g2.motors.get_mainsail(), (double)g2.motors.get_wingsail(), (double)g2.sailboat.get_VMG());