Skip to content

Commit

Permalink
SITL: allow disabling MAVLink simstate messages
Browse files Browse the repository at this point in the history
  • Loading branch information
IamPete1 committed Apr 2, 2024
1 parent 0324ca2 commit a0bf577
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libraries/SITL/SITL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,11 @@ const Location post_origin {
/* report SITL state via MAVLink SIMSTATE*/
void SIM::simstate_send(mavlink_channel_t chan) const
{
if (stop_MAVLink_sim_state) {
// Sim only MAVLink messages disabled to give more relaistic data rates
return;
}

float yaw;

// convert to same conventions as DCM
Expand All @@ -1220,6 +1225,11 @@ void SIM::simstate_send(mavlink_channel_t chan) const
/* report SITL state via MAVLink SIM_STATE */
void SIM::sim_state_send(mavlink_channel_t chan) const
{
if (stop_MAVLink_sim_state) {
// Sim only MAVLink messages disabled to give more relaistic data rates
return;
}

// convert to same conventions as DCM
float yaw = state.yawDeg;
if (yaw > 180) {
Expand Down
5 changes: 5 additions & 0 deletions libraries/SITL/SITL.h
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,11 @@ class SIM {
AP_Int16 osd_rows;
AP_Int16 osd_columns;
#endif

// Allow inhibiting of SITL only sim state messages over MAVLink
// This gives more realistic data rates for testing links
void set_stop_MAVLink_sim_state() { stop_MAVLink_sim_state = true; }
bool stop_MAVLink_sim_state;
};

} // namespace SITL
Expand Down

0 comments on commit a0bf577

Please sign in to comment.