Navio 2 Mavlink

Hello friend I want to send rc channel values to Navio 2 utilizing Mavlink,I have no knowledge about Navio 2.Can I send following code directly or what are the modification which I need to do, thanks a lot

mport mavutil

from pymavlink import mavutil

Create the connection

master = mavutil.mavlink_connection(‘udpin:0.0.0.0:14550’)

Wait a heartbeat before sending commands

master.wait_heartbeat()

Create a function to send RC values

More information about Joystick channels

here: https://www.ardusub.com/operators-manual/rc-input-and-output.html#rc-inputs

def set_rc_channel_pwm(id, pwm=1500):
“”" Set RC channel pwm value
Args:
id (TYPE): Channel ID
pwm (int, optional): Channel pwm value 1100-1900
“”"
if id < 1:
print(“Channel does not exist.”)
return

# We only have 8 channels
# https://mavlink.io/en/messages/common.html#RC_CHANNELS_OVERRIDE
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.

I m sorry I forget something and can I run these code inside Navio 2 rpi

Hi @earas48,

Do I understand correctly that you’ve managed to resolve this issue? In this case, may I ask you to share the solution for other users with the same question?

No I cant this problem.I only ask two questions
1-Can I sent rc channel values to navio 2 from computer or pi
2-Can I sent rc channel values inside navio 2 without using any other devicw

I’ve definitely used this functionality when porting my fork of the github project Ardupilot/MAVProxy to use a different joystick library. I had to edit the default MAVProxy code to support more than 8 channels. You may also need to change firmware parameters on the Navio2 to support reception of RC override (I have PX4 firmware running on my Navio2 RPi and I had to change COM_RC_IN_MODE – Ardupilot might have something similar).

Why would you want to do this directly on the Navio2 RPi?

Hi @earas48,

Sorry for the delayed response!

We hardly can provide you with a ready solution, however, it should be possible to implement. I’d recommend following @bliptrip’s advice on using RC override to accomplish this.