Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/ArduPilotPlugin.hh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ class ArduPilotPluginPrivate;
/// <anemometer> scoped name for the wind sensor
/// <connectionTimeoutMaxCount> timeout before giving up on
/// controller synchronization
/// <lock_step> set true to enforce lock-step simulation
/// <no_time_sync> set true to prevent SITL from trying to sync
/// with wall-time
/// <have_32_channels> set true if 32 channels are enabled
///
class GZ_SIM_VISIBLE ArduPilotPlugin:
Expand Down
1 change: 1 addition & 0 deletions models/iris_with_ardupilot/model.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@
<fdm_port_in>9002</fdm_port_in>
<connectionTimeoutMaxCount>5</connectionTimeoutMaxCount>
<lock_step>1</lock_step>
<no_time_sync>1</no_time_sync>
<have_32_channels>0</have_32_channels>

<!-- Frame conventions
Expand Down
1 change: 1 addition & 0 deletions models/iris_with_gimbal/model.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
<fdm_port_in>9002</fdm_port_in>
<connectionTimeoutMaxCount>5</connectionTimeoutMaxCount>
<lock_step>1</lock_step>
<no_time_sync>1</no_time_sync>

<!-- Frame conventions
Require by ArduPilot: change model and gazebo from XYZ to XY-Z coordinates
Expand Down
1 change: 1 addition & 0 deletions models/zephyr_with_ardupilot/model.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
<fdm_port_in>9002</fdm_port_in>
<connectionTimeoutMaxCount>5</connectionTimeoutMaxCount>
<lock_step>1</lock_step>
<no_time_sync>1</no_time_sync>

<!-- Frame conventions
modelXYZToAirplaneXForwardZDown:
Expand Down
1 change: 1 addition & 0 deletions models/zephyr_with_parachute/model.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
<fdm_port_in>9002</fdm_port_in>
<connectionTimeoutMaxCount>5</connectionTimeoutMaxCount>
<lock_step>1</lock_step>
<no_time_sync>1</no_time_sync>

<!-- Frame conventions
modelXYZToAirplaneXForwardZDown:
Expand Down
17 changes: 16 additions & 1 deletion src/ArduPilotPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ class gz::sim::systems::ArduPilotPluginPrivate
/// \brief Set true to enforce lock-step simulation
public: bool isLockStep{false};

/// \brief Set true to prevent SITL from trying to sync with wall-time
public: bool isNoTimeSync{true};

/// \brief Set true if have 32 servo channels
public: bool have32Channels{false};

Expand Down Expand Up @@ -510,7 +513,11 @@ void gz::sim::systems::ArduPilotPlugin::Configure(
this->dataPtr->isLockStep =
sdfClone->Get("lock_step", this->dataPtr->isLockStep).first;

this->dataPtr->have32Channels =
// Prevent SITL attempting time-sync (has default: true)
this->dataPtr->isNoTimeSync =
sdfClone->Get("no_time_sync", this->dataPtr->isNoTimeSync).first;

this->dataPtr->have32Channels =
sdfClone->Get("have_32_channels", false).first;

// Add the signal handler
Expand Down Expand Up @@ -2000,6 +2007,14 @@ void gz::sim::systems::ArduPilotPlugin::CreateStateJSON(
writer.EndObject();
}

// Set no time sync
writer.Key("no_time_sync");
writer.Bool(this->dataPtr->isNoTimeSync);

// Set no lockstep
writer.Key("no_lockstep");
writer.Bool(!this->dataPtr->isLockStep);

writer.EndObject();

// get JSON
Expand Down
1 change: 1 addition & 0 deletions tests/worlds/test_anemometer.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@
<fdm_port_in>9002</fdm_port_in>
<connectionTimeoutMaxCount>5</connectionTimeoutMaxCount>
<lock_step>1</lock_step>
<no_time_sync>1</no_time_sync>
<gazeboXYZToNED degrees="true">0 0 0 180 0 90</gazeboXYZToNED>
<modelXYZToAirplaneXForwardZDown degrees="true">0 0 0 180 0 0</modelXYZToAirplaneXForwardZDown>
<imuName>imu_link::imu_sensor</imuName>
Expand Down
Loading