How to Use P3D with ROS2 PX4 and Gazebo
Firstly, insert the plugin libgazebo_ros_p3d
to the model.
The ModelPlugin is inserted in the SDF inside the model element.
Project PX4-Autopilot use jinja generate the SDF file.
Inside the code to /PX4-Autopilot/Tools/sitl_gazebo/models/iris/iris.sdf.jinja
before build the project.
1 | <plugin name='p3d_base_controller' filename='libgazebo_ros_p3d.so'> |
Before run rhe PX4 simulation , build and install gazebo_ros_pkgs from Source.
This is very important.
Build the PX4-Autopilot.
1 | cd PX4-Autopilot/ |
Run
make clean
beforerun make px4_sitl gazebo
, otherwise you can not generate the SDF file by jinja temple.
install gazebo_ros_pkgs before run
make px4_sitl gazebo
, otherwise you can not load the pluginlibgazebo_ros_p3d
.
Check the topic.
Open another terminal and run.
1 | ros2 topic list |