RC_CHANNELS_OVERRIDE (ID 70) behaviour

It is a conceptual question here.

I want to relay Rc commands from GS to a copter, and from copter to a plane. These RC commands are shared between the two vehicules, i.e. 16 channels would control both of them.

Initially I was thinking about using ELRS for the first link, and then connect ELRS output configured as SBUS to both FC and mLRS which would retransmit it to the plane. For some reason, mLRS stubbornly does not want to accept SBUS from ELRS receiver.

But I have a stable bidirectional MAVLink2 link, and there is MAVLINK CMD RC_CHANNELS_OVERRIDE (ID 70).

The question is this:

  1. If I send the RC Channels Override CMD, would the behaviour be the same as if it was received through standard RC IN?
  2. If I have RC IN connected to some other Receiver, like ELRS for close range LOS control, would the two streams β€œcoexist”? The content of channels would be the same, both for ELRS and RC Channels Override, but there could be sitation A, where both ELRS and RC Override have valid data, and then only RC Override data only. Would it work correctly?
  3. Failsafe. If there is no ELRS signal, would a RC failsafe occur automatically, or it will not ocurr while RC Overide messages are received? I obviously need to have Rc failsafe triggered when both ELRS and RC Override channels are absentm, but not when only ELRS ceases to receive.

The key question is whether RC_FS_TIMEOUT is based on only RC IN signal or on (RC IN or RC OVERRIDE)

I pretend to reformat RC Channel Override sentence in Lua script on the copter side.

Not much luck so far of getting the rc channels to work. I am checking if radio calibration screen works, not sure if this the right thing to do (i.e if RC override will show up on that screen).

– Sending Data To Remote Vehicle
local MAVLINK2 = 0xFD
local TARGETSYSID= 8 – !!! THIS IS SYS ID OF THE REMOTE VEHICLE, SET UP IN MAV SYSID.
local THISSYSID= 1 – This FC Sys ID

if not MAVSEQ then MAVSEQ = 0 else MAVSEQ = (MAVSEQ + 1) & 0xFF end

local function u16(v)
return string.char(v & 0xFF, (v >> 8) & 0xFF)
end

local function mav_crc_accumulate(byte,crc)
byte = byte & 0xFF

local tmp = byte ~ (crc & 0xFF)
tmp = tmp & 0xFF

tmp = tmp ~ ((tmp << 4) & 0xFF)

crc = (crc >> 8) ~ (tmp << 8)
crc = crc ~ ((tmp << 3) & 0xFFFF)
crc = crc ~ (tmp >> 4)

return crc & 0xFFFF

end

local function mav_crc_buffer(str, crc)
for i = 1, #str do
crc = mav_crc_accumulate(string.byte(str, i), crc)
end
return crc
end

if rc:get_pwm(1) and rc:get_pwm(2) and rc:get_pwm(3) and rc:get_pwm(4) then – override only if there is valid RC Channel data
local frame_out= string.char(MAVLINK2,18,0,0,MAVSEQ,THISSYSID,1,70, 0, 0,TARGETSYSID,1).. u16(rc:get_pwm(1)).. u16(rc:get_pwm(2)) .. u16(rc:get_pwm(3)) .. u16(rc:get_pwm(4)) .. u16(rc:get_pwm(5)) .. u16(rc:get_pwm(6)) .. u16(rc:get_pwm(7)) .. u16(rc:get_pwm(8))
local crc=0xFFFF
crc = mav_crc_buffer(frame_out, crc)
crc = mav_crc_accumulate(50,crc)
frame_out=frame_out..u16(crc)
for i = 1, #frame_out do
port:write(string.byte(frame_out, i))
end

end

Hi @Michail_Belov,

Here are some wiki pages that may help although you may have seen them:

Normally if there are two vehicles then each flight controller gets a different system id and the GCS would send the rc-channel-overrides to only one of them using the corresponding sysid in the target_system field.

2 Likes

Thanks for the answer.

But I am still out of luck. I have made a script which generates both heartbeat and rc override command. I have verified that the serial radio link works, I can get the MAVLINK telemetry from the FC which is supposed to be on the remote plane into the relay copter FC, I can also receive the heartbeat and rc override messages from the serial radio link receiver (I used a pi pico to capture this stream), below I give a couple of examples of the messages generated by the lua script.

I have tried different SYSID, both trying same SYSID on sender and receiver (like a companion computer), sending SYSID as GS 255, and sending SYSID as 1, with target SYSID being always 8 (and this is also set so in MAV_SYSID parameter as 8 on the remote plane FC).

I also tried to check if I could see anything with MAVLINK Inspector in Mission Planner, but there is aboslutely nothing except for the SYSID 8 on the remote plane which is sending the MAVLINK telemetry with the corresponding messages, but there is no reception whatsoever which would indicate the reception of the generates messages.

The UART on the remote plane is configured as MAVLINK2, and UART on the copter is configured as SCRIPTING.

I even began to suspect that the RX serial may be broken, that is why I decided to check if I had a valid output from mLRS receiver on the plane side, but all seem to indicate that it works.

If I will not be able to establish the mavlink link for some reason, the only hardware solution I have in mind is to route the serial data coming from copter to a pipico (on the plane), reformat the RC channels into SBUS sentence and to put out SBUS (inverted) sentence to FC Uart to emulate normal receiver.

The messages below are generated and sent at 10 Hz:

253.9.0.0.130.8.191.0.0.0.0.0.0.0.18.8.0.3.3.3.10.:

253.38.0.0.130.8.191.70.0.0.220.5.220.5.227.3.218.5.219.7.51.4.219.3.220.5.219.3.219.3.219.3.219.3.219.3.193.7.219.7.219.7.255.255.255.255.8.1.13.13.:

253.9.0.0.131.8.191.0.0.0.0.0.0.0.18.8.0.3.3.146.235.:

253.38.0.0.131.8.191.70.0.0.220.5.220.5.227.3.218.5.219.7.51.4.219.3.220.5.219.3.219.3.219.3.219.3.219.3.193.7.219.7.219.7.255.255.255.255.8.1.35.101.:

253.9.0.0.132.8.191.0.0.0.0.0.0.0.18.8.0.3.3.71.75.:

253.38.0.0.132.8.191.70.0.0.220.5.220.5.227.3.218.5.219.7.51.4.219.3.220.5.219.3.219.3.219.3.219.3.219.3.193.7.219.7.219.7.255.255.255.255.8.1.248.127.:

253.9.0.0.133.8.191.0.0.0.0.0.0.0.18.8.0.3.3.214.170.:

253.38.0.0.133.8.191.70.0.0.220.5.220.5.225.3.218.5.219.7.51.4.219.3.220.5.219.3.219.3.219.3.219.3.219.3.193.7.219.7.219.7.255.255.255.255.8.1.185.55.:

I gave up on this idea.-