/MAVproxy-examples

Guide on common MAVProxy commands and examples on how to use them effectively.

MIT LicenseMIT

MAVProxy Commands and Examples

MAVProxy is a powerful command-line ground control station for UAVs. It allows you to monitor, control, and configure your drone from your terminal. Below is a guide on common MAVProxy commands and examples on how to use them effectively.

Prerequisites

Before diving into MAVProxy commands, ensure you have completed the steps in the Installing ArduPilot and MAVProxy on Ubuntu 20.04 guide.

Basic MAVProxy Usage

Start MAVProxy with the following command:

mavproxy.py --master=<connection_string>

Example

To connect to a flight controller over USB:

mavproxy.py --master=/dev/ttyUSB0 --baudrate 115200 --aircraft MyCopter

Replace /dev/ttyUSB0 with your specific device path.

MAVProxy Console Commands

Once MAVProxy is running, you can issue commands via the console. Below are some of the essential commands:

Basic Commands

  • arm throttle: Arms the drone, enabling the motors.

    arm throttle

    Example:

    arm throttle
  • disarm: Disarms the drone, stopping the motors.

    disarm
  • mode <mode_name>: Changes the flight mode.

    mode GUIDED

    Example:

    mode LOITER
  • takeoff : Commands the drone to take off to a specified altitude.

    takeoff 10

Navigation Commands

  • wp load : Loads a mission plan from a file.

    wp load mission.txt

    Example:

    wp load /path/to/mission.txt
  • wp list: Lists all waypoints in the current mission.

    wp list
  • wp clear: Clears the current mission waypoints.

    wp clear
  • guided : Commands the drone to fly to a specified location in GUIDED mode.

    guided 37.7749 -122.4194 50

Data Display and Monitoring

  • status: Displays the current status of the drone, including GPS, battery, and more.

    status
  • altitude: Shows the current altitude of the drone.

    altitude
  • battery: Displays the current battery voltage and current usage.

    battery
  • attitude: Shows the current attitude (pitch, roll, yaw) of the drone.

    attitude

Advanced Commands

  • param set : Sets a parameter to a specified value.

    param set ALT_HOLD_RTL 1000
  • param show: Lists all the parameters and their current values.

    param show
  • module load <module_name>: Loads a MAVProxy module.

    module load map
  • module unload <module_name>: Unloads a MAVProxy module.

    module unload map

Practical Examples

Example 1: Start MAVProxy and Arm the Drone

mavproxy.py --master=/dev/ttyUSB0 --baudrate 115200 --aircraft MyCopter

In the MAVProxy console:

arm throttle

Example 2: Take Off and Land

Start MAVProxy:

mavproxy.py --master=/dev/ttyUSB0 --baudrate 115200 --aircraft MyCopter

In the MAVProxy console:

mode GUIDED
takeoff 10

To land the drone:

mode LAND

Example 3: Navigate to a GPS Coordinate

Start MAVProxy:

mavproxy.py --master=/dev/ttyUSB0 --baudrate 115200 --aircraft MyCopter

In the MAVProxy console:

mode GUIDED
guided 37.7749 -122.4194 50

Example 4: Load and Start a Mission

Start MAVProxy:

mavproxy.py --master=/dev/ttyUSB0 --baudrate 115200 --aircraft MyCopter

In the MAVProxy console:

wp load /path/to/mission.txt
mode AUTO

Conclusion

These commands and examples provide a basic understanding of how to use MAVProxy to control your drone. For more advanced usage and detailed command options, refer to the MAVProxy Documentation.