I’m using Ubuntu 22.04, ROS2 Humble, Gazebo classic for developing environment.
And have some trouble with adding own custom tiltrotor model.
This files below is what i modified it
/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models/ # put my custom model sdf file
/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/airframes # add custom model's parameters and modify CMakeLists.txt
After that i just type ‘make px4_sitl command’ and result is
ubuntu@ubuntu-laptop:~/PX4-Autopilot$ make px4_sitl gazebo-classic_titan_hornet
ninja: error: unknown target 'gazebo-classic_titan_hornet'
make: *** [Makefile:232: px4_sitl] Error 1
My custom model’s name is titan_hornet and i would appreciate it if let me know which files should i modify to use custom model on gazebo classic.
Also other models on gazebo classic works well.
To add a custom vehicle for use with Gazebo Classic SITL, follow these steps:
- Navigate to the directory:
PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models
.
- Create a new directory for your model. For example:
titan_hornet
.
- Inside your model directory, create two files:
- An SDF (Simulation Description Format) file.
- A model configuration file.
- Navigate to the directory:
PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/airframes
.
- Create a new airframe for your model, prefacing the filename with
gazebo-classic
. For example:
5001_gazebo-classic_titan_hornet
.
- In the same directory, add your airframe to the CMake file by including it in the
px4_add_romfs_files()
function.
- Navigate to:
PX4-Autopilot/src/modules/simulation/simulator_mavlink
.
- Add your vehicle to the sitl_targets_gazebo-classic configuration (e.g.,
set(models ...)
).
- After completing these steps, you can launch Gazebo Classic with your custom model using the following command:
make px4_sitl gazebo-classic_titan_hornet
.
You can look the following Create custom model for SITL for more details
The information in that thread is outdated.
Slight correction: [22000, 22999] are reserved for custom models, so it is recommended to use these numbers as a prefix (e.g., 22000_gazebo-classic_titan_hornet
).