Startup Scripts

MAVProxy is capable of executing a script (of MAVProxy commands) on startup. This can save the effort of (re)setting up the MAVProxy environment for each flight.

A script (mavinit.scr) should be placed in an aircraft directory (ie. ./Aircraftname/mavinit.scr) containing the commands. Any normal MAVProxy commands can be placed in here. Note that the –aircraft option must be used in the MAVProxy to begin its execution, in order for MAVProxy to find the script in the appropriate aircraft directory.

Note

This script is run at startup and doesn’t wait for a vehicle to connect. This script cannot be used to automate configuration of the vehicle or simulation. It will only to configure the MAVProxy options/settings such as additional modules loaded, aliases, etc.

Alternatively, the .mavinit.scr can be placed in the user’s home directory (ie. /home/username in Linux or C:\Users\username\AppData\Local\MAVProxy in Windows) and will be loaded with MAVProxy regardless of the –aircraft option.

An example script can be found here.

In this particular script, aliases are used as shortcuts to common commands.

For example the following alias definitions in mavinit.scr will allow the user to graph the current battery level by typing gbatt instead of graph SYS_STATUS.current_battery.

@alias add g graph
@alias add gbatt g SYS_STATUS.current_battery``