Home        Store        Docs        Blog

Issue with linking SITL with Gazebo


(Khay Liang) #1

Hi, I’m trying to set up SITL on Gazebo. I have been following the steps provided in the guide here, and I’ve encountered an error.

The SITL seems to be unable to connect with the Gazebo simulation, and the output on the console is as shown below:

The terminal where I am running SITL from is stuck at

Waiting for heartbeat from tcp:127.0.0.1:5760

Here’s the console output for SITL:

sim_vehicle.py -f gazebo-bluerov2 -L RATBeach --out=udp:0.0.0.0:14550 --console
SIM_VEHICLE: Start
SIM_VEHICLE: Killing tasks
SIM_VEHICLE: Starting up at 33.810313,-118.393867,0,270 (RATBeach)
SIM_VEHICLE: WAF build
SIM_VEHICLE: Configure waf
SIM_VEHICLE: "/home/kl/SAUVC/ardupilot/modules/waf/waf-light" "configure" "--board" "sitl"
Setting top to                           : /home/kl/SAUVC/ardupilot 
Setting out to                           : /home/kl/SAUVC/ardupilot/build 
Autoconfiguration                        : enabled 
Setting board to                         : sitl 
Checking for 'g++' (C++ compiler)        : /usr/bin/g++ 
Checking for 'gcc' (C compiler)          : /usr/bin/gcc 
Checking for c flags '-MMD'              : yes 
Checking for cxx flags '-MMD'            : yes 
Checking for need to link with librt     : not necessary 
Checking for HAVE_CMATH_ISFINITE         : yes 
Checking for HAVE_CMATH_ISINF            : yes 
Checking for HAVE_CMATH_ISNAN            : yes 
Checking for NEED_CMATH_ISFINITE_STD_NAMESPACE : yes 
Checking for NEED_CMATH_ISINF_STD_NAMESPACE    : yes 
Checking for NEED_CMATH_ISNAN_STD_NAMESPACE    : yes 
Checking for header endian.h                   : yes 
Checking for header byteswap.h                 : yes 
Checking for HAVE_MEMRCHR                      : yes 
Checking for program 'python'                  : /usr/bin/python 
Checking for python version >= 2.7.0           : 2.7.12 
Checking for program 'python'                  : /usr/bin/python 
Checking for python version >= 2.7.0           : 2.7.12 
Source is git repository                       : yes 
Update submodules                              : yes 
Checking for program 'git'                     : /usr/bin/git 
Checking for program 'size'                    : /usr/bin/size 
Benchmarks                                     : disabled 
Unit tests                                     : enabled 
Scripting                                      : disabled 
Scripting runtime checks                       : enabled 
Checking for program 'rsync'                   : /usr/bin/rsync 
'configure' finished successfully (0.858s)
SIM_VEHICLE: Building
SIM_VEHICLE: "/home/kl/SAUVC/ardupilot/modules/waf/waf-light" "build" "--target" "bin/ardusub"
Waf: Entering directory `/home/kl/SAUVC/ardupilot/build/sitl'
Waf: Leaving directory `/home/kl/SAUVC/ardupilot/build/sitl'

BUILD SUMMARY
Build directory: /home/kl/SAUVC/ardupilot/build/sitl
Target       Text     Data  BSS    Total  
------------------------------------------
bin/ardusub  1473358  2318  40640  1516316

Build commands will be stored in build/sitl/compile_commands.json
'build' finished successfully (0.992s)
SIM_VEHICLE: Using defaults from (/home/kl/SAUVC/ardupilot/Tools/autotest/default_params/sub.parm)
SIM_VEHICLE: Run ArduSub
SIM_VEHICLE: "/home/kl/SAUVC/ardupilot/Tools/autotest/run_in_terminal_window.sh" "ArduSub" "/home/kl/SAUVC/ardupilot/build/sitl/bin/ardusub" "-S" "-I0" "--home" "33.810313,-118.393867,0,270" "--model" "gazebo-bluerov2" "--speedup" "1" "--defaults" "/home/kl/SAUVC/ardupilot/Tools/autotest/default_params/sub.parm"
SIM_VEHICLE: Run MavProxy
SIM_VEHICLE: "mavproxy.py" "--master" "tcp:127.0.0.1:5760" "--sitl" "127.0.0.1:5501" "--out" "127.0.0.1:14550" "--out" "127.0.0.1:14551" "--out" "udp:0.0.0.0:14550" "--console"
RiTW: Starting ArduSub : /home/kl/SAUVC/ardupilot/build/sitl/bin/ardusub -S -I0 --home 33.810313,-118.393867,0,270 --model gazebo-bluerov2 --speedup 1 --defaults /home/kl/SAUVC/ardupilot/Tools/autotest/default_params/sub.parm
Connect tcp:127.0.0.1:5760 source_system=255
Loaded module console
Log Directory: 
Telemetry log: mav.tlog
Waiting for heartbeat from tcp:127.0.0.1:5760

Output for Gazebo:

kl@KL:~/SAUVC/ardupilot/build/px4-v2/ArduSub$ gazebo worlds/underwater.world -u
kl@KL:~/SAUVC/ardupilot/build/px4-v2/ArduSub$ cd ..
kl@KL:~/SAUVC/ardupilot/build/px4-v2$ cd ..
kl@KL:~/SAUVC/ardupilot/build$ cd ..
kl@KL:~/SAUVC/ardupilot$ cd ..
kl@KL:~/SAUVC$ ls
ardupilot  Gazebo  PyMAVLink  QGroundControl.AppImage  SITL
kl@KL:~/SAUVC$ cd Gazebo
kl@KL:~/SAUVC/Gazebo$ ls
ardupilot_gazebo  freebuoyancy_gazebo
kl@KL:~/SAUVC/Gazebo$  git clone https://github.com/patrickelectric/bluerov_ros_playground
Cloning into 'bluerov_ros_playground'...
remote: Enumerating objects: 1278, done.
remote: Total 1278 (delta 0), reused 0 (delta 0), pack-reused 1278
Receiving objects: 100% (1278/1278), 33.26 MiB | 888.00 KiB/s, done.
Resolving deltas: 100% (764/764), done.
Checking connectivity... done.
kl@KL:~/SAUVC/Gazebo$ cd bluerov_ros_playground/
kl@KL:~/SAUVC/Gazebo/bluerov_ros_playground$ source gazebo.sh
GAZEBO_MODEL_PATH    = /home/kl/SAUVC/Gazebo/bluerov_ros_playground/model:/usr/share/gazebo-7/models:
GAZEBO_RESOURCE_PATH = /home/kl/SAUVC/Gazebo/bluerov_ros_playground/worlds:/usr/share/gazebo-7:/usr/share/gazebo_models:
Done! 
kl@KL:~/SAUVC/Gazebo/bluerov_ros_playground$ gazebo worlds/underwater.world -u
Loading freebuoyancy_gazebo plugin...
Loaded freebuoyancy_gazebo plugin.
Buoyancy plugin: Added 4 buoy links from BlueRov2

Gazebo can simulate the ROV, but SITL doesn’t seem to be able to connect to the port. Any idea why that is so?


(Patrick José Pereira) #2

Hi,

Are you able to run SITL alone without gazebo ? Are you running Gazebo before starting SITL ?


(Khay Liang) #3
  1. Yes, I’m able to run SITL alone

  2. Yup, I started Gazebo first before running SITL.


(Patrick José Pereira) #4

Hi Khay,

Thank you for your feedback, just to confirm, what is the output of gazebo --version ?


(Khay Liang) #5
Gazebo multi-robot simulator, version 7.0.0
Copyright (C) 2012-2016 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org


Gazebo multi-robot simulator, version 7.0.0
Copyright (C) 2012-2016 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

(Khay Liang) #6

here’s what I got when I ran gazebo with --verbose

gazebo --verbose worlds/underwater.world -u
Gazebo multi-robot simulator, version 7.0.0
Copyright (C) 2012-2016 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
Gazebo multi-robot simulator, version 7.0.0
Copyright (C) 2012-2016 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 172.19.134.173
[Msg] Publicized address: 172.19.134.173
[Wrn] [msgs.cc:1655] Conversion of sensor type[imu] not suppported.
[Wrn] [Event.cc:87] Warning: Deleteing a connection right after creation. Make sure to save the ConnectionPtr from a Connect call
[Err] [Plugin.hh:165] Failed to load plugin libArduPilotPlugin.so: libArduPilotPlugin.so: cannot open shared object file: No such file or directory
Loading freebuoyancy_gazebo plugin...
Loaded freebuoyancy_gazebo plugin.
[Wrn] [msgs.cc:1655] Conversion of sensor type[imu] not suppported.
[Wrn] [msgs.cc:1655] Conversion of sensor type[imu] not suppported.
[Err] [Scene.cc:2927] Light [sun] not found. Use topic ~/factory/light to spawn a new light.

Could the issue be that the gazebo master IP is different from the IP provided by SITL? The SITL Gazebo interface IP was 127.0.0.1:9002.


(Patrick José Pereira) #7

It appears that your gazebo installation is missing the Light object and having some problems with the IMU. Also, it’s not finding the libArduPilotPlugin.so that is necessary to do the ardupilot <-> Gazebo communication.

Try to install it with this instructions.


(Khay Liang) #8

Hi. I moved the plugins from the gazebo-7.0 file to gazebo-7, and nearly everything works now. However I’m still getting the error

[Wrn] [msgs.cc:1655] Conversion of sensor type[imu] not suppported.

When I move forward with PWM of 2000 the AUV pitches upwards significantly too.

Is this to be expected or did I install something wrongly?


(Patrick José Pereira) #9

Hi,

This will happen if you are running without the stabilize mode, or any other that has attitude control.


(Jacob) #10

There are some hydrodynamic effects that can cause pitching at high speed. If you need it to be absolutely level, try adding some more thrusters for active stabilization in 6DOF.