Skip to main content

PX4

Common

uorb top This command uorb top displays the publishing frequency of each topic in real time:

listener sensor_accel 5

ls /obj

uxrce_dds_client status

stop show

commander

Debugging

Using PlotJuggler to plot uORB topic

This topic shows how to use PlotJuggler and the uXRCE-DDS agent to graph "live" values of a uORB topic.

The technique uses the PX4 uXRCE-DDS middleware to export uORB topics as ROS2 topics, which PlotJuggler can then read and plot changes to (PlotJuggler cannot read uORB topics directly, but the values of the corresponding ROS 2 topics are the same).

The video below demonstrates this using a simulated vehicle – the approach also works on real hardware.

Prerequisites

Install by following the ROS 2 installation and setup instructions in the ROS 2 User Guide:

  • ROS 2
  • Tiny XRCE-DDS Proxy
  • PX4/px4_msgs: PX4/ROS2 shared message definitions.
  • PX4 source code and build the simulator. hint If you are using real hardware instead of a simulator, you only need the PX4 source code if you need to change the set of topics published to ROS 2 (only a subset of uORB topics are published by default).

You will also need to install:

Usage

First, we need to build a ROS 2 workspace that contains the files corresponding to the PX4 version we want to monitor, and then start PlotJuggler in that workspace. This will allow ROS 2 and PlotJuggler to parse the messages. If you are using unmodified PX4, you can use the definitions in PX4/px4_msgs.px4_msgs

information

This is the same process described in Building a ROS 2 Workspace in ROS 2 Installation and Setup.

Assuming your ROS 2 workspace is named, ~/ros2_ws/ get and build the package in your terminal as follows:px4_msgs

cd ~/ros2_ws/src/
git clone https://github.com/PX4/px4_msgs.git
cd ..
colcon build
source install/setup.bash

Then run PlotJuggler by entering the following command in Terminal:

ros2 run plotjuggler plotjuggler

To start sending ROS 2 topics from PX4, the uXRCE-DDS client must be running on PX4 and MicroXRCEAgent must be running on the same machine as PlotJuggler.