Control BlueROV2 with Pymavlink and rc override. Propeller does not move

Hello ,

I am trying control the BlueROV2 in ACRO, here is my code:

from pymavlink import mavutil

############################################################## function to send RC values
def set_rc_channel_pwm(id, pwm=1500):
    if id < 1:
        print("Channel does not exist.")
        return
    if id < 9:
        rc_channel_values = [65535 for _ in range(8)]
        rc_channel_values[id - 1] = pwm
        master.mav.rc_channels_override_send(
            master.target_system,                # target_system
            master.target_component,             # target_component
            *rc_channel_values)                  # RC channel list, in microseconds.

# Create the connection
master = mavutil.mavlink_connection('udpin:192.168.2.1:14550')
# Wait a heartbeat before sending commands
master.wait_heartbeat()

############################################################## Arm
master.mav.command_long_send(
    master.target_system,
    master.target_component,
    mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM,
    0,
    1, 0, 0, 0, 0, 0, 0)

#############################################################set mode :
# Choose a mode
mode = 'ACRO'

# Check if mode is available
if mode not in master.mode_mapping():
    print('Unknown mode : {}'.format(mode))
    print('Try:', list(master.mode_mapping().keys()))
    exit(1)

# Get mode ID: return value should be 1 for acro mode
mode_id = master.mode_mapping()[mode]
master.mav.set_mode_send(
    master.target_system,
    mavutil.mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED,
    mode_id)

everything works fine and I can clearly receive the heartbeat from my device, but when I want to set some command to test the propeller by putting:

set_rc_channel_pwm(2, 1600)

or any other pwm channel, and even tried it in periodic loop, nothing happens until I tried to move the camera by set_rc_channel_pwm(8, 1900), the camera moves, which means the connection is good.

I am confused why the propeller does not move. I am testing with python 3.7 under windows environment, and the ROV is on the dry land (not in the water). I was wondering if there is any safety mode or something prevent the propeller moving outside of the water.

I really appreciate your help. Thanks in advance.

Hello,

Is it arming? Could it be that some pre-arm check is failing?

Hello @williangalvani

Sorry for the late reply, it is armed.

I have typed
master.mav.command_long_send(
master.target_system,
master.target_component,
mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM,
0,
1, 0, 0, 0, 0, 0, 0)
before testing.

In fact, last week I successfully make the thruster move by set_rc_channel_pwm(1, 1600)
after I just uninstall my python 3.7 and reinstall python 2.7

but now, it does not work again.

Do you know how can I do pre-arm check?

Thanks for your help!

Hi,

Is there a pre-arm check failiing?
You can use QGroundControl to disable them if you have to.

I personally like doing things like in this gist, where I send the arming command and wait for it to report being armed.

1 Like