FastRTPS and the microRTPS agent are needed on NavQ in order to bridge uORB topics from PX4 to ROS2 on NavQ over a UART or UDP connection. Follow the guide below to build and install these packages.
NOTE: FastRTPS and PX4 ROS Com work differently from MAVROS (ROS1). PX4 ROS Com subscribes to uORB topics rather than MAVLINK messages. See below for a diagram of how microRTPS and PX4 ROS Com works.
Follow the link below for more details on microRTPS and PX4 ROS Com:
First, we will install the FastRTPS project from eProsima. Use the following commands below to do so:
Next, we will build and install the necessary software that will allow us to use ROS2 to communicate with the microRTPS bridge. First, run the following commands:
URGENT: Building px4_ros_com requires a lot of ram. Enabling a swap disk is highly recommended. This will take up 1GB of space on your storage medium.
Run the following commands to enable a 1GB swapfile:
Now, build the workspace:
This will take a long time to build on NavQ. In our experience, it takes anywhere from 45 minutes to an hour. Make sure you have a stable connection to NavQ over UART or SSH, and do not let the NavQ lose power!
In order to run all of your specific ROS2 software successfully, you must source the install/setup.bash files in each of your ROS2 workspace folders. Add the following lines to your .bashrc to do so:
Continue to the next page to set up a systemd
service that will automatically start the micrortps agent on your NavQ. The guide will also cover how to automatically start the client on the FMU.
[WORK IN PROGRESS]
NOTE: This guide is currently a work in progress. Some details may not be finished.
In this section, we will guide you through the process needed to detect AprilTags on your NavQ. There are a few things that need to be done to accomplish this:
Install ROS2 image tools
Build and install AprilTag detection nodes
Calibrate the camera on your NavQ using a checkerboard pattern
Run!
Before we start, you will need a few things:
To create a checkerboard for camera calibration, download this PDF: https://www.mrpt.org/downloads/camera-calibration-checker-board_9x7.pdf
In order to calibrate the camera, you will need to set up your NavQ with a mouse, keyboard, and monitor. Use the included microUSB hub and HDMI connector to do so.
Install the following packages with the apt
package manager by running the commands below:
Once that is finished, move on to the next step.
This section is a consolidation of the specific commands for the NavQ. If you run into any issues with this section of the guide, email landon.haugh@nxp.com and refer to the official guide: https://navigation.ros.org/tutorials/docs/camera_calibration.html
Hook up your NavQ to a monitor with the provided HDMI cord and connect a USB mouse + keyboard through the included microUSB hub. Open the terminal by clicking the icon at the top left of the screen and open the bash shell by running:
Have your printed checkerboard ready in a well lit environment and run the camera calibration software by running the following commands:
Now use the link in the note above to run through calibarating the camera.
A prerequisite for the apriltag_ros
node is apriltag_msgs
. Clone the repo and build it by running these commands:
Make sure to source the install/setup.bash file so that apriltag_msgs
can see it when being built.
First, in order to detect AprilTags, we need to build the apriltag_ros
node written by christianrauch. You can clone his repository by using this git repo:
To make his repo work with ROS2 Foxy, you will need to make a small change in the CMakeLists.txt file. Go to line 26 in that file and delete the apriltag::
token in the AprilTagNode apriltag::apriltag
part.
Next, you'll want to save that file and run colcon build
in the apriltag_ros folder. Once it is done building, you'll want to source the install/setup.bash
file. Add this line to your .bashrc
:
In order to make the apriltag_ros
node work, we need to make sure that camera info messages are being sent in sync with each camera frame published by the cam2image
node. We have written an example node that does just that. You can download it here:
You will need to replace the matrices in the node file to match your camera calibration parameters. The source file is located at pypysub/py_pysub/publisher_member_function.py
. Once you have done that, make sure to build and install the node and source the install/setup.bash
file.
To run the code, you'll need to run the following ROS nodes:
Generate a start up script for the micrortps client under /usr/local/bin
with content
Save the file and exit nano. Make the file executable
Generate a systemd service file to start the startup script at boot
with content
Save the file and exit nano. Check if the process starts
You should see an state active (running), quit with <q> Enable the systemd service file finally to be active at boot