How mavlink/mavros works
This project is a ROS-based communication system that implements MAVLink connectivity – in other words, it provides a MAVLink extendable communication node for ROS. The repository is organized into several dedicated packages, each with a specific role:
Project type and purpose
• The README makes it clear that the project (“MAVROS”) is a communication node that bridges MAVLink (used in autopilots and UAVs) with ROS.
• It is composed of multiple related packages: the main MAVROS package (the core ROS node), mavros_extras (additional nodes and plugins), libmavconn (a standalone library providing low-level communication support), mavros_msgs (message and service definitions), and test_mavros (for manual and SITL testing).
Key directories and their architectural roles
• libmavconn – Provides abstracted communication interfaces (serial, TCP, UDP) which the core node relies upon for actual data transfer. It is both used by MAVROS and can be employed independently outside ROS.
• mavros_msgs – Houses the definitions for custom messages and service calls. This is critical for defining the ROS interfaces that the node exposes.
• mavros_extras – Contains extra plugins and nodes that extend core functionalities provided by MAVROS.
• test_mavros – Contains test harnesses and demonstration setups, particularly for SITL (Software In The Loop) testing of APM and PX4 environments.
a. Main Components:
• ROS Middleware: The central nervous system that MAVROS integrates with.
• Core MAVROS Node: Represented as a container/component that processes incoming MAVLink messages and publishes/subscribes to ROS topics and services.
• mavros_msgs: A dedicated component that defines the data contracts (messages and services) which the core node uses to interact with other ROS nodes.
• mavros_extras: An extendable set of plugins that plug into the core node to provide additional functionality (like advanced command control, sensor data processing, etc.).
• External Systems/Hardware: Represent autopilot hardware or simulators (e.g., SITL for APM and PX4). This illustrates how MAVROS acts as a bridge between them and the ROS ecosystem.
b. Relationships and Data Flow:
• The core node utilizes the mavros_msgs definitions to send and receive ROS topics and services.
• MAVROS_extras plugins are connected to the core node, processing or augmenting data flows.
• In a testing environment, test_mavros simulates external inputs and verifies outputs.
c. Architectural Patterns / Design Principles:
• Modular design: Separation into distinct packages (core, extras, messages, low-level communication) promotes clear boundaries and independent development/testing.
• Plugin architecture: The extras and command modules indicate extensibility.
• Middleware abstraction: libmavconn abstracts protocol-specific communication details.
d. Relevant Technologies, Frameworks and Libraries:
• ROS (Robot Operating System) forms the backbone for inter-node communication.
• MAVLink protocol is key to communicating with UAV/autopilot hardware.
• CMake is used for build configuration across packages.
• Python scripts and shell scripts appear in testing and deployment contexts.
• Use clear labels for each major component (e.g., “MAVROS Core Node”, “libmavconn (TCP/UDP/Serial)”, “mavros_msgs”, “MAVROS Extras”, “External Autopilot/Simulators”).
• From External Autopilot hardware → libmavconn modules → MAVROS Core Node → ROS Topics/Services (via mavros_msgs).
• From MAVROS Core Node → MAVROS Extras (plugins) where additional processing occurs.
• Rectangles for ROS nodes,
• Document symbols for message/service definitions.
Putting it all together
• Expand into a lower-level view that reflects both the internal structure (core node and its dependencies) and the external interactions (hardware/simulators).