SITL: add Ping2020 simulated device

This commit is contained in:
Tom Pittenger 2016-08-16 14:16:03 -07:00
parent 25136ea15a
commit 19ac9bce48
4 changed files with 24 additions and 0 deletions

View File

@ -238,6 +238,27 @@ void ADSB::send_report(void)
}
}
// ADSB_transceiever is enabled, send the status report.
if (_sitl->adsb_tx && now - last_tx_report_ms > 1000) {
last_tx_report_ms = now;
mavlink_status_t *chan0_status = mavlink_get_channel_status(MAVLINK_COMM_0);
uint8_t saved_seq = chan0_status->current_tx_seq;
chan0_status->current_tx_seq = mavlink.seq;
const mavlink_uavionix_adsb_transceiver_health_report_t health_report = {UAVIONIX_ADSB_RF_HEALTH_OK};
len = mavlink_msg_uavionix_adsb_transceiver_health_report_encode(vehicle_system_id,
MAV_COMP_ID_ADSB,
&msg, &health_report);
chan0_status->current_tx_seq = saved_seq;
uint8_t msgbuf[len];
len = mavlink_msg_to_send_buffer(msgbuf, &msg);
if (len > 0) {
mav_socket.send(msgbuf, len);
::printf("ADSBsim send tx health packet");
}
}
}
} // namespace SITL

View File

@ -60,6 +60,7 @@ private:
const float reporting_period_ms = 1000;
uint32_t last_report_us = 0;
uint32_t last_update_us = 0;
uint32_t last_tx_report_ms = 0;
uint32_t last_heartbeat_ms = 0;
bool seen_heartbeat = false;

View File

@ -82,6 +82,7 @@ const AP_Param::GroupInfo SITL::var_info[] = {
AP_GROUPINFO("MAG_ALY", 48, SITL, mag_anomaly_ned, 0),
AP_GROUPINFO("MAG_ALY_HGT", 49, SITL, mag_anomaly_hgt, 1.0f),
AP_GROUPINFO("PIN_MASK", 50, SITL, pin_mask, 0),
AP_GROUPINFO("ADSB_TX", 51, SITL, adsb_tx, 0),
AP_GROUPEND
};

View File

@ -121,6 +121,7 @@ public:
AP_Int16 adsb_plane_count;
AP_Float adsb_radius_m;
AP_Float adsb_altitude_m;
AP_Int8 adsb_tx;
// Earth magnetic field anomaly
AP_Vector3f mag_anomaly_ned; // NED anomaly vector at ground level (mGauss)