Pymavlink not working properly

Odd. I’d suggest trying with smaller components of the script and build up as you confirm functionality. Try

  1. just changing the mode, then
  2. add arming, then
  3. add a small thruster movement (e.g. turn on one thruster, sleep for 0.1 seconds, turn off the thruster)
  4. try your actual script

I think this should be fine without physically disconnecting the controller as long as you don’t have some other mavlink process/thread running. It may be helpful to keep QGC open and just disable the joystick from the joystick settings page though - I believe it should still give you status updates like when the ROV changes mode or gets armed (that might be wrong though).

I’ve just noticed your command loop has quite a long wait between command updates. @patrickelectric mentions (in the post I linked to earlier) that RC_OVERRIDE has a timeout controlled by RC_OVERRIDE_TIME, after which RC overrides stop applying. It’s documented here, but I’m unsure what the default timeout amount is.

It’s perhaps also worth noting that at the bottom of this post @jwalser mentions stabilise and depth-hold mode lock their angle target after 250ms of no additional control commands (he links to the source code).