Create custom model for SITL

HI, i tried:

  • I created a folder under Tools/sitl_gazebo/models for my model, named x4vtail_vtol3
  • I created the following files under Tools/sitl_gazebo/models/x4vtail_vtol3: model.config and x4vtail_vtol3.sdf (which is based off the standard_vtol models in Tools/sitl_gazebo/models)
  • I create my own airframe file in init.d-posix, named 1044_x4vtail_vtol3. Also i will use my own mixer, name x4vtail_vtol3_sitl.main.mix.
  • I added the airframe name to the platforms/posix/cmake/sitl_target.cmake in the command set(models …)
  • And i added name of it to ROMFS/px4fmu_common/mixers-sitl/CMakeLists.txt.
    *Then, i run
cd build
cmake .. 
make
cd ..

*When i run
make px4_sitl gazebo_x4vtail_vtol3
it gets stuck at INFO [simulator] Waiting for simulator to accept connection on TCP port 4560 and gazebo do not open, here is the result:

[0/1] Re-running CMake...
-- PX4 version: v1.12.1
-- PX4 config file: /home/x/PX4-Autopilot/boards/px4/sitl/default.cmake
-- PX4 config: px4_sitl_default
-- PX4 platform: posix
-- PX4 lockstep: enabled
-- cmake build type: RelWithDebInfo
-- Building for code coverage
-- ccache enabled (export CCACHE_DISABLE=1 to disable)
-- build type is RelWithDebInfo
-- PX4 ECL: Very lightweight Estimation & Control Library v1.9.0-rc1-591-gb3fed06
-- ROMFS: ROMFS/px4fmu_common
-- Configuring done
-- Generating done
-- Build files have been written to: /home/x/PX4-Autopilot/build/px4_sitl_default
[0/4] Performing build step for 'sitl_gazebo'
ninja: no work to do.
[3/4] cd /home/x/PX4-Autopilot/build/px4_sitl_default/t...-Autopilot /home/x/PX4-Autopilot/build/px4_sitl_default
SITL ARGS
sitl_bin: /home/x/PX4-Autopilot/build/px4_sitl_default/bin/px4
debugger: none
program: gazebo
model: x4vtail_vtol3
world: none
src_path: /home/x/PX4-Autopilot
build_path: /home/x/PX4-Autopilot/build/px4_sitl_default
GAZEBO_PLUGIN_PATH :/home/x/PX4-Autopilot/build/posix_sitl_default/build_gazebo:/home/x/PX4-Autopilot/build/posix_sitl_default/build_gazebo:/home/x/PX4-Autopilot/build/posix_sitl_default/build_gazebo:/home/x/PX4-Autopilot/build/px4_sitl_default/build_gazebo
GAZEBO_MODEL_PATH :/home/x/PX4-Autopilot/Tools/sitl_gazebo/models:/home/x/PX4-Autopilot/Tools/sitl_gazebo/models:/home/x/PX4-Autopilot/Tools/sitl_gazebo/models:/home/x/PX4-Autopilot/Tools/sitl_gazebo/models
LD_LIBRARY_PATH /home/x/catkin_ws/devel/lib:/opt/ros/melodic/lib:/home/x/PX4-Autopilot/build/posix_sitl_default/build_gazebo:/home/x/PX4-Autopilot/build/posix_sitl_default/build_gazebo:/home/x/PX4-Autopilot/build/posix_sitl_default/build_gazebo:/home/x/PX4-Autopilot/build/px4_sitl_default/build_gazebo
empty world, setting empty.world as default
Using: /home/x/PX4-Autopilot/Tools/sitl_gazebo/models/x4vtail_vtol3/x4vtail_vtol3.sdf
/home/x/PX4-Autopilot/Tools/sitl_run.sh: line 201: 30918 Segmentation fault      (core dumped) gzserver $verbose $world_path
SITL COMMAND: "/home/x/PX4-Autopilot/build/px4_sitl_default/bin/px4" "/home/x/PX4-Autopilot/build/px4_sitl_default"/etc -s etc/init.d-posix/rcS -t "/home/x/PX4-Autopilot"/test_data
INFO  [px4] Creating symlink /home/x/PX4-Autopilot/build/px4_sitl_default/etc -> /home/x/PX4-Autopilot/build/px4_sitl_default/tmp/rootfs/etc

______  __   __    ___ 
| ___ \ \ \ / /   /   |
| |_/ /  \ V /   / /| |
|  __/   /   \  / /_| |
| |     / /^\ \ \___  |
\_|     \/   \/     |_/

px4 starting.

INFO  [px4] Calling startup script: /bin/sh etc/init.d-posix/rcS 0
Info: found model autostart file as SYS_AUTOSTART=1044
INFO  [param] selected parameter default file eeprom/parameters_1044
[param] parameter file not found, creating eeprom/parameters_1044
  SYS_AUTOCONFIG: curr: 0 -> new: 1
  SYS_AUTOSTART: curr: 0 -> new: 1044
  CAL_ACC0_ID: curr: 0 -> new: 1310988
  CAL_GYRO0_ID: curr: 0 -> new: 1310988
  CAL_ACC1_ID: curr: 0 -> new: 1310996
  CAL_GYRO1_ID: curr: 0 -> new: 1310996
  CAL_ACC2_ID: curr: 0 -> new: 1311004
  CAL_GYRO2_ID: curr: 0 -> new: 1311004
  CAL_MAG0_ID: curr: 0 -> new: 197388
  CAL_MAG1_ID: curr: 0 -> new: 197644
  SENS_BOARD_X_OFF: curr: 0.0000 -> new: 0.0000
  SENS_DPRES_OFF: curr: 0.0000 -> new: 0.0010
Gazebo multi-robot simulator, version 9.19.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
* SYS_AUTOCONFIG: curr: 1 -> new: 0
  IMU_INTEG_RATE: curr: 200 -> new: 250
INFO  [dataman] Unknown restart, data manager file './dataman' size is 11798680 bytes
PX4 SIM HOST: localhost
INFO  [simulator] Waiting for simulator to accept connection on TCP port 4560

I have no idea about it ,can you help me? Please and Thanks! :sob:

I once added this model in another computer through the above steps. At that time, it could be successfully added, and my plane could fly normally. But this time I followed the same steps and failed. I don’t know why.

1 Like

I have the same problem
if anyone could help, it would be appreciated.
to find the solution to this problem, I used the iris model but just changed the name to something else, and I got the following errors:
@Jaeyoung-Lim Jaeyoung-Lim

[0/4] Performing build step for 'sitl_gazebo'
ninja: no work to do.
[3/4] cd /home/aminys/PX4-Autopilot/bu...s/PX4-Autopilot/build/px4_sitl_default
SITL ARGS
sitl_bin: /home/aminys/PX4-Autopilot/build/px4_sitl_default/bin/px4
debugger: none
program: gazebo
model: HB_x500
world: none
src_path: /home/aminys/PX4-Autopilot
build_path: /home/aminys/PX4-Autopilot/build/px4_sitl_default
GAZEBO_PLUGIN_PATH :/home/aminys/PX4-Autopilot/build/px4_sitl_default/build_gazebo
GAZEBO_MODEL_PATH :/home/aminys/PX4-Autopilot/Tools/sitl_gazebo/models
LD_LIBRARY_PATH :/home/aminys/PX4-Autopilot/build/px4_sitl_default/build_gazebo
empty world, setting empty.world as default
Using: /home/aminys/PX4-Autopilot/Tools/sitl_gazebo/models/HB_x500/HB_x500.sdf
Warning [parser.cc:833] XML Attribute[version] in element[sdf] not defined in SDF, ignoring.
Error [Param.cc:329] Invalid boolean value
Error [Param.cc:329] Invalid boolean value
Error [Param.cc:449] Invalid argument. Unable to set value [{{ mavlink_udp_port }} ] for key[mavlink_udp_port].
Error [Param.cc:449] Invalid argument. Unable to set value [{{ mavlink_tcp_port }} ] for key[mavlink_tcp_port].
SITL COMMAND: "/home/aminys/PX4-Autopilot/build/px4_sitl_default/bin/px4" "/home/aminys/PX4-Autopilot/build/px4_sitl_default"/etc -s etc/init.d-posix/rcS -t "/home/aminys/PX4-Autopilot"/test_data
Creating symlink /home/aminys/PX4-Autopilot/build/px4_sitl_default/etc -> /home/aminys/PX4-Autopilot/build/px4_sitl_def

I have a question, if I change let’s say the box size in the sdf file, will the physical properties change like will it simulate according to real life conditions based on the measurements given