Check RC controller button stat

Hello all,

I would like to write a program that will be downloaded in the PIXHAWK that can upload RC button state, and send MAVLINK message.
If I want to check the button state continuly, I need a thread or a simple program?
The program must be a module (like commander) or an application (like px4_simple_app)?
Is there a message that contains the status of an RC button on UORB?
Where should I focus my research to accomplish this task?

Thank you

What sort of RC button is this? Like a joystick connected to the computer or a switch on your RC transmitter?

Hi JulianOes,
it’s switch on my RC transmitter.

And what should this button do? What are you trying to accomplish?

Have you seen this?

yes I read the articles
When the user will switch the state of the button, the mavlink data will send to a second destination.
At the moment I’m trying to create task in the background that checks the condition of the buton continuously. and after I plan to make the change of transmission with a condition if.

Hi JulianOes,

Actually to check for the RC switch :

  • After setting up the channel, the state of the switch is updated to UORB message in rc_channels.msg.
    I wrote an application and i update it to the PIXHAWk, it’s work’s.

I need to launch it at the startup, how i do that ? the app must work constantly, i plan to do it using thread but there is another option ?


You should start your app in the startup script here:

HI, julianoes,
Ty for your reply
I added the app but it dosn’t launch at the startup. i have a while(1) loop in my program it’s unsafe ?

You need to make sure that you either use poll on a topic, or use a usleep somewhere in your loop, otherwise you busy loop and use 100% CPU.

1 Like