๐งAsv.Mavlink
.NET Mavlink library and CLI for .NET
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.
Installation
To install the asv-mavlink
library, you can use the following command:
CLI: 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.
Executing this command launches an emulator for an ADS-B receiver, generating and transmitting ADSB_VEHICLE data packets for virtual vehicles. These packets include information such as position, speed, and other ADS-B message parameters. The vehicles and their respective parameters are specified in the configuration file.
Configuration file
If the configuration file does not exist, the command generates a default configuration file named adsb.json
with two vehicles that fly in a box pattern over an airport.
Configuration file: Base properies
Configuration file: Connections
You can add multiple ports at once. All packets will be routed by other ports.
Configuration file: Vehicles
Base properties are needed to fill ADSB_VEHICLE. You can add multiple route points and different velocities for each point. Velocity will be interpolated between points. Latitude and Longitude can be in DMS or angle format (see GeoPointLatitudeTest.cs and GeoPointLongitudeTest.cs). Altitude is in meters. Velocity is in three dimensions in m/s. It will be separated by ground and vertical velocity if altitude between two route points is different. Velocity must be greater than 0.
Here's an example of ADSB utility being used with Asv.Drones.
Here's an example of ADSB utility being used with Mission Planner
CLI: Packet code generation
Generate C# code for packet serialization\deserialization
This command load XML file with mavlink packet definition
And generate CSharp file, like this:
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.
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.
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.
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.
You may also use some parameters in the command.
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.
You may also use some parameters in the command.
CLI: Mavlink
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'.
You may also use some parameters in the command.
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.
You may also use some parameters in the command.
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.
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.
CLI: Devices info
This command shows info about the mavlink device and all other mavlink devices that are connected to it.
You may also use some parameters in the command to customise the output
Full possible command with all the parameters
CLI: Packet Viewer
This command starts the console implementation of packet viewer.
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.
Last updated