Hello. I am creating program on raspberry pi using python, pymavlink library, that controls my quadcopter with certain logic. But it is first part of program that actually already works. But now I have second part, and it is that when program works and controls the drone, I would like to regain control as a pilot. When I move any of sticks I would like program to stop working and to give control over drone to pilot. The same way as autotune works.
Currently I am using raspberry pi 5, python and pymavlink library, with mav.rc_channels_override_send command to control roll, pitch, throttle and yaw.
So now when program works, mav.recv_match command doesn’t receive actual values of roll, pitch, throttle and yaw from Remote Control because apparently when program takes control of flight controller it gets higher priority then remote control and flight controller doesn’t react on Remote Control changes.
So my question is, how can I at least listen to remote control changes on raspberry pi when program is in control of drone?
Thanks for your advice. I didn’t now until your reply about these type of functions. When I started to dig more into these functions I faced an issue that I can’t send from LUA script mavlink message. My general idea was to pwm channels like this rc:get_pwm(1)(what I’ve found that this is how I can get the remote control values even when program is overriding rc) and if it would changing from the last known state I would send a trigger message or something like that. But on my final stage, when I was trying to send mavlink message I’ve found the only method that makes some kind of text sending from script to autopilot is gcs:send_text and as I tried, it is not the same as RC_CHANNELS message that I am recognizing with my python script by recv_match message.
Maybe I went in wrong direction with auxiliary functions or LUA scripts? Or maybe I am just missing key piece of the puzzle?
[EDITED] I actually found out how to get messages from LUA script in python script. But, unfortunately, what I’ve also found that even though LUA script is running independently and is listening to get_pwm() channels, it is not actually listening the remote control channels. Because when I started my program, that was overriding rc channels, LUA script was also getting and sending these values which were sent by program, not by remote control. So for now, I have no idea how to make that work using ardupilot(