AP_WindVane: add send_wind

This commit is contained in:
Randy Mackay 2018-11-01 14:26:07 +09:00
parent 8a57f63e5d
commit ecd1f8e658
2 changed files with 19 additions and 0 deletions

View File

@ -243,6 +243,22 @@ bool AP_WindVane::start_calibration()
return false;
}
// send mavlink wind message
void AP_WindVane::send_wind(mavlink_channel_t chan)
{
// exit immediately if not enabled
if (!enabled()) {
return;
}
// send wind
mavlink_msg_wind_send(
chan,
wrap_360(degrees(get_absolute_wind_direction_rad())),
get_true_wind_speed(),
0);
}
// read an analog port and calculate the wind direction in earth-frame in radians
// assumes voltage increases as wind vane moves clockwise
float AP_WindVane::read_analog_direction_ef()

View File

@ -67,6 +67,9 @@ public:
// start calibration routine
bool start_calibration();
// send mavlink wind message
void send_wind(mavlink_channel_t chan);
// parameter block
static const struct AP_Param::GroupInfo var_info[];