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;
}
// 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: 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());