This package provides example nodes for exchanging data and commands between ROS2 and PX4.
It also provides a library to ease the conversion between ROS2 and PX4 frame conventions.
It has a straight dependency on the px4_msgs
package.
Check the uXRCE-DDS and the ROS2 Interface sections on the PX4 Devguide for details on how to install the required dependencies, build the package and use it.
Use the Issues section to create a new issue. Report your issue or feature request here.
Reach the PX4 development team on the PX4 Discord Server.
- Start SITL:
PX4_GZ_WORLD=walls make px4_sitl gz_x500_depth
Variables PX4_GZ_WORLD=<world_name>
.
- Run MicroDDS:
MicroXRCEAgent udp4 -p 8888; bash
- Run offboard control as follows:
ros2 launch px4_ros_com offboard_control.launch.py
Gazebo world is located in:
Starting gazebo with world: /root/sitl/PX4-Autopilot/Tools/simulation/gz/worlds/default.sdf
Run ros_gz_bridge to move image from the gz_sim to the ROS 2:
ros2 run ros_gz_image image_bridge /world/walls/model/x500_depth_0/link/camera_link/sensor/IMX214/image /rgb_cam/image
Run ros_gz_bridge to move wrench from the gz_sim to ROS 2
ros2 run ros_gz_bridge parameter_bridge /world/walls/model/x500_stick_0/joint/cap_fixed_joint/sensor/force_torque/forcetorque@geometry_msgs/msg/Wrench@gz.msgs.Wrench
Full force torque mapping command with topic name remapping:
ros2 run ros_gz_bridge parameter_bridge /world/walls/model/x500_stick_0/joint/cap_fixed_joint/sensor/force_torque/forcetorque@geometry_msgs/msg/Wrench@gz.msgs.Wrench --ros-args -r /world/walls/model/x500_stick_0/joint/cap_fixed_joint/sensor/force_torque/forcetorque:=/measured_force
Set params here:
param set NAV_RCL_ACT 0
param set NAV_DLL_ACT 0