RC Override Control (65535) Not Working

Hi,

I use the code given Pymavlink · GitBook to send manual moves to the vehicle but the override value (65535) does NOT work. (function set_rc_channel_pwm() )

I already read these posts:

I did the below:

  • Both ArduSub and Companion are at the latest version
  • If I replace the 65535 to 1500 then the vehicle performs the movement correctly! (e.g. Forward, Lateral)
  • If i use Beta or Developement versions the override value (65535) works, BUT the pressure sensor is not recognized ( I use the Bar30 High-Resolution 300m Depth /Pressure Sensor) so I cannot use “depth hold” mode, only stabilize.
  • When I install the stable version (4.0.3) the pressure sensor works again but the override does not work.
  • The SERIAL0_PROTOCOL parameter is to mavlink2 by default.

Any ideas?

Thank you,
Marios

Hi @Marios, welcome to the forum :slight_smile:

What do you mean by this? 65535 is the “ignore” value, which means that channel doesn’t get updated. Channels set to 65535 in an rc_channels_override message will maintain whatever value was already stored, which can potentially cause issues with other controls.

This quote (and the post it’s from) are relevant:

I would also recommend you look into the failsafes and timeouts :slight_smile:

In case you want to try running beta/devel anyway,

Hi,

Thanks for your response and sorry for the delayed answer.

I forgot to mention that when i run the bellow code with 65535 value at line73 all the motors work at full speed. If I use it with 1500 the motions are performed correctly.
All the tests are performed at manual flight mode.

Also, I use the wait commands for arm, disarom, hearbeat (eg. master.motors_armed_wait()).
At one of the posts I saw that when its armed it uses the motions of last commands. Yes that is happening for the first 1 second but after that, it gets the new commands. (when I don’t use 65535)

Example of code i use:

def test4():
    manual()
    arm()
    surge(0.3)
    sleep(2)
    surge(0)
    sleep(1)
    disarm()
def manual():
    MANUAL = 'MANUAL'
    MANUAL_MODE = init.master.mode_mapping()[MANUAL]
    while not init.master.wait_heartbeat().custom_mode == MANUAL_MODE:
        init.master.set_mode(MANUAL)
def arm():
    # arm ArduSub autopilot and wait until confirmed
    init.master.arducopter_arm()
    print("Waiting arm confirmation...")
    init.master.motors_armed_wait()
    print("-- ARMED --")
    sleep(0.01)
def surge(speed):
    set_rc_channel_pwm(5, int(1500 + speed*400))
    print("Surge: " + str(int(speed*100)) + "%")
def set_rc_channel_pwm(channel_id, pwm=1500):
    if channel_id < 1 or channel_id > 18:
        print("Channel does not exist.")
        return

    rc_channel_values = [1500 for _ in range(18)] # 0xffff # 65535
    rc_channel_values[channel_id - 1] = pwm
    init.master.mav.rc_channels_override_send(
        init.master.target_system,                # target_system
        init.master.target_component,             # target_component
        *rc_channel_values)                  # RC channel list, in microseconds.

With this test code, the four horizontal oriented thrusters should work at low speed but all thrusters work at maximum speed.

I didn’t check the beta version solution for the pressure sensor yet. I prefer to try and solve this in stable and in worst case senario I will use the beta one. For now I use this code with 1500 instead of the ignore value 65535.

Thanks
Marios

Hi @Marios,

Your code doesn’t seem to include the explicit stop I mentioned (send 1500 to the 6 movement channels, and 65535 to the rest of the channels) before arming - I would suggest trying that to see if it helps.

You’re also welcome to try the full program example I linked you to, which was definitely working for me when I created it.

That’s not particularly recommended, because (if you have them) it forces connected lights and the camera tilt servo to be set to the middle, and also makes it impossible to command two motion axes concurrently (e.g. if you want to go forwards and sideways, sending a forwards signal tells sideways motion to stop, and sending a sideways signal tells forward motion to stop). The whole idea with the ‘ignore’ value is that it maintains the other commands while you change one of them.

If you don’t have lights or a camera tilt servo, and it’s not important for your vehicle to be able to move in more than one direction at a time, then your proposed workaround should work (i.e. it shouldn’t have any other problematic side-effects), it’s just an odd way of going about things.

Hi @EliotBR,

I missed the code you sent me so I tried it out and it worked!

So the problem was that I was defining the rc_channel_values as List and not as tuple.
In your example code at send_rc() function you send a tuple with master.mav.rc_channels_override_send . So I changed my code and it works fine (with 65535)

Thanks for all your help!

Glad to hear it :slight_smile:

That’s not actually relevant, and can’t be the cause of the issues you were having. The values get unpacked directly into the rc_channels_override_send function call, so whether it’s a list or tuple before the unpacking doesn’t matter (*rc_channel_values means the function gets the values passed in as positional arguments).

Glad you managed to get something working, even if the cause of the original problem still isn’t clear :slight_smile:

1 Like