Skip to content

Library to interface with PX4 from a companion computer using ROS 2

License

Notifications You must be signed in to change notification settings

ARK-Electronics/px4-ros2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PX4 ROS 2 Interface Library

Library to interface with PX4 from a companion computer using ROS 2. It provides some tooling to used to write external modes that are dynamically registered with PX4 and behave the same way as internal ones. A mode can send different types of setpoints, ranging from high-level navigation tasks all the way down to direct actuator controls.

Documentation:

Compatibility with PX4

The library interacts with PX4 by using its uORB messages, and thus requires a matching set of message definitions on the ROS 2 side. Compatibility is only guaranteed if using latest main on the PX4 and px4_ros2/px4_msgs side. This might change in the future.

The library checks for message compatibility on startup when registering a mode. ALL_PX4_ROS2_MESSAGES defines the set of checked messages. If you use other messages, you can check them using:

if (!px4_ros2::messageCompatibilityCheck(node, {{"/fmu/in/vehicle_rates_setpoint"}})) {
  throw std::runtime_error("Messages incompatible");
}

Examples

There are code examples under examples/cpp/modes.

Development

For development, install the pre-commit scripts:

pre-commit install

CI

CI runs a number of checks which can be executed locally with the following commands. Make sure you have the ROS workspace sourced.

clang-tidy

./scripts/run-clang-tidy-on-project.sh

Unit tests

You can either run the unit tests through colcon:

colcon test --packages-select px4_ros2 --ctest-args -R unit_tests
colcon test-result --verbose

Or directly from the build directory, which allows to filter by individual tests:

./build/px4_ros2/px4_ros2_unit_tests --gtest_filter='xy*'

Linters (code formatting etc)

These run automatically when committing code. To manually run them, use:

pre-commit run -a

About

Library to interface with PX4 from a companion computer using ROS 2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 91.3%
  • Python 6.5%
  • CMake 1.8%
  • Shell 0.4%