Asv.Mavlink 4.0.0

dotnet add package Asv.Mavlink --version 4.0.0
                    
NuGet\Install-Package Asv.Mavlink -Version 4.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Asv.Mavlink" Version="4.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Asv.Mavlink" Version="4.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Asv.Mavlink" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Asv.Mavlink --version 4.0.0
                    
#r "nuget: Asv.Mavlink, 4.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Asv.Mavlink&version=4.0.0
                    
Install Asv.Mavlink as a Cake Addin
#tool nuget:?package=Asv.Mavlink&version=4.0.0
                    
Install Asv.Mavlink as a Cake Tool

linkedin

Introduction

The asv-mavlink library provides a robust interface for communication with MAVLink compatible vehicles and payloads. This library is designed to facilitate the interaction with drones and other devices using the MAVLink protocol, enabling users to send commands, receive telemetry data, and perform various operations.

Additionally, the library includes a CLI utility Asv.Mavlink.Shell for simulating, testing and code generation.

This library is part of the open-source cross-platform application for drones Asv Drones.

Installation

To install the asv-mavlink library, you can use the following command:

dotnet add package Asv.Mavlink --version <Version>

Documentation

Documentation can be found here

Example: Emulate ADSB reciever

This command starts a virtual ADS-B receiver that sends ADSB_VEHICLE packets at a specified rate for every vehicle defined in the configuration file.

Asv.Mavlink.Shell.exe adsb --cfg=adsb.json

image

Here's an example of ADSB utility being used with Asv.Drones.

image

Here's an example of ADSB utility being used with Mission Planner

image

Example: Packet code generation

Generate C# code for packet serialization\deserialization

Asv.Mavlink.Shell.exe gen -t=[mavlink-xml-file] -i=[mavlink-xml-folder] -o=[output-folder] -e=cs [path-to-liquid-template]/csharp.tpl
   /// <summary>
    ///  HEARTBEAT
    /// </summary>
    public class HeartbeatPayload : IPayload
    {
        public byte GetMaxByteSize() => 9; // Sum of byte sized of all fields (include extended)
        public byte GetMinByteSize() => 9; // of byte sized of fields (exclude extended)
        public int GetByteSize()
        {
            var sum = 0;
            sum+=4; //CustomMode
            sum+= 1; // Type
            sum+= 1; // Autopilot
            sum+= 1; // BaseMode
            sum+= 1; // SystemStatus
            sum+=1; //MavlinkVersion
            return (byte)sum;
        }
        public void Deserialize(ref ReadOnlySpan<byte> buffer)
        {
            CustomMode = BinSerialize.ReadUInt(ref buffer);
            Type = (MavType)BinSerialize.ReadByte(ref buffer);
            Autopilot = (MavAutopilot)BinSerialize.ReadByte(ref buffer);
            BaseMode = (MavModeFlag)BinSerialize.ReadByte(ref buffer);
            SystemStatus = (MavState)BinSerialize.ReadByte(ref buffer);
            MavlinkVersion = (byte)BinSerialize.ReadByte(ref buffer);

        }
        public void Serialize(ref Span<byte> buffer)
        {
            BinSerialize.WriteUInt(ref buffer,CustomMode);
            BinSerialize.WriteByte(ref buffer,(byte)Type);
            BinSerialize.WriteByte(ref buffer,(byte)Autopilot);
            BinSerialize.WriteByte(ref buffer,(byte)BaseMode);
            BinSerialize.WriteByte(ref buffer,(byte)SystemStatus);
            BinSerialize.WriteByte(ref buffer,(byte)MavlinkVersion);
            /* PayloadByteSize = 9 */;
        }
        ...
    }

CLI: Ftp tree

This command provides a tree representation of all available files and directories on the drone's FTP server. It allows users to see the entire file structure in a hierarchical format, making it easy to browse and understand the file layout without navigating through individual folders.

Asv.Mavlink.Shell.exe ftp-tree -cs tcp://127.0.0.1:5760

Features:

  • Display the full directory structure of the drone's file system in a tree format.
  • Automatically refreshes and loads the / and @SYS directories.
  • Displays directories and files with visual guides for better clarity.

You may also use some parameters in the command.

Usage: ftp-tree [options...] [-h|--help] [--version]

Tree representation of all available files and directories on the drones FTP server

Options:
-cs|--connection <string>    The address of the connection to the mavlink device (Required)

image

CLI: Ftp browser

This command is a file manager for interacting with a drone's file system via FTP. It allows users to browse directories, view files, and perform various file operations (e.g., download, rename, remove, etc.) in an interactive console environment. The tool is designed for MAVLink-based systems and provides an intuitive way to manage the drone’s files and directories.

Asv.Mavlink.Shell.exe ftp-browser -cs tcp://127.0.0.1:5760

Features:

  • FTP Connection: The command connects to a drone via TCP using a specified connection string, establishing an FTP client for file interactions.
  • Tree Navigation: The file system is presented in a hierarchical structure using a tree model. The user can browse through directories interactively.
  • File and Directory Operations: The user can:
    • Open directories.
    • Remove, rename, or create directories.
    • Perform file operations such as downloading, removing, truncating, renaming, and calculating CRC32.
Usage: ftp-browser [options...] [-h|--help] [--version]

File manager for interacting with a drones file system via FTP

Options:
  -cs|--connection <string>    The address of the connection to the mavlink device (Required)

image

CLI: Export sdr data

This command extracts SDR (Software Defined Radio) data from a binary file and exports it into a CSV format. The SDR data is deserialized using the AsvSdrRecordDataLlzPayload class, and each record is written as a row in the CSV file with specific data fields such as altitude, signal strength, and power levels.

Features:

  • Reads binary SDR data from an input file.
  • Exports the data to a CSV file for further analysis or storage.
  • Provides a simple and automated way to convert SDR logs into human-readable tabular data.
Asv.Mavlink.Shell.exe export-sdr

You may also use some parameters in the command.

Usage: export-sdr [options...] [-h|--help] [--version]

Export sdt data to csv format

Options:
-i|--input-file <string>     Input file (Required)
-o|--output-file <string>    Output file (Default: @"out.csv")

This command listens to incoming MAVLink packets and displays statistics on the received messages. It allows monitoring of the communication between a ground station and an unmanned vehicle, showing information like the frequency of each type of message and the last few received packets.

Features:

  • Connects to a MAVLink stream via the provided connection string.
  • Displays statistics such as message ID, message frequency, and the last received packets
  • Continually updates the display with real-time data and allows the user to stop the process by pressing 'Q'.
Asv.Mavlink.Shell.exe mavlink

You may also use some parameters in the command.

Usage: mavlink [options...] [-h|--help] [--version]

Listen MAVLink packages and print statistic

Options:
  -cs|--connection <string>    Connection string. Default "tcp://127.0.0.1:5760" (Default: null)

image

CLI: Proxy

This command is used to connect a vehicle with multiple ground stations, creating a hub that routes MAVLink messages between them. It provides flexible filtering options to log specific MAVLink messages, and can output the filtered data to a file. It supports multiple connections (UDP or serial) and can operate in silent mode (without printing to the console).

Features:

  • Connects to multiple MAVLink streams, allowing you to route messages between different systems (e.g., vehicle and multiple ground stations).
  • Supports filtering by system ID, message ID, message name (using regex), and message content (JSON text).
  • Can log filtered MAVLink messages to a file.
  • Allows disabling console output for silent operation.
  • Automatically propagates MAVLink messages between the connected links.
Asv.Mavlink.Shell.exe proxy -l tcp://127.0.0.1:5762 -l tcp://127.0.0.1:7341 -o out.txt

You may also use some parameters in the command.

Usage: proxy [options...] [-h|--help] [--version]

Used for connecting vehicle and several ground station
     Example: proxy -l udp://192.168.0.140:14560 -l udp://192.168.0.140:14550 -o out.txt

Options:
  -l|--links <string[]>            Add connection to hub. Can be used multiple times. Example: udp://192.168.0.140:45560 or serial://COM5?br=57600 (Required)
  -o|--output-file <string>        Write filtered message to file (Default: null)
  -silent|--silent                 Disable print filtered message to screen (Optional)
  -sys|--sys-ids <int[]>           Filter for logging: system id field (Example: -sys 1 -sys 255) (Default: null)
  -id|--msg-ids <int[]>            Filter for logging: message id field (Example: -id 1 -mid 255) (Default: null)
  -name|--name-pattern <string>    Filter for logging: regex message name filter (Example: -name MAV_CMD_D) (Default: null)
  -txt|--text-pattern <string>     Filter for logging: regex json text filter (Example: -txt MAV_CMD_D) (Default: null)
  -from|--directions <int[]>       Filter for packet direction: select only input packets from the specified direction (Default: null)

CLI: Benchmark-serialization

This command benchmarks the serialization and deserialization performance of MAVLink packets. It uses BenchmarkDotNet to measure the efficiency of the serialization process, focusing on how MAVLink packets are serialized and deserialized using spans.### Features:

  • Connects to multiple MAVLink streams, allowing you to route messages between different systems (e.g., vehicle and multiple ground stations).
  • Supports filtering by system ID, message ID, message name (using regex), and message content (JSON text).
  • Can log filtered MAVLink messages to a file.
  • Allows disabling console output for silent operation.
  • Automatically propagates MAVLink messages between the connected links.
Asv.Mavlink.Shell.exe benchmark-serialization

image

CLI: Devices info

This command shows info about the mavlink device and all other mavlink devices that are connected to it.

Asv.Mavlink.Shell.exe devices-info -cs "tcp://127.0.0.1:7341"

image

You may also use some parameters in the command to customise the output

Usage: devices-info [options...] [-h|--help] [--version]

Command that shows info about devices in the mavlink network

Options:
-cs|--connection-string <string>    The address of the connection to the mavlink device (Required)
-i|--iterations <uint?>             States how many iterations should the program work through (Default: null)
-dt|--devices-timeout <uint>        (in seconds) States the lifetime of a mavlink device that shows no Heartbeat (Default: 10)
-r|--refresh-rate <uint>            (in ms) States how fast should the console be refreshed (Default: 3000)

Full possible command with all the parameters

Asv.Mavlink.Shell.exe devices-info -cs "tcp://127.0.0.1:7341" -i 400 -dt 20 -r 1000

CLI: Packet Viewer

Asv.Mavlink.Shell.exe packetviewer --connection tcp://127.0.0.1:5762

This command starts the console implementation of packet viewer.

image

Packet Viewer sets up the Mavlink router and waits for a connection using parameters provided in the command line. Launch a real drone or simulator to connect and start receiving packets from it. Once the connection is established, the packets will be displayed in the "Packets" section below.

It provides the following actions:

  • Search for the packet you need;
  • Adjust the size of the output;
  • Pause the output;
  • Safely terminate the execution;

By default, the viewer has no filters enabled and displays all received packets.

CLI: Generate fake diagnostic data

This command generates fake diagnostic with customizable frequency.

Asv.Mavlink.Shell.exe generate-diagnostics

image

The program generates a default configuration file by default, but you can provide a custom configuration. Simply pass the path to your configuration file as a command-line parameter.

Note: config is a json file.

Asv.Mavlink.Shell.exe generate-diagnostics -cfg "path/to/your/cfg.json"

All the possible parameters for the command:

Usage: generate-diagnostics [options...] [-h|--help] [--version]

Command creates fake diagnostics data from file and opens a mavlink connection.

Options:
  -cfg|--cfg-path <string?>    location of the config file for the generator (Default: null)
  -r|--refresh-rate <uint>     (in ms) States how fast should the console be refreshed (Default: 2000)

Full command with all the parameters

Asv.Mavlink.Shell.exe generate-diagnostics -cfg "path/to/your/cfg.json" -r 3000

CLI: Test diagnostic data

This command creates Diagnostic client and prints all diagnostics that the client retrieves.

Asv.Mavlink.Shell.exe test-diagnostics -cs tcp://127.0.0.1:7342?srv=true -tsid 1 -tcid 241 -r 3000

image

All the possible parameters for the command:

Command creates diagnostic client that retrieves diagnostic data.

Options:
  -cs|--connection-string <string>      The address of the connection to the mavlink diagnostic server (Required)
  -tsid|--target-system-id <byte>       Server's system id (Required)
  -tcid|--target-component-id <byte>    Server's component id (Required)
  -r|--refresh-rate <uint>              (in ms) States how fast should the console be refreshed (Default: 1000)

CLI: Create Virtual Ftp server

This command creates ftp server and opens connection to it.

Asv.Mavlink.Shell.exe run-ftp-server

image

The program generates a default configuration file by default, but you can provide a custom configuration. Simply pass the path to your configuration file as a command-line parameter.

Note: config is a json file.

Asv.Mavlink.Shell.exe run-ftp-server -cfg "path/to/your/cfg.json"

All the possible parameters for the command:

Usage: run-ftp-server [options...] [-h|--help] [--version]

Command creates virtual ftp server.

Options:
  -cfg|--cfg-path <string?>    location of the config file (Default: null)
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Asv.Mavlink:

Package Downloads
Asv.Mavlink.Vehicle

Mavlink library for .NET 6.0, .NET 7.0 for vehicle control Px4, Ardupilot

Asv.Mavlink.Payload

Mavlink library for .NET 6.0, .NET 7.0 for vehicle control Px4, Ardupilot

Asv.Mavlink.Gbs

Mavlink library for .NET 6.0, .NET 7.0 for controlling ground base station with RTK support

Asv.Mavlink.Sdr

Mavlink library for .NET 6.0, .NET 7.0 for controlling SDR payload

Asv.Drones.Gui.Api

API reference for Asv.Drones GUI application

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.0.0 160 5/26/2025
3.10.5 328 12/7/2024
3.10.3 342 8/20/2024
3.10.2 228 7/5/2024
3.10.0 520 7/3/2024
3.9.2 219 6/19/2024
3.9.1 135 6/16/2024
3.9.0 155 6/10/2024
3.8.0-alpha06 201 5/14/2024
3.8.0-alpha05 97 5/14/2024
3.8.0-alpha03 92 5/13/2024
3.8.0-alpha02 71 5/2/2024
3.8.0-alpha01 130 4/17/2024
3.7.1 246 3/26/2024
3.7.0 175 3/2/2024
3.7.0-alpha02 273 1/19/2024
3.7.0-alpha01 112 1/8/2024
3.6.0-alpha13 140 12/29/2023
3.6.0-alpha12 156 12/18/2023
3.6.0-alpha11 237 12/7/2023
3.6.0-alpha10 109 12/7/2023
3.6.0-alpha09 120 12/6/2023
3.6.0-alpha08 230 11/28/2023
3.6.0-alpha07 168 11/22/2023
3.6.0-alpha06 121 11/21/2023
3.6.0-alpha05 117 11/21/2023
3.6.0-alpha04 102 11/20/2023
3.6.0-alpha03 98 11/20/2023
3.6.0-alpha02 105 11/20/2023
3.6.0-alpha01 108 11/20/2023
3.5.0-alpha10 132 11/14/2023
3.5.0-alpha09 112 11/14/2023
3.5.0-alpha08 107 11/13/2023
3.5.0-alpha07 105 11/13/2023
3.5.0-alpha06 106 11/8/2023
3.5.0-alpha05 108 11/8/2023
3.5.0-alpha04 110 11/8/2023
3.5.0-alpha03 121 11/6/2023
3.5.0-alpha02 128 11/4/2023
3.5.0-alpha01 121 11/4/2023
3.4.2-alpha11 141 10/25/2023
3.4.2-alpha10 155 10/7/2023
3.4.2-alpha09 127 10/7/2023
3.4.2-alpha08 130 10/7/2023
3.4.2-alpha07 128 10/5/2023
3.4.2-alpha06 126 10/5/2023
3.4.2-alpha05 128 10/5/2023
3.4.2-alpha04 118 10/5/2023
3.4.2-alpha03 123 10/4/2023
3.4.2-alpha02 130 10/4/2023
3.4.2-alpha01 125 10/3/2023
3.4.1 309 9/30/2023
3.4.0 166 9/30/2023
3.3.8 169 9/16/2023
3.3.7 217 9/14/2023
3.3.6 165 9/11/2023
3.3.5-alpha-07 154 9/4/2023
3.3.5-alpha-06 134 8/31/2023
3.3.5-alpha-05 128 8/25/2023
3.3.5-alpha-04 120 8/24/2023
3.3.5-alpha-03 138 8/22/2023
3.3.4 180 8/18/2023
3.3.3 229 8/14/2023
3.3.2 231 8/10/2023
3.3.1-alpha-05 169 8/8/2023
3.3.1-alpha-04 135 8/8/2023
3.3.1-alpha-03 159 8/4/2023
3.3.1-alpha-01 151 8/4/2023
3.3.0 182 8/4/2023
3.2.5-alpha-20 154 8/2/2023
3.2.5-alpha-18 174 7/10/2023
3.2.5-alpha-17 153 7/5/2023
3.2.5-alpha-16 218 7/3/2023
3.2.5-alpha-15 156 7/3/2023
3.2.5-alpha-14 168 6/27/2023
3.2.5-alpha-13 153 6/23/2023
3.2.5-alpha-10 139 6/20/2023
3.2.5-alpha-07 164 6/20/2023
3.2.5-alpha-06 167 5/18/2023
3.2.5-alpha-05 144 5/18/2023
3.2.5-alpha-04 170 5/16/2023
3.2.5-alpha-02 152 5/9/2023
3.2.3 399 4/24/2023
3.2.2 216 4/23/2023
3.2.1 198 4/22/2023
3.2.0 207 4/22/2023
3.1.0 234 4/17/2023
3.0.2 244 4/17/2023
3.0.0 234 4/16/2023
2.1.2 411 4/11/2023
2.1.1 421 4/5/2023
2.1.0 371 4/5/2023
2.0.4 352 3/28/2023
2.0.3 327 3/28/2023
2.0.2 350 3/27/2023
2.0.1 360 3/23/2023
2.0.0 369 3/22/2023
1.2.2 411 3/21/2023
1.2.1 382 3/21/2023
1.2.0 370 3/20/2023
1.1.11 321 3/20/2023
1.1.10 519 2/27/2023
1.1.9 427 2/27/2023
1.1.7 441 2/27/2023
1.1.6 507 2/19/2023
1.1.5 456 2/19/2023
1.1.4 458 2/14/2023
1.1.3 730 11/14/2022
1.1.2 709 11/9/2022
1.1.1 699 11/7/2022
1.1.0 722 10/31/2022
1.0.0 929 9/21/2022