Multi-Vehicle Gazebo/ROS Simulation? Real-Time Factor: 0.1

Hi. I’m trying to run a Gazebo/ROS simulation with two different vehicles, two UAVs (or more) and one rover. I’ve tested with iris/typhoon and rover/r1_rover, but any combination of two different vehicles drastically reduce the real-time factor (RTF). I have a RTF of 1.0 with multiple typhoons, but an iris and a rover (ackermann or r1_rover) reduces the RTF to less than 0.3. Using typhoons is worst. The computer I’m running the simulation in is not an issue.

I have:

  • PX4 v.1.11
  • mavros 1.3.0
  • Gazebo 7.16
  • ROS Kinetic
  • Ubuntu 16.04

I’m running roslaunch px4 multi_uav_mavros_sitl_sdf.launch and inside I change the vehicles to run 2 or 3 iris/typhoon and 1 rover/r1_rover.

@fulano Please try with latest master

Thank you @Jaeyoung-Lim, I’ve updated the firmware —actually, I’ve changed the workspaces in use, to follow px4 instructions.

Now I have a RTF around 0.7 (much more than 0.1, and I can probably run simulations with that), but the gimbal of the Typhoons seems rogue:

I don’t know if there was a change in the way it must be controlled. I’m using the same commands as in your humantracking_controller, but the gimbal started stable before.
Is it necessary to configure the gimbal now? How?

Thank you again.

Hi again. I’ve cleaned up the workspaces a littlebit and got back to RTF=0.1 with three r1_rover or rover. 3 Typhoons alone have RTF=1, and 3 Iris also. 2 Typhoons or Iris, with any 1 rover: RTF < 0.1. I leave below my configuration and the process I followed, in case I’m doing something wrong.

@Jaeyoung-Lim which are the commit or commits that fix this issue? Maybe I can read something from there.

I have 2 different workspaces, one for my code (~/ws/app), and one for other’s (~/ws/px4). Using ~/catkin_ws for everything caused me troubles. In my .bashrc I source both, extending mine over px4, and px4 over /opt/ros/kinetic/setup.bash.

These are the steps I followed to update px4:

  1. update mavlink/mavros to 1.4.0 (from ~/ws/px4, using catkin build)
  2. mkdir -p ~/src && cd src && git clone px4/Firmware --recursive
  3. make px4_sitl gazebo_typhoon_h480
  4. catkin build in ~/ws/app

Now, each time sometimes when I do roslaunch px4 multi_uav_mavros_sitl_sdf.launch vehicle:=$VEHICLE, with any vehicle in {iris, typhoon_h480, r1_rover, rover}, I get the following error:

[uav1/sitl_1-7] process has died [pid 72228, exit code -11, cmd /home/sim/src/Firmware/build/px4_sitl_default/bin/px4 /home/sim/src/Firmware/build/px4_sitl_default/etc -s etc/init.d-posix/rcS -i 1 -w sitl_r1_rover_1 -d __name:=sitl_1 __log:=/home/sim/.ros/log/0a734bbe-fc5d-11ea-8aaa-0242ac120011/uav1-sitl_1-7.log].
log file: /home/sim/.ros/log/0a734bbe-fc5d-11ea-8aaa-0242ac120011/uav1-sitl_1-7*.log

although gazebo gui starts and the vehicles are spawned.

This is the end of my .bashrc:

source /usr/share/gazebo/setup.sh
source /opt/ros/kinetic/setup.bash
source ~/ws/px4/devel/setup.bash --extend
source ~/ws/app/devel/setup.bash --extend
export PX4=$HOME/src/Firmware
source ${PX4}/Tools/setup_gazebo.bash ${PX4} ${PX4}/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:${PX4}
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:${PX4}/Tools/sitl_gazebo

The following is the output of env (I’ve replaced /home/sim with ~ and left only ROS/Gazebo related variables):

ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_PACKAGE_PATH=~/ws/app/src/nav:~/ws/app/src/nav_apps:~/ws/app/src/nav_controller:~/ws/app/src/nav_trajectory:~/ws/px4/src/catkin_simple:~/ws/px4/src/eigen_catkin:~/ws/px4/src/mavlink:~/ws/px4/src/mavros/libmavconn:~/ws/px4/src/mavros_controllers/mavros_controllers:~/ws/px4/src/mavros/mavros_msgs:~/ws/px4/src/mavros_controllers/controller_msgs:~/ws/px4/src/mavros/mavros:~/ws/px4/src/mavros/mavros_extras:~/ws/px4/src/mavros_controllers/geometric_controller:~/ws/px4/src/humantracking_controller:~/ws/px4/src/mavros/test_mavros:~/ws/px4/src/mavros_controllers/trajectory_publisher:/opt/ros/kinetic/share:~/src/Firmware:~/src/Firmware/Tools/sitl_gazebo
GAZEBO_MODEL_PATH=/usr/share/gazebo-7/models::~/src/Firmware/Tools/sitl_gazebo/models
ROS_PYTHON_VERSION=2
ROS_VERSION=1
LD_LIBRARY_PATH=~/ws/app/devel/lib:~/ws/px4/devel/lib:/home/user/qgroundcontrol/usr/lib/x86_64-linux-gnu:/home/user/qgroundcontrol/Qt/libs:/opt/ros/kinetic/lib:/opt/ros/kinetic/lib/x86_64-linux-gnu:/usr/local/lib/x86_64-linux-gnu:/usr/local/lib/i386-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/i386-linux-gnu:/usr/lib/x86_64-linux-gnu/gazebo-7/plugins:/usr/lib/x86_64-linux-gnu/gazebo-7/plugins:~/src/Firmware/build/px4_sitl_default/build_gazebo
GAZEBO_RESOURCE_PATH=/usr/share/gazebo-7:
PATH=/opt/ros/kinetic/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/bin:/usr/bin:/opt/VirtualGL/bin:/usr/local/bin:/usr/bin:/usr/games:/usr/local/games
GAZEBO_MASTER_URI=http://localhost:11345
ROSLISP_PACKAGE_DIRECTORIES=~/ws/app/devel/share/common-lisp:~/ws/px4/devel/share/common-lisp
ROS_DISTRO=kinetic
GAZEBO_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/gazebo-7/plugins::~/src/Firmware/build/px4_sitl_default/build_gazebo
PYTHONPATH=:/usr/local/lib/python2.7/dist-packages:/opt/ros/kinetic/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages:/usr/local/lib/python3.5/dist-packages:~/ws/app/devel/lib/python2.7/dist-packages:~/ws/px4/devel/lib/python2.7/dist-packages:/opt/ros/kinetic/lib/python2.7/dist-packages
PKG_CONFIG_PATH=~/ws/app/devel/lib/pkgconfig:~/ws/px4/devel/lib/pkgconfig:/opt/ros/kinetic/lib/pkgconfig:/opt/ros/kinetic/lib/x86_64-linux-gnu/pkgconfig
GAZEBO_MODEL_DATABASE_URI=http://models.gazebosim.org
CMAKE_PREFIX_PATH=~/ws/app/devel:~/ws/px4/devel:/opt/ros/kinetic
ROS_ETC_DIR=/opt/ros/kinetic/etc/ros