Using pymavlink to control bluerov

Recently, I found an example on the official website of ardusub(pymavlink) about send_rc,Operation 0-7 channels , and the Bluerov executes the command normally. However, when operating channel 8, the light does not reflect,I observe master.recv_ Match () found that channel 9 has not changed, and the pwm is still 1100 .The version of pymavlink is 2.4.8(because V2.4.34 can not set mode,I also can not understand)

Hi @JiaXu_Zhang, welcome to the forum :slight_smile:

RC inputs are not the same as RC outputs.

  1. Have you configured your output 9 channel to correspond to Lights1 inputs (by setting SERVO9_FUNCTION to RCIN9, or via the Lights page in QGroundControl)?
  2. Does it work to control the lights using QGroundControl?
  3. Is there a reason you’ve changed the set_rc_channel_pwm function to use zero-based indexing for the channel-id, and only provide 12 values instead of the 18 used in our example?

That shouldn’t be necessary. Both lights control and mode changing are working fine for me on Pymavlink 2.4.37 (I just updated it to the latest version).

Note that if you’re using BlueOS there may be issues with changing mode if you have not explicitly waited for an autopilot heartbeat, because there are other MAVLink components on the same system.

Thank you for your reply,I have gradually tested the three suggestions you put forward.For first and second,


and I can control the lights by QGC
for third , I didn’t pay attention before,Now I change the code to be like the example, but it still doesn’t work.I checked the Mavlink manual. Is this because of the difference between mavlink1 and mavlink2? How to switch

MAVLink 1 vs 2 shouldn’t be particularly important in this case, I just wasn’t sure whether you had intentionally changed the example (in which case there was presumably a reason for it), or if you were working off old code or something.

I would note that the RC channels are documented starting from 1, so referring to them using 0-based indexing in your code can make it a bit harder to follow when comparing with the documentation (and our examples).

Pymavlink should automatically switch to using MAVLink 2 if it detects that the other MAVLink devices it’s communicating with are using MAVLink 2, which should be the case unless your autopilot firmware is several years out of date.

You haven’t shared your code so I don’t know what your Bridge.__init__, Bridge.start and Bridge.update methods do, but at least one of them should be waiting for heartbeats from the vehicle before continuing.


Can you try running our example code exactly as it is, but with set_rc_channel_pwm(9, 1600) instead of the existing calls? If that works then the issue is with your setup code. If it doesn’t work then there’s likely some issue with your configuration and/or autopilot parameters.

Thank you for your reply,I use the code in the example according to your suggestions.An arm command is added.It’s obvious. Set some roll,Set some yaw and Set camera tilt to 45º (max) with full speed ,all of them is working . but set_rc_channel_pwm(9,1600) still not work,it`s too bad -_-!

Can you share a screenshot of the Lights page in QGroundControl, along with the software versions you’re using (ArduSub, BlueOS/Companion, QGroundControl)?

As I mentioned previously, lights control works fine for me, so there must be some issue with your setup/configuration.


As a potential workaround, you could also try setting the servo PWM directly.


3
Iam trying to setting the servo PWM directly ,because I dont know this part. Thank you for your reply