Home        Store        Learn        Blog

Autonomous problem

hello, we are uploading a code to our robot to go straight. We run the code on the raspberry pi. we use the send_rc_channels_pwm function for this. Instead of the movements we send, the robot turns around and makes meaningless movements. Can you help me?

My code is :

# Import mavutil
from pymavlink import mavutil
import time
# connection 
master = mavutil.mavlink_connection(

#arm robot


    0) # stabilize mode

def set_rc_channel_pwm(id, pwm=1500):

    if id < 1:
        print("Channel does not exist.")
    if id < 9:
        rc_channel_values = [65535 for _ in range(8)]
        rc_channel_values[id - 1] = pwm

value = 1550
set_rc_channel_pwm(5, value)

    0, 0, 0, 0, 0, 0, 0) #disarm

Hi @enis.getmez,

Is there a reason this is via private message instead of as a public post? I’ll still see it if it’s public, and that also means others can chime in (possibly before I get to it), and others in the community can benefit from the solution afterwards as well.

I’m unsure what your custom flight mode does, so it’s not possible for me to tell you why the ROV isn’t moving as you expect.

This post is likely relevant:

Given this is a direct serial connection to the autopilot board I assume you’re trying to do this autonomously, and also likely not using our companion computer image - is that correct?

A few side-notes:

  • you can use master.motors_armed_wait() to wait until arming has succeeded (instead of waiting for a fixed period that provides no guarantees about the autopilot state, and could be unnecessarily long)
  • you can use master.arducopter_disarm() to disarm if you want to
  • it may be worth adding a master.motors_disarmed_wait() to the end of your program to make sure the disarming was actually successful.
1 Like

Hi, I have sent a private message assuming you can see it faster as we need urgent help.

I am sorry for the late reply. We solved the problem.

Sending manual control instead of rc commands solved the problem.

Thank you for your attention.

1 Like

Glad you managed to solve the problem :slight_smile:

I’ve now made it a public topic so others can benefit from the solution :slight_smile:

1 Like