Rover: move wind logging to windvane

This commit is contained in:
Iampete1 2021-04-10 21:19:52 +01:00 committed by Peter Barker
parent fc426e01c2
commit 2af6854437

View File

@ -140,36 +140,27 @@ void Rover::Log_Write_Sail()
return; return;
} }
// get wind direction float wind_dir_tack = logger.quiet_nanf();
float wind_dir_abs = logger.quiet_nanf(); uint8_t current_tack = 0;
float wind_dir_rel = logger.quiet_nanf();
float wind_speed_true = logger.quiet_nanf();
float wind_speed_apparent = logger.quiet_nanf();
if (rover.g2.windvane.enabled()) { if (rover.g2.windvane.enabled()) {
wind_dir_abs = degrees(g2.windvane.get_true_wind_direction_rad()); wind_dir_tack = degrees(g2.windvane.get_tack_threshold_wind_dir_rad());
wind_dir_rel = degrees(g2.windvane.get_apparent_wind_direction_rad()); current_tack = uint8_t(g2.windvane.get_current_tack());
wind_speed_true = g2.windvane.get_true_wind_speed();
wind_speed_apparent = g2.windvane.get_apparent_wind_speed();
} }
// @LoggerMessage: SAIL // @LoggerMessage: SAIL
// @Description: Sailboat information // @Description: Sailboat information
// @Field: TimeUS: Time since system startup // @Field: TimeUS: Time since system startup
// @Field: WndDrTru: True wind direction // @Field: Tack: Current tack, 0 = port, 1 = starboard
// @Field: WndDrApp: Apparent wind direction, in body-frame // @Field: TackThr: Apparent wind angle used for tack threshold
// @Field: WndSpdTru: True wind speed // @Field: MainOut: Normalized mainsail output
// @Field: WndSpdApp: Apparent wind Speed
// @Field: MainOut: Normalized mainsail output
// @Field: WingOut: Normalized wingsail output // @Field: WingOut: Normalized wingsail output
// @Field: VMG: Velocity made good (speed at which vehicle is making progress directly towards destination) // @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", logger.Write("SAIL", "TimeUS,Tack,TackThr,MainOut,WingOut,VMG",
"shhnn%%n", "F0000000", "Qfffffff", "s-d%%n", "F00000", "QBffff",
AP_HAL::micros64(), AP_HAL::micros64(),
(double)wind_dir_abs, current_tack,
(double)wind_dir_rel, (double)wind_dir_tack,
(double)wind_speed_true,
(double)wind_speed_apparent,
(double)g2.motors.get_mainsail(), (double)g2.motors.get_mainsail(),
(double)g2.motors.get_wingsail(), (double)g2.motors.get_wingsail(),
(double)g2.sailboat.get_VMG()); (double)g2.sailboat.get_VMG());