Run a python script from the Raspberry Pi using the RC transmitter

Hello! I am currently working on a rover project right now.

I have connected PixHawk and Raspberry Pi through the telem port and the RX TX pins. In my project when things don’t go well, I have this python script in my raspberry pi where it’s supposed to take control of the robot movement rather than the joystick of the transmitter.

I was supposed to have the python script run at the time when the robot is on and when it detects a maximum input of channel 2, it will start this if-statement of the code and it turns off when the channel 2 input is at minimum. Both maximum and minimum are in if-else statements. I’m not really sure if my idea works but are there any options for doing this? Thanks!

I think you can use ArduPilot Lua to some effect here. Rather than decoding RC PWM on the Pi, use an autopilot-based Lua script to trigger a GPIO (relay) pin when the RC channel condition is met. Use the autopilot GPIO pin as an input for the Pi script.

You can then send RC override commands over the serial connection between the Pi and the autopilot.

My python script uses OpenCV and a raspberry pi camera. I’m curious if both of these are supported by ArduPilot Lua