Issue with linking SITL with Gazebo

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?

Hi,

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

  1. Yes, I’m able to run SITL alone

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

Hi Khay,

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

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

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.

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.

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?

Hi,

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

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.

1 Like

Hi, I am also facing link 1 down problem and downloaded from this repo and followed instructions I follow all the steps above but I am getting those output

For the SITL console:

> 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.0, 270.0] (RATBeach)
> SIM_VEHICLE: WAF build
> SIM_VEHICLE: Configure waf
> SIM_VEHICLE: "/home/boran/ardupilot/modules/waf/waf-light" "configure" "--board" "sitl"
> Setting top to                           : /home/boran/ardupilot 
> Setting out to                           : /home/boran/ardupilot/build 
> Autoconfiguration                        : enabled 
> Setting board to                         : sitl 
> Using toolchain                          : native 
> Checking for 'g++' (C++ compiler)        : /usr/lib/ccache/g++ 
> Checking for 'gcc' (C compiler)          : /usr/lib/ccache/gcc 
> Checking for c flags '-MMD'              : yes 
> Checking for cxx flags '-MMD'            : yes 
> Checking for need to link with librt     : not necessary 
> Checking for feenableexcept              : yes 
> 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'                  : /home/boran/anaconda3/bin/python 
> Checking for python version >= 2.7.0           : 3.7.4 
> Checking for program 'python'                  : /home/boran/anaconda3/bin/python 
> Checking for python version >= 2.7.0           : 3.7.4 
> 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                                      : enabled 
> Scripting runtime checks                       : enabled 
> Checking for program 'rsync'                   : /usr/bin/rsync 
> 'configure' finished successfully (1.567s)
> SIM_VEHICLE: Building
> SIM_VEHICLE: "/home/boran/ardupilot/modules/waf/waf-light" "build" "--target" "bin/ardusub"
> Waf: Entering directory `/home/boran/ardupilot/build/sitl'
> Waf: Leaving directory `/home/boran/ardupilot/build/sitl'
> 
> BUILD SUMMARY
> Build directory: /home/boran/ardupilot/build/sitl
> Target       Text     Data   BSS    Total  
> -------------------------------------------
> Build commands will be stored in build/sitl/compile_commands.json
> 'build' finished successfully (3.712s)
> SIM_VEHICLE: Using defaults from (/home/boran/ardupilot/Tools/autotest/default_params/sub.parm)
> SIM_VEHICLE: Run ArduSub
> SIM_VEHICLE: "/home/boran/ardupilot/Tools/autotest/run_in_terminal_window.sh" "ArduSub" "/home/boran/ardupilot/build/sitl/bin/ardusub" "-S" "--model" "gazebo-bluerov2" "--speedup" "1" "--defaults" "/home/boran/ardupilot/Tools/autotest/default_params/sub.parm" "-I0" "--home" "33.810313,-118.39386700000001,0.0,270.0"
> SIM_VEHICLE: Run MavProxy
> SIM_VEHICLE: "mavproxy.py" "--out" "udp:0.0.0.0:14550" "--console" "--out" "127.0.0.1:14550" "--out" "127.0.0.1:14551" "--master" "tcp:127.0.0.1:5760" "--sitl" "127.0.0.1:5501"
> RiTW: Starting ArduSub : /home/boran/ardupilot/build/sitl/bin/ardusub -S --model gazebo-bluerov2 --speedup 1 --defaults /home/boran/ardupilot/Tools/autotest/default_params/sub.parm -I0 --home 33.810313,-118.39386700000001,0.0,270.0
> 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
>  MAV> 
> 
> 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.0, 270.0] (RATBeach)
> SIM_VEHICLE: WAF build
> SIM_VEHICLE: Configure waf
> SIM_VEHICLE: "/home/boran/ardupilot/modules/waf/waf-light" "configure" "--board" "sitl"
> Setting top to                           : /home/boran/ardupilot 
> Setting out to                           : /home/boran/ardupilot/build 
> Autoconfiguration                        : enabled 
> Setting board to                         : sitl 
> Using toolchain                          : native 
> Checking for 'g++' (C++ compiler)        : /usr/lib/ccache/g++ 
> Checking for 'gcc' (C compiler)          : /usr/lib/ccache/gcc 
> Checking for c flags '-MMD'              : yes 
> Checking for cxx flags '-MMD'            : yes 
> Checking for need to link with librt     : not necessary 
> Checking for feenableexcept              : yes 
> 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'                  : /home/boran/anaconda3/bin/python 
> Checking for python version >= 2.7.0           : 3.7.4 
> Checking for program 'python'                  : /home/boran/anaconda3/bin/python 
> Checking for python version >= 2.7.0           : 3.7.4 
> 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                                      : enabled 
> Scripting runtime checks                       : enabled 
> Checking for program 'rsync'                   : /usr/bin/rsync 
> 'configure' finished successfully (1.567s)
> SIM_VEHICLE: Building
> SIM_VEHICLE: "/home/boran/ardupilot/modules/waf/waf-light" "build" "--target" "bin/ardusub"
> Waf: Entering directory `/home/boran/ardupilot/build/sitl'
> Waf: Leaving directory `/home/boran/ardupilot/build/sitl'
> 
> BUILD SUMMARY
> Build directory: /home/boran/ardupilot/build/sitl
> Target       Text     Data   BSS    Total  
> -------------------------------------------
> bin/ardusub  2260073  87576  79136  2426785
> 
> Build commands will be stored in build/sitl/compile_commands.json
> 'build' finished successfully (3.712s)
> SIM_VEHICLE: Using defaults from (/home/boran/ardupilot/Tools/autotest/default_params/sub.parm)
> SIM_VEHICLE: Run ArduSub
> SIM_VEHICLE: "/home/boran/ardupilot/Tools/autotest/run_in_terminal_window.sh" "ArduSub" "/home/boran/ardupilot/build/sitl/bin/ardusub" "-S" "--model" "gazebo-bluerov2" "--speedup" "1" "--defaults" "/home/boran/ardupilot/Tools/autotest/default_params/sub.parm" "-I0" "--home" "33.810313,-118.39386700000001,0.0,270.0"
> SIM_VEHICLE: Run MavProxy
> SIM_VEHICLE: "mavproxy.py" "--out" "udp:0.0.0.0:14550" "--console" "--out" "127.0.0.1:14550" "--out" "127.0.0.1:14551" "--master" "tcp:127.0.0.1:5760" "--sitl" "127.0.0.1:5501"
> RiTW: Starting ArduSub : /home/boran/ardupilot/build/sitl/bin/ardusub -S --model gazebo-bluerov2 --speedup 1 --defaults /home/boran/ardupilot/Tools/autotest/default_params/sub.parm -I0 --home 33.810313,-118.39386700000001,0.0,270.0
> 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
>  MAV> 

For the Gazebo:

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


[Msg] Waiting for master.
Gazebo multi-robot simulator, version 9.0.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.


[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.1.26
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.1.26
[Dbg] [ArduPilotPlugin.cc:575] [BlueRov2] Please specify a jointName, where the control channel is attached.
[Dbg] [ArduPilotPlugin.cc:575] [BlueRov2] Please specify a jointName, where the control channel is attached.
[Dbg] [ArduPilotPlugin.cc:575] [BlueRov2] Please specify a jointName, where the control channel is attached.
[Dbg] [ArduPilotPlugin.cc:575] [BlueRov2] Please specify a jointName, where the control channel is attached.
[Dbg] [ArduPilotPlugin.cc:575] [BlueRov2] Please specify a jointName, where the control channel is attached.
[Dbg] [ArduPilotPlugin.cc:575] [BlueRov2] Please specify a jointName, where the control channel is attached.
Loading freebuoyancy_gazebo plugin...
Loaded freebuoyancy_gazebo plugin.
Buoyancy plugin: Added 4 buoy links from BlueRov2

and here my Gazebo version :

Gazebo multi-robot simulator, version 9.0.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.

Gazebo multi-robot simulator, version 9.0.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.

Gazebo is launching with dbg problems but it is working and SITL also can works alone.
Additionally I tried with ArduCopter for testing and it works correctly.

Did you hit the play button in the simulation ?

Yes I did and it gives this message

Buoyancy plugin: Added 4 buoy links from BlueRov2

Hi, I’m running into this same issue - SITL and Gazebo not linking up and getting “link 1 down” in the SITL console. Gazebo runs and I’m able to hit play on the simulation (see the ROV plop into the water). SITL is also working independently and I can connect it with QGroundControl. When I run gazebo --verbose I get the following:

> gazebo --verbose worlds/underwater.world -u
> Gazebo multi-robot simulator, version 11.5.0
> Copyright (C) 2012 Open Source Robotics Foundation.
> Released under the Apache 2 License.
> http://gazebosim.org
> 
> [Msg] Waiting for master.
> Gazebo multi-robot simulator, version 11.5.0
> Copyright (C) 2012 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] Publicized address: 192.168.4.115
> [Msg] Loading world file [/home/brad-hartwig/ardupilot_gazebo/build/bluerov_ros_playground/worlds/underwater.world]
> [Msg] Connected to gazebo master @ http://127.0.0.1:11345
> [Msg] Publicized address: 192.168.4.115
> [Err] [Plugin.hh:178] 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] [Publisher.cc:136] Queue limit reached for topic /gazebo/underwater/user_camera/pose, deleting message. This warning is printed only once.
Buoyancy plugin: Added 4 buoy links from BlueRov2

I see I have a similar error to @DoreCorn but I’m struggling to resolve it. I’m working through the troubleshooting steps found here. When I run the command make -j4 I get several errors relating to /usr/include/c++/9/variant; I get similar errors when I execute sudo make install:

> make -j4
> [ 25%] Building CXX object CMakeFiles/ArduPilotPlugin.dir/src/ArduPilotPlugin.cc.o
> [ 25%] Built target ArduCopterIRLockPlugin
> In file included from /usr/include/sdformat-9.5/sdf/Param.hh:30,
>                  from /usr/include/sdformat-9.5/sdf/Element.hh:28,
>                  from /usr/include/sdformat-9.5/sdf/Actor.hh:25,
>                  from /usr/include/sdformat-9.5/sdf/sdf.hh:2,
>                  from /home/brad-hartwig/ardupilot_gazebo/src/ArduPilotPlugin.cc:41:
> /usr/include/c++/9/variant: In instantiation of ‘constexpr std::add_pointer_t<_Tp> std::get_if(std::variant<_Types ...>*) [with _Tp = short unsigned int; _Types = {bool, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::v9::Time, ignition::math::v6::Angle, ignition::math::v6::Color, ignition::math::v6::Vector2<int>, ignition::math::v6::Vector2<double>, ignition::math::v6::Vector3<double>, ignition::math::v6::Quaternion<double>, ignition::math::v6::Pose3<double>}; std::add_pointer_t<_Tp> = short unsigned int*]’:
> /usr/include/sdformat-9.5/sdf/Param.hh:318:34:   required from ‘bool sdf::v9::Param::Get(T&) const [with T = short unsigned int]’
> /usr/include/sdformat-9.5/sdf/Element.hh:511:7:   required from ‘std::pair<T, bool> sdf::v9::Element::Get(const string&, const T&) const [with T = short unsigned int; std::string = std::__cxx11::basic_string<char>]’
> /usr/include/sdformat-9.5/sdf/Element.hh:486:24:   required from ‘T sdf::v9::Element::Get(const string&) const [with T = short unsigned int; std::string = std::__cxx11::basic_string<char>]’
> /home/brad-hartwig/ardupilot_gazebo/src/ArduPilotPlugin.cc:68:12:   required from ‘bool getSdfParam(sdf::v9::ElementPtr, const string&, T&, const T&, const bool&) [with T = short unsigned int; sdf::v9::ElementPtr = std::shared_ptr<sdf::v9::Element>; std::string = std::__cxx11::basic_string<char>]’
> /home/brad-hartwig/ardupilot_gazebo/src/ArduPilotPlugin.cc:978:57:   required from here
> /usr/include/c++/9/variant:1125:42: error: static assertion failed: T should occur for exactly once in alternatives
>  1125 |       static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
>       |                     ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/include/c++/9/variant: In instantiation of ‘struct std::variant_alternative<1, std::variant<ignition::math::v6::Pose3<double> > >’:
> /usr/include/c++/9/variant:100:12:   recursively required from ‘struct std::variant_alternative<15, std::variant<char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::v9::Time, ignition::math::v6::Angle, ignition::math::v6::Color, ignition::math::v6::Vector2<int>, ignition::math::v6::Vector2<double>, ignition::math::v6::Vector3<double>, ignition::math::v6::Quaternion<double>, ignition::math::v6::Pose3<double> > >’
> /usr/include/c++/9/variant:100:12:   required from ‘struct std::variant_alternative<16, std::variant<bool, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::v9::Time, ignition::math::v6::Angle, ignition::math::v6::Color, ignition::math::v6::Vector2<int>, ignition::math::v6::Vector2<double>, ignition::math::v6::Vector3<double>, ignition::math::v6::Quaternion<double>, ignition::math::v6::Pose3<double> > >’
> /usr/include/c++/9/variant:1110:5:   required by substitution of ‘template<long unsigned int _Np, class ... _Types> constexpr std::add_pointer_t<const typename std::variant_alternative<_Np, std::variant<_Types ...> >::type> std::get_if(const std::variant<_Types ...>*) [with long unsigned int _Np = 16; _Types = {bool, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::v9::Time, ignition::math::v6::Angle, ignition::math::v6::Color, ignition::math::v6::Vector2<int>, ignition::math::v6::Vector2<double>, ignition::math::v6::Vector3<double>, ignition::math::v6::Quaternion<double>, ignition::math::v6::Pose3<double>}]’
> /usr/include/c++/9/variant:1128:76:   required from ‘constexpr std::add_pointer_t<_Tp> std::get_if(std::variant<_Types ...>*) [with _Tp = short unsigned int; _Types = {bool, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::v9::Time, ignition::math::v6::Angle, ignition::math::v6::Color, ignition::math::v6::Vector2<int>, ignition::math::v6::Vector2<double>, ignition::math::v6::Vector3<double>, ignition::math::v6::Quaternion<double>, ignition::math::v6::Pose3<double>}; std::add_pointer_t<_Tp> = short unsigned int*]’
> /usr/include/sdformat-9.5/sdf/Param.hh:318:34:   required from ‘bool sdf::v9::Param::Get(T&) const [with T = short unsigned int]’
> /usr/include/sdformat-9.5/sdf/Element.hh:511:7:   required from ‘std::pair<T, bool> sdf::v9::Element::Get(const string&, const T&) const [with T = short unsigned int; std::string = std::__cxx11::basic_string<char>]’
> /usr/include/sdformat-9.5/sdf/Element.hh:486:24:   required from ‘T sdf::v9::Element::Get(const string&) const [with T = short unsigned int; std::string = std::__cxx11::basic_string<char>]’
> /home/brad-hartwig/ardupilot_gazebo/src/ArduPilotPlugin.cc:68:12:   required from ‘bool getSdfParam(sdf::v9::ElementPtr, const string&, T&, const T&, const bool&) [with T = short unsigned int; sdf::v9::ElementPtr = std::shared_ptr<sdf::v9::Element>; std::string = std::__cxx11::basic_string<char>]’
> /home/brad-hartwig/ardupilot_gazebo/src/ArduPilotPlugin.cc:978:57:   required from here
> /usr/include/c++/9/variant:100:12: error: invalid use of incomplete type ‘struct std::variant_alternative<0, std::variant<> >’
>   100 |     struct variant_alternative<_Np, variant<_First, _Rest...>>
>       |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/include/c++/9/variant:97:12: note: declaration of ‘struct std::variant_alternative<0, std::variant<> >’
>    97 |     struct variant_alternative;
>       |            ^~~~~~~~~~~~~~~~~~~
> /usr/include/c++/9/variant: In instantiation of ‘constexpr std::add_pointer_t<_Tp> std::get_if(std::variant<_Types ...>*) [with _Tp = short unsigned int; _Types = {bool, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::v9::Time, ignition::math::v6::Angle, ignition::math::v6::Color, ignition::math::v6::Vector2<int>, ignition::math::v6::Vector2<double>, ignition::math::v6::Vector3<double>, ignition::math::v6::Quaternion<double>, ignition::math::v6::Pose3<double>}; std::add_pointer_t<_Tp> = short unsigned int*]’:
> /usr/include/sdformat-9.5/sdf/Param.hh:318:34:   required from ‘bool sdf::v9::Param::Get(T&) const [with T = short unsigned int]’
> /usr/include/sdformat-9.5/sdf/Element.hh:511:7:   required from ‘std::pair<T, bool> sdf::v9::Element::Get(const string&, const T&) const [with T = short unsigned int; std::string = std::__cxx11::basic_string<char>]’
> /usr/include/sdformat-9.5/sdf/Element.hh:486:24:   required from ‘T sdf::v9::Element::Get(const string&) const [with T = short unsigned int; std::string = std::__cxx11::basic_string<char>]’
> /home/brad-hartwig/ardupilot_gazebo/src/ArduPilotPlugin.cc:68:12:   required from ‘bool getSdfParam(sdf::v9::ElementPtr, const string&, T&, const T&, const bool&) [with T = short unsigned int; sdf::v9::ElementPtr = std::shared_ptr<sdf::v9::Element>; std::string = std::__cxx11::basic_string<char>]’
> /home/brad-hartwig/ardupilot_gazebo/src/ArduPilotPlugin.cc:978:57:   required from here
> /usr/include/c++/9/variant:1128:76: error: no matching function for call to ‘get_if<std::__detail::__variant::__index_of_v<short unsigned int, bool, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::v9::Time, ignition::math::v6::Angle, ignition::math::v6::Color, ignition::math::v6::Vector2<int>, ignition::math::v6::Vector2<double>, ignition::math::v6::Vector3<double>, ignition::math::v6::Quaternion<double>, ignition::math::v6::Pose3<double> > >(std::variant<bool, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::v9::Time, ignition::math::v6::Angle, ignition::math::v6::Color, ignition::math::v6::Vector2<int>, ignition::math::v6::Vector2<double>, ignition::math::v6::Vector3<double>, ignition::math::v6::Quaternion<double>, ignition::math::v6::Pose3<double> >*&)’
>  1128 |       return std::get_if<__detail::__variant::__index_of_v<_Tp, _Types...>>(
>       |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  1129 |    __ptr);
>       |    ~~~~~~                                                                   
> /usr/include/c++/9/variant:1096:5: note: candidate: ‘template<long unsigned int _Np, class ... _Types> constexpr std::add_pointer_t<typename std::variant_alternative<_Np, std::variant<_Types ...> >::type> std::get_if(std::variant<_Types ...>*)’
>  1096 |     get_if(variant<_Types...>* __ptr) noexcept
>       |     ^~~~~~
> /usr/include/c++/9/variant:1096:5: note:   template argument deduction/substitution failed:
> /usr/include/c++/9/variant: In substitution of ‘template<long unsigned int _Np, class ... _Types> constexpr std::add_pointer_t<typename std::variant_alternative<_Np, std::variant<_Types ...> >::type> std::get_if(std::variant<_Types ...>*) [with long unsigned int _Np = 16; _Types = {bool, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::v9::Time, ignition::math::v6::Angle, ignition::math::v6::Color, ignition::math::v6::Vector2<int>, ignition::math::v6::Vector2<double>, ignition::math::v6::Vector3<double>, ignition::math::v6::Quaternion<double>, ignition::math::v6::Pose3<double>}]’:
> /usr/include/c++/9/variant:1128:76:   required from ‘constexpr std::add_pointer_t<_Tp> std::get_if(std::variant<_Types ...>*) [with _Tp = short unsigned int; _Types = {bool, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::v9::Time, ignition::math::v6::Angle, ignition::math::v6::Color, ignition::math::v6::Vector2<int>, ignition::math::v6::Vector2<double>, ignition::math::v6::Vector3<double>, ignition::math::v6::Quaternion<double>, ignition::math::v6::Pose3<double>}; std::add_pointer_t<_Tp> = short unsigned int*]’
> /usr/include/sdformat-9.5/sdf/Param.hh:318:34:   required from ‘bool sdf::v9::Param::Get(T&) const [with T = short unsigned int]’
> /usr/include/sdformat-9.5/sdf/Element.hh:511:7:   required from ‘std::pair<T, bool> sdf::v9::Element::Get(const string&, const T&) const [with T = short unsigned int; std::string = std::__cxx11::basic_string<char>]’
> /usr/include/sdformat-9.5/sdf/Element.hh:486:24:   required from ‘T sdf::v9::Element::Get(const string&) const [with T = short unsigned int; std::string = std::__cxx11::basic_string<char>]’
> /home/brad-hartwig/ardupilot_gazebo/src/ArduPilotPlugin.cc:68:12:   required from ‘bool getSdfParam(sdf::v9::ElementPtr, const string&, T&, const T&, const bool&) [with T = short unsigned int; sdf::v9::ElementPtr = std::shared_ptr<sdf::v9::Element>; std::string = std::__cxx11::basic_string<char>]’
> /home/brad-hartwig/ardupilot_gazebo/src/ArduPilotPlugin.cc:978:57:   required from here
> /usr/include/c++/9/variant:1096:5: error: no type named ‘type’ in ‘struct std::variant_alternative<16, std::variant<bool, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::v9::Time, ignition::math::v6::Angle, ignition::math::v6::Color, ignition::math::v6::Vector2<int>, ignition::math::v6::Vector2<double>, ignition::math::v6::Vector3<double>, ignition::math::v6::Quaternion<double>, ignition::math::v6::Pose3<double> > >’
> /usr/include/c++/9/variant: In instantiation of ‘constexpr std::add_pointer_t<_Tp> std::get_if(std::variant<_Types ...>*) [with _Tp = short unsigned int; _Types = {bool, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::v9::Time, ignition::math::v6::Angle, ignition::math::v6::Color, ignition::math::v6::Vector2<int>, ignition::math::v6::Vector2<double>, ignition::math::v6::Vector3<double>, ignition::math::v6::Quaternion<double>, ignition::math::v6::Pose3<double>}; std::add_pointer_t<_Tp> = short unsigned int*]’:
> /usr/include/sdformat-9.5/sdf/Param.hh:318:34:   required from ‘bool sdf::v9::Param::Get(T&) const [with T = short unsigned int]’
> /usr/include/sdformat-9.5/sdf/Element.hh:511:7:   required from ‘std::pair<T, bool> sdf::v9::Element::Get(const string&, const T&) const [with T = short unsigned int; std::string = std::__cxx11::basic_string<char>]’
> /usr/include/sdformat-9.5/sdf/Element.hh:486:24:   required from ‘T sdf::v9::Element::Get(const string&) const [with T = short unsigned int; std::string = std::__cxx11::basic_string<char>]’
> /home/brad-hartwig/ardupilot_gazebo/src/ArduPilotPlugin.cc:68:12:   required from ‘bool getSdfParam(sdf::v9::ElementPtr, const string&, T&, const T&, const bool&) [with T = short unsigned int; sdf::v9::ElementPtr = std::shared_ptr<sdf::v9::Element>; std::string = std::__cxx11::basic_string<char>]’
> /home/brad-hartwig/ardupilot_gazebo/src/ArduPilotPlugin.cc:978:57:   required from here
> /usr/include/c++/9/variant:1110:5: note: candidate: ‘template<long unsigned int _Np, class ... _Types> constexpr std::add_pointer_t<const typename std::variant_alternative<_Np, std::variant<_Types ...> >::type> std::get_if(const std::variant<_Types ...>*)’
>  1110 |     get_if(const variant<_Types...>* __ptr) noexcept
>       |     ^~~~~~
> /usr/include/c++/9/variant:1110:5: note:   substitution of deduced template arguments resulted in errors seen above
> /usr/include/c++/9/variant:1123:5: note: candidate: ‘template<class _Tp, class ... _Types> constexpr std::add_pointer_t<_Tp> std::get_if(std::variant<_Types ...>*)’
>  1123 |     get_if(variant<_Types...>* __ptr) noexcept
>       |     ^~~~~~
> /usr/include/c++/9/variant:1123:5: note:   template argument deduction/substitution failed:
> make[2]: *** [CMakeFiles/ArduPilotPlugin.dir/build.make:63: CMakeFiles/ArduPilotPlugin.dir/src/ArduPilotPlugin.cc.o] Error 1
> make[1]: *** [CMakeFiles/Makefile2:78: CMakeFiles/ArduPilotPlugin.dir/all] Error 2
> make: *** [Makefile:130: all] Error 2

Any help would be greatly appreciated!!

Hi @BardleyTheExplorer,

It appears that you are running gazebo 11 in a newer operating system, for that, it’s necessary to update the libraries to update with the newer dependencies.
ROS/Gazebo ecosystem has continuous API breaks, making it harder to maintain it.
I would recommend to do such development in a docker environment or update all necessary libraries (like ArduPilotPlugin) to work with your desktop environment.

Awesome thank you for the response @patrickelectric ! I see your disclaimer on git - so is Ubuntu 16.04 LTS required to be able to run older versions of gazebo like -7 or -8?

When I try to install older versions of gazebo I get the following output:

sudo apt-get install gazebo8
[sudo] password for brad-hartwig: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package gazebo8 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'gazebo8' has no installation candidate

I installed Ubuntu 20.04 LTS since QGroundControl reported requiring 18.04 or later; it seems gazebo9 is as far back as it will let me install. I’m new to the world of docker containers but I’ll give it a try - thank you for the help!

Do I need to uninstall gazebo11 and clone the git repositories to update those libraries/plugins? Or am I overthinking it? I may be in over my head with this given my limited developer experience, I just felt I was getting close!

Hi @BardleyTheExplorer,

Did you follow the official gazebo documentation ?

No, you don’t need to uninstall, but take in mind that you’ll need to organize the installation of the program and libraries in a way that does not conflict with your system.

For that I highly recommend doing a docker environment to avoid such problem/pain, should be easier.