Changing RC7_FUNCTION using a plugin

How do you change the RC7_FUNCTION from disabled to RCPass Thru using a button in a plugin? What is the Parameter Value of RC7_OPTION?

_ = MainV2.comPort.doCommand((byte)MainV2.comPort.sysidcurrent, (byte)MainV2.comPort.compidcurrent, MAVLink.MAV_CMD.DO_SET_PARAMETER, parameter value?, 1, 0, 0, 0, 0, 0);

Read here. Parameter value is the value you want to set. Parameter ID is a 16 character string field.

https://ardupilot.org/dev/docs/mavlink-get-set-params.html

1 Like

After reading the link you attached here it looks like i need to send a message asking for the value. once i receive the parameter value i can enter it into the code in the previous post. l should use PARAM_REQUEST_READ and the parameter id of “RC7_OPTION” in the message i send. Could you help with syntax in C#? how to send a mavlink message in C#?

thank you

Jon Peyron

No, you don’t need to read a parameter before setting it. I don’t know what you mean by “plug-in,” nor do I have any idea what C# libraries, interfaces, methods, etc you are using. As such, it is impossible to just give you the syntax for what you desire.

The following code snippet is a working Python example to set RC7_OPTION to a value of 300 using the pymavlink library, assuming you have a MAVLink connection available on localhost:14550:

from pymavlink import mavutil

if __name__==('__main__'):
    connection = mavutil.mavlink_connection('tcp:localhost:14550')
    connection.wait_heartbeat()
    t_sys = connection.target_system
    t_comp = connection.target_component
    connection.mav.param_set_send(t_sys, t_comp, b'RC7_OPTION', 300, mavutil.mavlink.MAV_PARAM_TYPE_INT8)

If you want to use onboard GPIO buttons to change parameters, suggest you use an onboard Lua script for that.