Servers by jDrones

Running a mission planner script on startup

(Seth Jones) #1


I am currently using the ADC port on the px4 to arm/disarm the system with a button that will live on our rover. I wrote a simple script that monitors the voltage of the “sonar sensor” that the button is, and disarms the system if the button is pressed. I would like to have this code running continuously either when mission planner starts up, or when connection between the px4 and the GCS is established. It is not ideal to have to go in and select/run the script manually.

(Michael Oborne) #2

There are some command line options to run scripts at startup. It will be /script

(Seth Jones) #3

Thanks so much Michael! This is exactly what I was looking for. The only problem that I am running into is that when I run the script before establishing mavlink connection, cs.variable has a static value of whatever it was before the connection, and this value does not change in the script even if it does in the status tab. Any thoughts?

Thanks again

(Michael Oborne) #4

How are you referencing cs? Try MAV.cs

(Seth Jones) #5

I was just using cs.???. So not using anything to reference cs, which may have contributed to my problem. However, I took the button in a different direction, editing the pixhawk firmware. Thanks for your input!

(Michael Oborne) #6

Agh i missed a MAV
should be

the reason behind this is cs, is referenced to a non changing drone at script start time. this is so you can connect other drones, and it wont flick to another drone while the script is running.

MAV.MAV.cs should dynamically change based on the current target drone.

(Michael Oborne) #7

another options is

(Seth Jones) #8

Thanks for the great info!