ArduPilot / ardupilot_gazebo

Plugins and models for vehicle simulation in Gazebo Sim with ArduPilot SITL controllers
GNU Lesser General Public License v3.0
93 stars 85 forks source link

Enable 32 servos #49

Closed srmainwaring closed 1 year ago

srmainwaring commented 1 year ago

Enable 32 servos when the parameter SERVO_32_ENABLE is set.

This PR is the companion to https://github.com/ArduPilot/ardupilot/pull/23239 for the ArduPilot gazebo plugin.

Details

Testing

Testing with iris_runway.sdf world:

Gazebo

gz sim -v4 -r iris_runway.sdf

SITL

sim_vehicle.py -D -v ArduCopter -f gazebo-iris --model JSON  --console

Enable 32 servos

Enable 32 servos in MAVProxy:

servo-32-enable-mavproxy

Magic number for 32 channel servo packet received:

servo-32-enable-gz

Update plugin parameter and restart and the connection is restored.

<plugin name="ArduPilotPlugin"
  filename="libArduPilotPlugin">
  <!-- Port settings -->
  <fdm_addr>127.0.0.1</fdm_addr>
  <fdm_port_in>9002</fdm_port_in>
  <connectionTimeoutMaxCount>5</connectionTimeoutMaxCount>
  <lock_step>1</lock_step>
  <have_32_channels>1</have_32_channels>
  ...
</plugin>

Disable 32 servos

servo-32-disable-gz

Magic number for 16 channel servo packet received:

servo-32-disable-mavproxy

Update plugin parameter and restart and the connection is restored.

<plugin name="ArduPilotPlugin"
  filename="libArduPilotPlugin">
  <!-- Port settings -->
  <fdm_addr>127.0.0.1</fdm_addr>
  <fdm_port_in>9002</fdm_port_in>
  <connectionTimeoutMaxCount>5</connectionTimeoutMaxCount>
  <lock_step>1</lock_step>
  <have_32_channels>0</have_32_channels>
  ...
</plugin>
srmainwaring commented 1 year ago

Tested during review of https://github.com/ArduPilot/SITL_Models/pull/96.