Robots and drones
DRT 344 Automation, Robotics and Intelligent Control Systems
Lesson
By the end of this module you will be able to
- Explain the core ROS 2 concepts of nodes, topics, services, actions and QoS
- Explain how ROS 2 connects to PX4 through uXRCE-DDS, and the role of MAVROS
- Convert coordinates between NED and ENU frames
- Calculate the latency budget of a data chain from sensor to flight controller
- Design an architecture integrating drones, robots and automation
Why this matters
Drones running complex missions, such as detecting objects with AI and following them automatically, usually split the work in two: a flight controller that keeps flight safe (PX4 or ArduPilot), and a companion computer that runs heavy work such as AI, mapping and planning. The middleware that ties these together, and connects them to ground robots, is ROS 2. Data going up to a control centre or industrial systems uses MQTT or OPC UA (module 1).
ROS 2 is like a robot’s nervous system. Each organ (node) sends signals along nerves (topics) without needing to know who receives them, so organs can be added or replaced without rebuilding the whole system.
Core ROS 2 concepts
| Concept | Meaning | Example in drone work |
|---|---|---|
| Node | One program doing a specific job | Camera node, object-detection node, planner node |
| Topic | A continuous publish/subscribe data channel | Camera images, drone position |
| Service | A one-off request and response | Request a flight-mode change |
| Action | A long-running task with feedback that can be cancelled | Fly to a position and report progress |
| QoS | Delivery policy, e.g. reliable or fast, how many messages to keep | Sensor data uses the sensor-data QoS profile |
ROS 2 releases a new distribution every May. On the date checked (26 September 2026), supported distributions were Humble Hawksbill (to May 2027), Jazzy Jalisco (to May 2029), Kilted Kaiju (to December 2026) and Lyrical Luth, released 22 May 2026 (to May 2031). Long-running projects should choose a long-support distribution and pin versions to those supported by the flight stack’s documentation.
Connecting ROS 2 to the flight controller
- PX4 uses the uXRCE-DDS middleware: a client on PX4 and an agent on the companion computer exchange data both ways over serial, UDP or TCP, so PX4’s internal topics appear directly as ROS 2 topics. The PX4 guide recommends ROS 2 Jazzy on Ubuntu 24.04, or Humble on Ubuntu 22.04
- MAVROS bridges the MAVLink protocol and ROS 2 for any MAVLink flight controller, supporting Humble and newer
- ArduPilot has its own ROS 2 documentation; follow the method matching your software version
Different coordinate frames
The PX4 guide states that PX4 uses a NED world frame (x north, y east, z down) and an FRD body frame (forward, right, down), while ROS uses ENU (x east, y north, z up) and FLU (forward, left, up) per REP 105. Any node talking to PX4 must convert frames every time. Forget, and the drone may fly the wrong way or descend instead of climb.
Example 1 Converting a position from NED to ENU
PX4 reports a NED position of m: 10 m north, 5 m east and 3 m up (D is negative).
In ENU: m
If a ROS 2 node wants the drone at ENU but sends those numbers to PX4 unconverted, PX4 reads N = 5, E = 10, D = 3, which is 3 m below the take-off point: the horizontal axes are swapped and the vertical direction reversed, so the drone tries to fly into the ground. This mistake is very common, so use the px4_ros_com frame-transform library and always test in SITL first.
Latency budget
A system that detects with AI and then commands the drone must add up the latency of every stage in the data chain, while the drone keeps moving.
Example 2 How far does the drone move before the command arrives?
The chain’s latencies: image into the node 5 ms, AI detection 12 ms, topic to the planner node 3 ms, and uXRCE-DDS over serial to PX4 8 ms. The drone flies at 10 m/s.
- ms
- m
That 0.28 m must be included in the avoidance margin. A much slower AI model increases it, and message queues backing up in MQTT or ROS 2 can make data stale (see the MQTT deep-dive knowledge unit on data freshness and queues).
Integration architecture
Design principles:
- Separate safety-critical functions from mission functions, so flight controllers and PLCs stay safe on their own even if mission computers or networks fail
- Choose protocols by layer: DDS/ROS 2 inside robots, MQTT or OPC UA to enterprise systems, MAVLink or uXRCE-DDS to flight controllers
- Secure every layer: encrypt and authenticate, especially channels that can command real equipment
- Design for testing: use SITL and simulation before connecting real hardware
| Use case | Components working together |
|---|---|
| Smart warehouse | Barcode-reading drones, carrier robots, warehouse management system (ISA-95 level 3) |
| Automated dock | PLC opens the lid and charges; drones fly on schedule; control centre via MQTT |
| Infrastructure inspection | Drones image from above, ground robots inspect up close, maps merged through ROS 2 |
| Drone swarms | Several drones coordinate positions over a network (see the LoRa Mesh swarm deep-dive knowledge unit) |
Class activity
Activity: Designing a warehouse system with drones and robots
Read the deep-dive knowledge unit “From embedded systems to AI robots and ROS” in the drone knowledge hub first.
- Draw the system’s ROS 2 graph, naming nodes, topics, services and actions.
- Choose how to connect to the flight controller and mark where frames must be converted.
- Calculate the latency budget of the obstacle-detection chain and how far the drone moves meanwhile.
- Place all components in the Figure 2 architecture, and state what each does to stay safe if the network fails.
Common mistakes
Watch out
- Forgetting NED/ENU conversion between ROS 2 and PX4
- Using an end-of-life ROS 2 distribution, or one not supported by the flight stack’s documentation
- Making the mission computer the primary safety authority instead of the flight controller
- Ignoring AI and network latency in safety margins
- Leaving command channels unencrypted on networks others can reach
Summary
- ROS 2 connects nodes through topics, services and actions over DDS, with QoS policies
- PX4 connects to ROS 2 through uXRCE-DDS; MAVROS bridges MAVLink and ROS 2
- PX4 uses NED/FRD while ROS uses ENU/FLU; convert position as
- A latency budget sums every stage of the data chain; distance moved is
- Good architecture separates safety from mission functions and chooses protocols by layer
Check your understanding
- To command a drone to a point with progress reports along the way, should you use a topic, a service or an action?
- PX4 reports NED position m. What is it in ENU?
- A data chain has 40 ms total latency and the drone flies at 15 m/s. How far does it move?
- Which ROS 2 distribution was released in May 2026?
- Why should the mission computer not be the primary safety authority?
Answers
- An action, because it is long-running, gives feedback along the way and can be cancelled
- m
- m
- Lyrical Luth (22 May 2026)
- The mission computer runs complex software that may hang or crash; the flight controller must keep the aircraft safe through its own failsafes even if the mission computer stops
Key formulas
| NED to ENU vector conversion | |
| Latency budget of a data chain |
Key references
- Open Robotics. ROS 2 documentation. link
- PX4 Autopilot. ROS 2 user guide (uXRCE-DDS bridge and frame conventions). PX4 user guide (main). link
- MAVLink Development Team. MAVROS: MAVLink to ROS gateway (ROS 2). link
- MAVLink Development Team. MAVLink developer guide. link
- OASIS. (2019). MQTT version 5.0 (OASIS Standard, 7 March 2019). link
- International Electrotechnical Commission. (2025). OPC unified architecture – Part 1: Overview and concepts (IEC 62541-1:2025). link
- International Society of Automation. ISA-95 standard: Enterprise-control system integration (ANSI/ISA-95, IEC 62264). link
- Chung, S.-J., Paranjape, A. A., Dames, P., Shen, S., & Kumar, V. (2018). A survey on aerial swarm robotics. IEEE Transactions on Robotics, 34(4), 837–855.
Further reading
Study the assigned knowledge units in advance, review media and take the module quiz
Topic 3: Robotics & autonomous systems
ROS 2 and flight-stack integration
Deep dive: from embedded systems to AI robots and ROS
Deep dive: coordinating drone swarms over LoRa mesh networks
Drone communications and MAVLink
In class / field
Lecture, case discussion and in-class problem solving
Learning evidence: Quiz results and submitted exercises