UxV toolbox

Overview

The UxV toolbox for Matlab/Simulink provides Matlab scripts and simulink blocks for UAVs to handle MAVLink protocol, GPS, RC receivers and telemetry protocols.

  • Matlab script for post flight data analyses (MAVLink).
  • Simulink blocks for autopilote model based design (Rapid Control Prototyping using Simulink)

This model-based design and analysis tools speed-up the back and forth between experimental tests and simulation.

Three main scripts enable decoding MAVLink messages, creating simulink model for simulation based on logged data, and generating map trajectory trace from GPS messages.

ScriptInputOutputFunction
(1) mavlink2matMavlink log.matmatlab analysis
(2) mavlink2simulinkMavlink log.mat / .mdl (.slx)simulation based on real data
(3) mavlink2kmlMavlink log.kmlplot GPS trace(s) on a map
mavlink2guiMavlink logGUIgraphical exploration of mavlink log

mavlinkgui script opens a Graphical User Interface to explore MAVLink data. It list MAVLink messages found in a log file and plot selected {message - value}. Plot script is customizable enabling user to go beyond a simple plot. The GUI provides access to the three scripts mentioned above.

10 added blocks add essentials UAV features to implement an autopilot on a dsPIC DSC. Theses blocks complete the MPLAB blocks for Simulink from Microchip providing peripheral blocks for code generation. Theses works on top of the MathWorks Embedded Coder. Added features:

  • GPS
    • GPS Parser to decode NMEA messages
  • MATH
    • Quaternion to Cardan FxPt to convert quaternion angle to Cardan angle in fixed point (similar to euler)
  • MAVLink:
    • SEND (send a message)
    • RECEIVE (Receive a message)
    • MAVLink Data (Way Points data)
    • MAVLink Parser (decode input message and implement WayPoint1 and Parameter2 protocols)
  • Receivers-Telemetry
    • S.BUS receive RC channels
    • Smart Port send telemetry values
    • F.Port receive RC channels + send telemetry
    • Sensor for Smart.Port or F.Port set values to send over telemetry3

Except the MATH block, theses blocks are typically connected to the dsPIC UART Rx/Tx block to send/receive the data flow from a GPS, a receiver, a radio link.

Installation

Theses blocks are developped by Lubin Kerhuel and distributed for free with the MPLAB device blocks for Simulink from Microchip.

  1. Install the MPLAB Device Blocks for Microchip
  2. type pinInfo, click on go to Third Part Tools folder
  3. Start script UxV_Blockset_Installer.p in the UxV_blockset folder.

  1. Way Point protocol allows setting and reading WayPoint from a MAVLink compatible ground station. ↩︎

  2. Parameter protocol enable tuning from any MAVLink ground station the Simulink tunable parameters which are normally tuned with External Mode or from the Processor In the Loop simulation (PIL). ↩︎

  3. Sensor for Smart.Port or F.Port block is used with either the Smart Port of the F.Port block. Theses protocol allows sending telemetry packet back to the Remote Controller (RC) interface. It enables emulation of Frsky sensor (battery voltage and current, variometer, airspeed, GPS) adding features to your remote easily. They also enable emulation of BetaFlight telemetry. Used with LUA script, this add features like artificial horizon, air speed, vertical speed, distance from home and many other to your remote (tested with yapuu LUA scripts↩︎