Gazebo Simulation

Hi All,

Followed the documentation to run the simulator on my Jetson Xavier NX. I was a little confused by the docs and the behavior. Here is my terminal output. I’m never able to execute any commands but Gazeboi does start with the vehicle. I assume I’m missing something. Any help is greatly appreciated.

(ros) magneto@magneto-desktop:~/catkin_ws/src/Firmware$ make px4_sitl gazebo
[0/4] Performing build step for 'sitl_gazebo'
ninja: no work to do.
[3/4] cd /home/magneto/catkin_ws/src/F...ws/src/Firmware/build/px4_sitl_default
SITL ARGS
sitl_bin: /home/magneto/catkin_ws/src/Firmware/build/px4_sitl_default/bin/px4
debugger: none
program: gazebo
model: none
world: none
src_path: /home/magneto/catkin_ws/src/Firmware
build_path: /home/magneto/catkin_ws/src/Firmware/build/px4_sitl_default
empty model, setting iris as default
GAZEBO_PLUGIN_PATH :/home/magneto/catkin_ws/src/Firmware/build/px4_sitl_default/build_gazebo:/home/magneto/catkin_ws/src/Firmware/build/px4_sitl_default/build_gazebo
GAZEBO_MODEL_PATH :/home/magneto/catkin_ws/src/Firmware/Tools/sitl_gazebo/models:/home/magneto/catkin_ws/src/Firmware/Tools/sitl_gazebo/models
LD_LIBRARY_PATH /home/magneto/catkin_ws/devel/lib:/opt/ros/melodic/lib:/home/magneto/catkin_ws/src/Firmware/build/px4_sitl_default/build_gazebo:/home/magneto/catkin_ws/src/Firmware/build/px4_sitl_default/build_gazebo
empty world, setting empty.world as default
SITL COMMAND: "/home/magneto/catkin_ws/src/Firmware/build/px4_sitl_default/bin/px4" "/home/magneto/catkin_ws/src/Firmware"/ROMFS/px4fmu_common -s etc/init.d-posix/rcS -t "/home/magneto/catkin_ws/src/Firmware"/test_data
INFO  [px4] Creating symlink /home/magneto/catkin_ws/src/Firmware/ROMFS/px4fmu_common -> /home/magneto/catkin_ws/src/Firmware/build/px4_sitl_default/tmp/rootfs/etc

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

px4 starting.

INFO  [px4] Calling startup script: /bin/sh etc/init.d-posix/rcS 0
INFO  [param] selected parameter default file eeprom/parameters_10016
[param] parameter file not found, creating eeprom/parameters_10016
  SYS_AUTOCONFIG: curr: 0 -> new: 1
* SYS_AUTOSTART: curr: 0 -> new: 10016
  BAT_N_CELLS: curr: 0 -> new: 3
  CAL_ACC0_ID: curr: 0 -> new: 1311244
  CAL_GYRO0_ID: curr: 0 -> new: 1311244
  CAL_MAG0_ID: curr: 0 -> new: 197388
  CBRK_SUPPLY_CHK: curr: 0 -> new: 894281
  COM_RC_IN_MODE: curr: 0 -> new: 1
  EKF2_ANGERR_INIT: curr: 0.1000 -> new: 0.0100
  EKF2_GBIAS_INIT: curr: 0.1000 -> new: 0.0100
  COM_ARM_EKF_AB: curr: 0.0022 -> new: 0.0050
  EKF2_REQ_GPS_H: curr: 10.0000 -> new: 0.5000
  MC_PITCH_P: curr: 6.5000 -> new: 6.0000
  MC_PITCHRATE_P: curr: 0.1500 -> new: 0.2000
  MC_ROLL_P: curr: 6.5000 -> new: 6.0000
  MC_ROLLRATE_P: curr: 0.1500 -> new: 0.2000
  MPC_Z_VEL_P_ACC: curr: 4.0000 -> new: 12.0000
  MPC_Z_VEL_I_ACC: curr: 2.0000 -> new: 3.0000
  MPC_XY_P: curr: 0.9500 -> new: 0.8000
  MPC_XY_VEL_P_ACC: curr: 1.8000 -> new: 4.0000
  MPC_XY_VEL_D_ACC: curr: 0.2000 -> new: 0.3200
  RTL_RETURN_ALT: curr: 60.0000 -> new: 30.0000
  SDLOG_MODE: curr: 0 -> new: 1
  SDLOG_PROFILE: curr: 1 -> new: 131
  SDLOG_DIRS_MAX: curr: 0 -> new: 7
  SENS_BOARD_X_OFF: curr: 0.0000 -> new: 0.0000
  SENS_DPRES_OFF: curr: 0.0000 -> new: 0.0010
  TRIG_INTERFACE: curr: 4 -> new: 3
  COM_CPU_MAX: curr: 90.0000 -> new: -1.0000
  IMU_INTEG_RATE: curr: 200 -> new: 250
  NAV_ACC_RAD: curr: 10.0000 -> new: 2.0000
  RTL_DESCEND_ALT: curr: 30.0000 -> new: 10.0000
  RTL_LAND_DELAY: curr: -1.0000 -> new: 0.0000
  PWM_MAX: curr: 2000 -> new: 1950
  PWM_MIN: curr: 1000 -> new: 1075
  GPS_UBX_DYNMODEL: curr: 7 -> new: 6
* SYS_AUTOCONFIG: curr: 1 -> new: 0
INFO  [dataman] Unknown restart, data manager file './dataman' size is 11798680 bytes
INFO  [simulator] Waiting for simulator to accept connection on TCP port 4560
Gazebo multi-robot simulator, version 9.14.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
[http://gazebosim.org](http://gazebosim.org/)

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ [http://127.0.0.1:11345](http://127.0.0.1:11345/)
[Msg] Publicized address: 192.168.1.207

I was expecting something to happen here? Where I could enter commands I see in the doc.

@murthax It means that your gazebo is not starting properly. Running SITL on arm platforms are not a common usecase and therefore not tested.

Therefore you would need to debug what is wrong with your Jetson Xavier environment

I had the same issue where launching PX4 SITL gave me the info message:

INFO [simulator] Waiting for simulator to accept connection on TCP port 4560

I changed this so that the simulator would connect by changing it to connect on UDP port 14560.

This works on the latest master branch (commit Dec 14 13:04:01). I tried testing the latest stable release for some reason did not work.

in /build/px4_sitl_default/etc/init.d-posix/rcS after line 107 add the following:
simulator_udp_port = $((14560+px4_instance))

and change line 213 to:
simulator start -u $simulator_udp_port

in /Tools/sitl_gazebo/models/iris/iris.sdf (or whichever PX4 model you are working with )change line 506 to
<use_tcp>0</use_tcp>

The simulator now connects and I am able to do commands such as commander takeoff and use mavros in OFFBOARD mode.

I am using an Nvidia Jetson AGX Xavier. Good luck!