ArduSub SITL sends pwm: [1000, ...] for ~500 frames

Hello: I am working working with the Ignition Gazebo variant of ardupilot_gazebo adding support for the new Buoyancy, Hydrodynamics and Thruster plugins.

I have it working in SITL – but the startup is a bit rough. The first ~500 frames appearing on port 9002 have these values:

[1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000]

After ~500 or so frames they suddenly switch to the expected values:

[1500, 1500, 1500, 1500, 1500, 1500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

What this means is that the sub goes nuts for a few seconds until the pwm values land at 1500. My workaround for now is to ignore any packets where the pwm values are <= servo_min (1100).

Is this a bug in ArduSub, or some parameter that I can tweak? Or perhaps it’s just a known behavior that doesn’t really affect any other system.


P.S. – I uploaded the (very rough) and bluerov2/model.sdf files here: GitHub - clydemcqueen/bluerov2_ignition: BlueROV2 model for Ignition Gazebo

Hi @clyde,

I’m not sure if that’s known behaviour, but given the results it could have it’s at least undesirable. I’ve passed it on to the lead ArduSub dev and will see what they say :slight_smile:

In a real vehicle, ESCs generally require a stable neutral signal before they arm and allow the thrusters to move. 1000 signals on startup could affect peripherals like a camera tilt servo, or a gripper, but shouldn’t have an impact on thrusters.

Given it’s occurring at startup, it’s almost certainly a firmware issue rather than something that’s tunable by a parameter. My guess would be it’s a remnant of plane/copter code, perhaps intended to provide a ‘safe’ PWM signal while the autopilot starts up, since plane and copter motors are generally single-directional, and use 1000 as ‘neutral’.

This makes sense. Thanks for the quick reply.

A quick followup: I proposed a PR to fix this: AP_HAL_SITL: init ArduSub pwm_output to 1500 by clydemcqueen · Pull Request #20403 · ArduPilot/ardupilot · GitHub

1 Like

I took a look and have added a comment. If that gets resolved I’ll see if I can chase this up internally and get the fix merged :slight_smile: