Servers by jDrones

Run Python Code on telemetry radio


(Govinda) #1

Hello,

I am trying to run the python script on a companion computer on the drone but not through “SSH”, but through radio frequency. Is it even possible?Does anyone has any suggestions for that?


(Sebastian Schürmann) #2

If I understand your question right, you want to start/stop a script on your companion computer without using a network connection.
Is the telemetry radio connected to the flightcontroller or the companion computer?
Do you use RC control?
You could use the telemetry or RC connection to send a signal from the GCS or TX through the flightcontroller to the GPIO ( if it has such ) pins of your companion computer to start a script or do pretty much anything else.
I once used an arduino to restart the onboard computer of my rover in case it crashed. The arduino pulled a signal pin and therefore the power pin of the PC low just like the power button would. You just have to be careful to not put 5V in 3.3V GPIO pins. The GPIO pins on a Raspberry Pi are 3.3V for example
If the telemetry radio is connected to the companion computer, you could run a serial console over the RF link, but you would loose the telemetry, so I think the first method would be better.


(Govinda) #3

@count74
Thank you for your reply.
Yes you got it right.
The telemetry radio is connected to pixhawk flight controller, and I do not want to use any ground control station. I want to start / stop the python script from my host machine which is in the companion computer Nvidia Jetson TX2 on the drone.
Yes, RC is used too as incase something goes wrong with the code, so that I can switch over to RC and take control.
“You could use the telemetry or RC connection to send a signal from the GCS or TX through the flightcontroller to the GPIO ( if it has such ) pins of your companion computer to start a script or do pretty much anything else.”
Could you please tell me how is this possible?Any python code or pseudo code you could share with me?
I am not using raspberry pi. And thank you, I will make sure of using the right voltage.


(Sebastian Schürmann) #4

@govi
You can configure AUX pins on the pixhawk to be relay pins. As a relay pin they work as digital outputs instead of PWM outputs.
This is normally used to trigger cameras, but you can use it for other things too.
If you connect a relay pin and ground to a gpio pin and ground of the TX2, you can use a python script to read the state of the gpio pin. When the pin goes high, meaning there is voltage coming in, the script starts to do whatever it does and stops when the gpio pin goes low.
When I did something like this I connected the arduino pins directly to the PC frontpanel pins and it worked, but it is usually recommended to use an optocoupler in between to protect both sides of the connection.

http://ardupilot.org/copter/docs/common-relay.html

https://devtalk.nvidia.com/default/topic/1030443/jetson-tx2/using-gpio-on-nvidia-jetson-tx2/