Using Gazebo Simulator with SITL - make-j4 error

Hello Community,

I am trying to set up the Gazebo Simulation as mentioned on the Using Gazebo Simulator with SITL wiki page (http://ardupilot.org/dev/docs/using-gazebo-simulator-with-sitl.html).

I am running it on Ubuntu 16.04 with ROS Kinetics, regarding to the wiki that should work.

Actually this is the error which pops up, when I come to the make -j4 part.

[ 16%] Building CXX object CMakeFiles/ArduPilotPlugin.dir/src/ArduPilotPlugin.cc.o
[ 33%] Building CXX object CMakeFiles/ArduCopterPlugin.dir/src/ArduCopterPlugin.cc.o
[ 50%] Building CXX object CMakeFiles/ArduCopterIRLockPlugin.dir/src/ArduCopterIRLockPlugin.cc.o
/home/thorsten/ardupilot_gazebo/src/ArduPilotPlugin.cc: In member function ‘void gazebo::ArduPilotPlugin::OnUpdate()’:
/home/thorsten/ardupilot_gazebo/src/ArduPilotPlugin.cc:914:39: error: ‘class gazebo::physics::World’ has no member named ‘GetSimTime’
     this->dataPtr->model->GetWorld()->GetSimTime();
                                       ^
/home/thorsten/ardupilot_gazebo/src/ArduPilotPlugin.cc: In member function ‘void gazebo::ArduPilotPlugin::ApplyMotorForces(double)’:
/home/thorsten/ardupilot_gazebo/src/ArduPilotPlugin.cc:999:62: error: ‘class gazebo::physics::Joint’ has no member named ‘GetAngle’
         const double pos = this->dataPtr->controls[i].joint->GetAngle(0).Radian();
                                                              ^
/home/thorsten/ardupilot_gazebo/src/ArduPilotPlugin.cc: In member function ‘void gazebo::ArduPilotPlugin::SendState() const’:
/home/thorsten/ardupilot_gazebo/src/ArduPilotPlugin.cc:1195:53: error: ‘class gazebo::physics::World’ has no member named ‘GetSimTime’
   pkt.timestamp = this->dataPtr->model->GetWorld()->GetSimTime().Double();
                                                     ^
/home/thorsten/ardupilot_gazebo/src/ArduPilotPlugin.cc:1245:27: error: ‘class gazebo::physics::Model’ has no member named ‘GetWorldPose’
     this->dataPtr->model->GetWorldPose().Ign();
                           ^
/home/thorsten/ardupilot_gazebo/src/ArduPilotPlugin.cc:1278:38: error: ‘class gazebo::physics::Link’ has no member named ‘GetWorldLinearVel’
     this->dataPtr->model->GetLink()->GetWorldLinearVel().Ign();
                                      ^
/home/thorsten/ardupilot_gazebo/src/ArduCopterPlugin.cc: In member function ‘void gazebo::ArduCopterPlugin::OnUpdate()’:
/home/thorsten/ardupilot_gazebo/src/ArduCopterPlugin.cc:565:68: error: ‘class gazebo::physics::World’ has no member named ‘GetSimTime’
   gazebo::common::Time curTime = this->dataPtr->model->GetWorld()->GetSimTime();
                                                                    ^
/home/thorsten/ardupilot_gazebo/src/ArduCopterPlugin.cc: In member function ‘void gazebo::ArduCopterPlugin::SendState() const’:
/home/thorsten/ardupilot_gazebo/src/ArduCopterPlugin.cc:752:53: error: ‘class gazebo::physics::World’ has no member named ‘GetSimTime’
   pkt.timestamp = this->dataPtr->model->GetWorld()->GetSimTime().Double();
                                                     ^
/home/thorsten/ardupilot_gazebo/src/ArduCopterPlugin.cc:802:27: error: ‘class gazebo::physics::Model’ has no member named ‘GetWorldPose’
     this->dataPtr->model->GetWorldPose().Ign();
                           ^
/home/thorsten/ardupilot_gazebo/src/ArduCopterPlugin.cc:833:38: error: ‘class gazebo::physics::Link’ has no member named ‘GetWorldLinearVel’
     this->dataPtr->model->GetLink()->GetWorldLinearVel().Ign();
                                      ^
In file included from /usr/include/boost/type_index/stl_type_index.hpp:32:0,
                 from /usr/include/boost/type_index.hpp:29,
                 from /usr/include/boost/any.hpp:20,
                 from /usr/include/sdformat-6.2/sdf/Param.hh:21,
                 from /usr/include/sdformat-6.2/sdf/Element.hh:25,
                 from /usr/include/sdformat-6.2/sdf/sdf.hh:4,
                 from /home/thorsten/ardupilot_gazebo/src/ArduPilotPlugin.cc:41:
/usr/include/boost/variant/get.hpp: In instantiation of ‘typename boost::add_reference<T>::type boost::strict_get(boost::variant<T0, TN ...>&) [with U = short unsigned int; T0 = bool; TN = {char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::Time, ignition::math::v4::Color, ignition::math::v4::Vector2<int>, ignition::math::v4::Vector2<double>, ignition::math::v4::Vector3<double>, ignition::math::v4::Quaternion<double>, ignition::math::v4::Pose3<double>}; typename boost::add_reference<T>::type = short unsigned int&]’:
/usr/include/boost/variant/get.hpp:284:25:   required from ‘typename boost::add_reference<T>::type boost::get(boost::variant<T0, TN ...>&) [with U = short unsigned int; T0 = bool; TN = {char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::Time, ignition::math::v4::Color, ignition::math::v4::Vector2<int>, ignition::math::v4::Vector2<double>, ignition::math::v4::Vector3<double>, ignition::math::v4::Quaternion<double>, ignition::math::v4::Pose3<double>}; typename boost::add_reference<T>::type = short unsigned int&]’
/usr/include/sdformat-6.2/sdf/Param.hh:300:31:   required from ‘bool sdf::Param::Get(T&) const [with T = short unsigned int]’
/usr/include/sdformat-6.2/sdf/Element.hh:454:7:   required from ‘std::pair<T, bool> sdf::Element::Get(const string&, const T&) const [with T = short unsigned int; std::__cxx11::string = std::__cxx11::basic_string<char>]’
/usr/include/sdformat-6.2/sdf/Element.hh:429:55:   required from ‘T sdf::Element::Get(const string&) const [with T = short unsigned int; std::__cxx11::string = std::__cxx11::basic_string<char>]’
/home/thorsten/ardupilot_gazebo/src/ArduPilotPlugin.cc:69:12:   required from ‘bool getSdfParam(sdf::ElementPtr, const string&, T&, const T&, const bool&) [with T = short unsigned int; sdf::ElementPtr = std::shared_ptr<sdf::Element>; std::__cxx11::string = std::__cxx11::basic_string<char>]’
/home/thorsten/ardupilot_gazebo/src/ArduPilotPlugin.cc:950:39:   required from here
/usr/include/boost/variant/get.hpp:212:5: error: static assertion failed: boost::variant does not contain specified type U, call to boost::get<U>(boost::variant<T...>&) will always throw boost::bad_get exception
     BOOST_STATIC_ASSERT_MSG(
     ^
In file included from /usr/include/boost/type_index/stl_type_index.hpp:32:0,
                 from /usr/include/boost/type_index.hpp:29,
                 from /usr/include/boost/any.hpp:20,
                 from /usr/include/sdformat-6.2/sdf/Param.hh:21,
                 from /usr/include/sdformat-6.2/sdf/Element.hh:25,
                 from /usr/include/sdformat-6.2/sdf/sdf.hh:4,
                 from /home/thorsten/ardupilot_gazebo/src/ArduCopterPlugin.cc:27:
/usr/include/boost/variant/get.hpp: In instantiation of ‘typename boost::add_reference<T>::type boost::strict_get(boost::variant<T0, TN ...>&) [with U = short unsigned int; T0 = bool; TN = {char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::Time, ignition::math::v4::Color, ignition::math::v4::Vector2<int>, ignition::math::v4::Vector2<double>, ignition::math::v4::Vector3<double>, ignition::math::v4::Quaternion<double>, ignition::math::v4::Pose3<double>}; typename boost::add_reference<T>::type = short unsigned int&]’:
/usr/include/boost/variant/get.hpp:284:25:   required from ‘typename boost::add_reference<T>::type boost::get(boost::variant<T0, TN ...>&) [with U = short unsigned int; T0 = bool; TN = {char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::Time, ignition::math::v4::Color, ignition::math::v4::Vector2<int>, ignition::math::v4::Vector2<double>, ignition::math::v4::Vector3<double>, ignition::math::v4::Quaternion<double>, ignition::math::v4::Pose3<double>}; typename boost::add_reference<T>::type = short unsigned int&]’
/usr/include/sdformat-6.2/sdf/Param.hh:300:31:   required from ‘bool sdf::Param::Get(T&) const [with T = short unsigned int]’
/usr/include/sdformat-6.2/sdf/Element.hh:454:7:   required from ‘std::pair<T, bool> sdf::Element::Get(const string&, const T&) const [with T = short unsigned int; std::__cxx11::string = std::__cxx11::basic_string<char>]’
/usr/include/sdformat-6.2/sdf/Element.hh:429:55:   required from ‘T sdf::Element::Get(const string&) const [with T = short unsigned int; std::__cxx11::string = std::__cxx11::basic_string<char>]’
/home/thorsten/ardupilot_gazebo/src/ArduCopterPlugin.cc:55:12:   required from ‘bool getSdfParam(sdf::ElementPtr, const string&, T&, const T&, const bool&) [with T = short unsigned int; sdf::ElementPtr = std::shared_ptr<sdf::Element>; std::__cxx11::string = std::__cxx11::basic_string<char>]’
/home/thorsten/ardupilot_gazebo/src/ArduCopterPlugin.cc:590:45:   required from here
/usr/include/boost/variant/get.hpp:212:5: error: static assertion failed: boost::variant does not contain specified type U, call to boost::get<U>(boost::variant<T...>&) will always throw boost::bad_get exception
     BOOST_STATIC_ASSERT_MSG(
     ^
CMakeFiles/ArduCopterPlugin.dir/build.make:62: recipe for target 'CMakeFiles/ArduCopterPlugin.dir/src/ArduCopterPlugin.cc.o' failed
make[2]: *** [CMakeFiles/ArduCopterPlugin.dir/src/ArduCopterPlugin.cc.o] Error 1
CMakeFiles/Makefile2:141: recipe for target 'CMakeFiles/ArduCopterPlugin.dir/all' failed
make[1]: *** [CMakeFiles/ArduCopterPlugin.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
CMakeFiles/ArduPilotPlugin.dir/build.make:62: recipe for target 'CMakeFiles/ArduPilotPlugin.dir/src/ArduPilotPlugin.cc.o' failed
make[2]: *** [CMakeFiles/ArduPilotPlugin.dir/src/ArduPilotPlugin.cc.o] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/ArduPilotPlugin.dir/all' failed
make[1]: *** [CMakeFiles/ArduPilotPlugin.dir/all] Error 2
/home/thorsten/ardupilot_gazebo/src/ArduCopterIRLockPlugin.cc: In member function ‘virtual void gazebo::ArduCopterIRLockPlugin::OnNewFrame(const unsigned char*, unsigned int, unsigned int, unsigned int, const string&)’:
/home/thorsten/ardupilot_gazebo/src/ArduCopterIRLockPlugin.cc:237:14: error: ‘class gazebo::rendering::Visual’ has no member named ‘GetWorldPose’
         vis->GetWorldPose().pos.Ign(), camera);
              ^
/home/thorsten/ardupilot_gazebo/src/ArduCopterIRLockPlugin.cc:262:26: error: ‘class gazebo::rendering::Visual’ has no member named ‘GetName’
       this->Publish(vis->GetName(), pt.X(), pt.Y());
                          ^
In file included from /usr/include/boost/type_index/stl_type_index.hpp:32:0,
                 from /usr/include/boost/type_index.hpp:29,
                 from /usr/include/boost/any.hpp:20,
                 from /usr/include/sdformat-6.2/sdf/Param.hh:21,
                 from /usr/include/sdformat-6.2/sdf/Element.hh:25,
                 from /usr/include/sdformat-6.2/sdf/sdf.hh:4,
                 from /usr/include/gazebo-9/gazebo/sensors/Sensor.hh:25,
                 from /usr/include/gazebo-9/gazebo/sensors/CameraSensor.hh:24,
                 from /home/thorsten/ardupilot_gazebo/src/ArduCopterIRLockPlugin.cc:44:
/usr/include/boost/variant/get.hpp: In instantiation of ‘typename boost::add_reference<T>::type boost::strict_get(boost::variant<T0, TN ...>&) [with U = short unsigned int; T0 = bool; TN = {char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::Time, ignition::math::v4::Color, ignition::math::v4::Vector2<int>, ignition::math::v4::Vector2<double>, ignition::math::v4::Vector3<double>, ignition::math::v4::Quaternion<double>, ignition::math::v4::Pose3<double>}; typename boost::add_reference<T>::type = short unsigned int&]’:
/usr/include/boost/variant/get.hpp:284:25:   required from ‘typename boost::add_reference<T>::type boost::get(boost::variant<T0, TN ...>&) [with U = short unsigned int; T0 = bool; TN = {char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, long unsigned int, unsigned int, double, float, sdf::Time, ignition::math::v4::Color, ignition::math::v4::Vector2<int>, ignition::math::v4::Vector2<double>, ignition::math::v4::Vector3<double>, ignition::math::v4::Quaternion<double>, ignition::math::v4::Pose3<double>}; typename boost::add_reference<T>::type = short unsigned int&]’
/usr/include/sdformat-6.2/sdf/Param.hh:300:31:   required from ‘bool sdf::Param::Get(T&) const [with T = short unsigned int]’
/usr/include/sdformat-6.2/sdf/Element.hh:454:7:   required from ‘std::pair<T, bool> sdf::Element::Get(const string&, const T&) const [with T = short unsigned int; std::__cxx11::string = std::__cxx11::basic_string<char>]’
/usr/include/sdformat-6.2/sdf/Element.hh:429:55:   required from ‘T sdf::Element::Get(const string&) const [with T = short unsigned int; std::__cxx11::string = std::__cxx11::basic_string<char>]’
/home/thorsten/ardupilot_gazebo/src/ArduCopterIRLockPlugin.cc:70:14:   required from ‘bool gazebo::getSdfParam(sdf::ElementPtr, const string&, T&, const T&, const bool&) [with T = short unsigned int; sdf::ElementPtr = std::shared_ptr<sdf::Element>; std::__cxx11::string = std::__cxx11::basic_string<char>]’
/home/thorsten/ardupilot_gazebo/src/ArduCopterIRLockPlugin.cc:199:39:   required from here
/usr/include/boost/variant/get.hpp:212:5: error: static assertion failed: boost::variant does not contain specified type U, call to boost::get<U>(boost::variant<T...>&) will always throw boost::bad_get exception
     BOOST_STATIC_ASSERT_MSG(
     ^
CMakeFiles/ArduCopterIRLockPlugin.dir/build.make:62: recipe for target 'CMakeFiles/ArduCopterIRLockPlugin.dir/src/ArduCopterIRLockPlugin.cc.o' failed
make[2]: *** [CMakeFiles/ArduCopterIRLockPlugin.dir/src/ArduCopterIRLockPlugin.cc.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/ArduCopterIRLockPlugin.dir/all' failed
make[1]: *** [CMakeFiles/ArduCopterIRLockPlugin.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

I feel like its an issue with my boost version, but I am pretty new to ROS, to Gazebo, to Linux and ArduPilot and I dont know how to fix that.

I appreciate your help!
Thanks alot!

Hello,

If you want to use ROS Kinetic (as I’m doing), it is better to use Gazebo v7, and not v9 as it is described in the tutorial.

I recommand to follow the nice tutorial from SwiftGust : https://github.com/SwiftGust/ardupilot_gazebo

[Good to have] Install Gazebo ROS plugin (google “install ros plugin gazebo”) , and use the command “roscore & rosrun gazebo_ros gazebo [your_world.world] --verbose” to run your world, and see publication from Gazebo into ROS.

Good luck, let me know if you succeed !

1 Like

Thanks alot, that fixed the problem!

Hello, I would like to ask you to solve the above problem?or follow the help to reconfigure the operating environment? Because I have the same problem with you.

how to problem?thank you