# Send rc\_input command

**URL:** <https://discuss.bluerobotics.com/t/send-rc-input-command/12305>\
**Category:** ArduSub\
**Tags:** ardusub, pymavlink\
**Created:** [June 10, 2022, 6:18pm UTC](https://discuss.bluerobotics.com/t/send-rc-input-command/12305 "2022-06-10T18:18:31Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Efe](https://avatars.discourse-cdn.com/v4/letter/e/5fc32e/32.png) [@Efe](https://discuss.bluerobotics.com/u/Efe)\
**Post date:** [June 10, 2022, 6:18pm UTC](https://discuss.bluerobotics.com/t/send-rc-input-command/12305/1 "2022-06-10T18:18:31Z")

</div>

Hi there,  
I have been working on an autonomous vehicle and I will use rc input commands because I want to have control over all the six axises. I have tried to code like the example on the ardusub documentation but it throws an error saying that the function doesnt take 21 arguments. But I am sure that I am giving 18 rc channels. Can you show a working example on sending rc input commands?

 ![Screenshot_20220610-211533_GitHub](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/8/8c534b72b819361d000e1d70eda83e7bee1fd85c.jpeg)

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [June 11, 2022, 4:12am UTC](https://discuss.bluerobotics.com/t/send-rc-input-command/12305/2 "2022-06-11T04:12:25Z")

</div>

Hi @Efe,

That code should work - how are you connecting to the vehicle? Note that [Pymavlink does some internal reorganisation](https://github.com/ArduPilot/pymavlink/blob/ba8ca05b2b905c6af2ae20aafa12d7bd09ce9195/mavutil.py#L271-L305) depending on how the other components are communicating with it, so you generally need to make sure you’ve received at least one message from the vehicle before you start sending commands to it - it’s common to wait for a heartbeat.

There’s a full program example [here](https://gist.github.com/ES-Alexander/ee1dd479dd728b7cef1bf936f9114e71) if that’s of interest, but make sure to read the notes at the bottom 🙂

---

<div class="post-metadata">

**Author:** ![Efe](https://avatars.discourse-cdn.com/v4/letter/e/5fc32e/32.png) [@Efe](https://discuss.bluerobotics.com/u/Efe)\
**Post date:** [June 13, 2022, 6:36am UTC](https://discuss.bluerobotics.com/t/send-rc-input-command/12305/3 "2022-06-13T06:36:06Z")

</div>

![image](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/b/b136da0cdd1ce9063826961c9b070f38250ed406.png)  
Here is our error message for rc commands we send target system, target component and 18 rc channels but it says 21 arguments were given.

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [June 13, 2022, 7:02am UTC](https://discuss.bluerobotics.com/t/send-rc-input-command/12305/4 "2022-06-13T07:02:25Z")

</div>

21 is correct - the extra argument is because `rc_channels_override_send` is a method of the `master.mav` object, so the object gets passed in as the first argument.

Are you receiving at least one message from the vehicle before you try to send the rc command?

---

<div class="post-metadata">

**Author:** ![Efe](https://avatars.discourse-cdn.com/v4/letter/e/5fc32e/32.png) [@Efe](https://discuss.bluerobotics.com/u/Efe)\
**Post date:** [June 15, 2022, 10:24am UTC](https://discuss.bluerobotics.com/t/send-rc-input-command/12305/5 "2022-06-15T10:24:20Z")

</div>

Yes I am waiting for heartbeat in the initalization phase and also I am sending heartbeat messages periodically. I didn’t understand why the error says rc override takes 12 arguments. Could it be something about mavlink version?

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [June 15, 2022, 4:26pm UTC](https://discuss.bluerobotics.com/t/send-rc-input-command/12305/6 "2022-06-15T16:26:17Z")

</div>

> [@Efe](#):
>
> I didn’t understand why the error says rc override takes 12 arguments. Could it be something about mavlink version?

RC override used to only accept 12 arguments in MAVLink 1.0, so it is indeed a MAVLink version issue, but that’s supposed to be automatically corrected for by Pymavlink once it receives messages from a vehicle that’s communicating using MAVLink 2.0 (which is the internal reorganisation I mentioned earlier).

Which ArduSub and Pymavlink versions are you using?

---

<div class="post-metadata">

**Author:** ![Efe](https://avatars.discourse-cdn.com/v4/letter/e/5fc32e/32.png) [@Efe](https://discuss.bluerobotics.com/u/Efe)\
**Post date:** [June 16, 2022, 6:35am UTC](https://discuss.bluerobotics.com/t/send-rc-input-command/12305/7 "2022-06-16T06:35:25Z")

</div>

I am using pymavlink 2.4.29 so it shouldn’t be a problem but I don’t have pixhawk with me right now. I can tell you the ardusub version tomorrow. Also are there any option that I can test rc\_input from QGC ?

---

<div class="post-metadata">

**Author:** ![Efe](https://avatars.discourse-cdn.com/v4/letter/e/5fc32e/32.png) [@Efe](https://discuss.bluerobotics.com/u/Efe)\
**Post date:** [June 16, 2022, 7:47pm UTC](https://discuss.bluerobotics.com/t/send-rc-input-command/12305/8 "2022-06-16T19:47:49Z")

</div>

my ardusub firmware version is 4.0.3

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [June 28, 2022, 5:25am UTC](https://discuss.bluerobotics.com/t/send-rc-input-command/12305/9 "2022-06-28T05:25:44Z")

</div>

Hi @Efe, sorry for the delay getting back on this.

I’m not sure what’s going wrong there - I believe I’ve run with a similar setup multiple times previously and not had issues. A few questions:

1. How is Pymavlink being connected to your vehicle / autopilot?
2. What kind of autopilot board are you using?
3. Does the issue get fixed by manually specifying to use MAVLink 2.0 using environment variables?

```python
# specify MAVLink 2.0 - MUST be before Pymavlink import(s)
import os
os.environ['MAVLINK20'] = ''
from pymavlink import mavutil
...

```

> [@Efe](#):
>
> are there any option that I can test rc\_input from QGC ?

Not directly - QGC (for the most part) commands ArduSub using `MANUAL_CONTROL` messages. Internally ArduSub converts the motion control components of that into an RC\_OVERRIDE command, but that’s quite roundabout and has some limitations because of scaling and constraints applied during the conversion.

---

<div class="post-metadata">

**Author:** ![Efe](https://avatars.discourse-cdn.com/v4/letter/e/5fc32e/32.png) [@Efe](https://discuss.bluerobotics.com/u/Efe)\
**Post date:** [June 29, 2022, 4:07pm UTC](https://discuss.bluerobotics.com/t/send-rc-input-command/12305/10 "2022-06-29T16:07:33Z")

</div>

I am using pixhawk flight controller connected to jetson nano via usb. I will try specifying the version as soon as possible.

---

<div class="post-metadata">

**Author:** ![Efe](https://avatars.discourse-cdn.com/v4/letter/e/5fc32e/32.png) [@Efe](https://discuss.bluerobotics.com/u/Efe)\
**Post date:** [May 19, 2023, 12:50pm UTC](https://discuss.bluerobotics.com/t/send-rc-input-command/12305/11 "2023-05-19T12:50:13Z")

</div>

Hi @Eliot,  
Last year I opened up this topic and then I found the solution by decreasing number of rc\_channels that I send. When I send only 9 rc\_channels it works and 9 channels were enough. But now I also want to control lights when I am using rc\_input so I also need the 10. channel do you have any other advices that I could try? Stating the mavlink version as mavlink 2 also didn’t work.  
And also I have another question about rc\_input, am I able to use stabilize mode with rc\_input commands and should I send roll, pitch and yaw as 65535 in order to activate stabilize mode?
