Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Gazebo header problem while building ros workspace

I am using Ubuntu 18.04 LTS, ROS melodic, so I think I'm using Gazebo 9 (http://gazebosim.org/tutorials/?tut=ros_wrapper_versions). This is the error message:

[ 97%] Building CXX object gazebo_ros_link_attacher/CMakeFiles/gazebo_ros_link_attacher.dir/src/gazebo_ros_link_attacher.cpp.o
[ 98%] Built target gazebo_disable_link_plugin
[100%] Built target roboticsgroup_gazebo_mimic_joint_plugin
[100%] Building CXX object robotiq/robotiq_gazebo/CMakeFiles/gazebo_mimic_joint_plugin.dir/src/mimic_joint_plugin.cpp.o
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp: In member function ‘virtual void gazebo::GazeboRosLinkAttacher::Load(gazebo::physics::WorldPtr, sdf::ElementPtr)’:
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:36:34: error: ‘class gazebo::physics::World’ has no member named ‘GetPhysicsEngine’; did you mean ‘SetPhysicsEnabled’?
     this->physics = this->world->GetPhysicsEngine();
                                  ^~~~~~~~~~~~~~~~
                                  SetPhysicsEnabled
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp: In member function ‘bool gazebo::GazeboRosLinkAttacher::attach(std::__cxx11::string, std::__cxx11::string, std::__cxx11::string, std::__cxx11::string)’:
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:66:40: error: ‘class gazebo::physics::World’ has no member named ‘GetByName’; did you mean ‘BaseByName’?
     physics::BasePtr b1 = this->world->GetByName(model1);
                                        ^~~~~~~~~
                                        BaseByName
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:72:40: error: ‘class gazebo::physics::World’ has no member named ‘GetByName’; did you mean ‘BaseByName’?
     physics::BasePtr b2 = this->world->GetByName(model2);
                                        ^~~~~~~~~
                                        BaseByName
In file included from /opt/ros/melodic/include/ros/ros.h:40:0,
                 from /home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:2:
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:94:100: error: ‘class gazebo::physics::Inertial’ has no member named ‘GetMass’; did you mean ‘SetMass’?
  inertia is not NULL, for example, mass is: " << l1->GetInertial()->GetMass());
                                                                     ^
/opt/ros/melodic/include/ros/console.h:358:64: note: in definition of macro ‘ROSCONSOLE_PRINT_STREAM_AT_LOCATION_WITH_FILTER’
     __rosconsole_print_stream_at_location_with_filter__ss__ << args; \
                                                                ^~~~
/opt/ros/melodic/include/ros/console.h:406:7: note: in expansion of macro ‘ROSCONSOLE_PRINT_STREAM_AT_LOCATION’
       ROSCONSOLE_PRINT_STREAM_AT_LOCATION(args); \
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/ros/melodic/include/ros/console.h:579:43: note: in expansion of macro ‘ROS_LOG_STREAM_COND’
 #define ROS_LOG_STREAM(level, name, args) ROS_LOG_STREAM_COND(true, level, name, args)
                                           ^~~~~~~~~~~~~~~~~~~
/opt/ros/melodic/include/rosconsole/macros_generated.h:59:32: note: in expansion of macro ‘ROS_LOG_STREAM’
 #define ROS_DEBUG_STREAM(args) ROS_LOG_STREAM(::ros::console::levels::Debug, ROSCONSOLE_DEFAULT_NAME, args)
                                ^~~~~~~~~~~~~~
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:94:9: note: in expansion of macro ‘ROS_DEBUG_STREAM’
         ROS_DEBUG_STREAM("link1 inertia is not NULL, for example, mass is: " << l1->GetInertial()->GetMass());
         ^
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:106:100: error: ‘class gazebo::physics::Inertial’ has no member named ‘GetMass’; did you mean ‘SetMass’?
  inertia is not NULL, for example, mass is: " << l2->GetInertial()->GetMass());
                                                                     ^
/opt/ros/melodic/include/ros/console.h:358:64: note: in definition of macro ‘ROSCONSOLE_PRINT_STREAM_AT_LOCATION_WITH_FILTER’
     __rosconsole_print_stream_at_location_with_filter__ss__ << args; \
                                                                ^~~~
/opt/ros/melodic/include/ros/console.h:406:7: note: in expansion of macro ‘ROSCONSOLE_PRINT_STREAM_AT_LOCATION’
       ROSCONSOLE_PRINT_STREAM_AT_LOCATION(args); \
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/ros/melodic/include/ros/console.h:579:43: note: in expansion of macro ‘ROS_LOG_STREAM_COND’
 #define ROS_LOG_STREAM(level, name, args) ROS_LOG_STREAM_COND(true, level, name, args)
                                           ^~~~~~~~~~~~~~~~~~~
/opt/ros/melodic/include/rosconsole/macros_generated.h:59:32: note: in expansion of macro ‘ROS_LOG_STREAM’
 #define ROS_DEBUG_STREAM(args) ROS_LOG_STREAM(::ros::console::levels::Debug, ROSCONSOLE_DEFAULT_NAME, args)
                                ^~~~~~~~~~~~~~
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:106:9: note: in expansion of macro ‘ROS_DEBUG_STREAM’
         ROS_DEBUG_STREAM("link2 inertia is not NULL, for example, mass is: " << l2->GetInertial()->GetMass());
         ^
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:118:27: error: ‘math’ has not been declared
     j.joint->Load(l1, l2, math::Pose());
                           ^~~~
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:136:14: error: ‘class gazebo::physics::Joint’ has no member named ‘SetHighStop’
     j.joint->SetHighStop(0, 0);
              ^~~~~~~~~~~
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:138:14: error: ‘class gazebo::physics::Joint’ has no member named ‘SetLowStop’; did you mean ‘SetPosition’?
     j.joint->SetLowStop(0, 0);
              ^~~~~~~~~~
              SetPosition
/home/mecha/catkin_ws/src/robotiq/robotiq_gazebo/src/mimic_joint_plugin.cpp: In destructor ‘virtual gazebo::MimicJointPlugin::~MimicJointPlugin()’:
/home/mecha/catkin_ws/src/robotiq/robotiq_gazebo/src/mimic_joint_plugin.cpp:50:18: error: ‘DisconnectWorldUpdateBegin’ is not a member of ‘gazebo::event::Events’
   event::Events::DisconnectWorldUpdateBegin(this->updateConnection);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mecha/catkin_ws/src/robotiq/robotiq_gazebo/src/mimic_joint_plugin.cpp: In member function ‘void gazebo::MimicJointPlugin::UpdateChild()’:
/home/mecha/catkin_ws/src/robotiq/robotiq_gazebo/src/mimic_joint_plugin.cpp:170:39: error: ‘class gazebo::physics::World’ has no member named ‘GetPhysicsEngine’; did you mean ‘SetPhysicsEnabled’?
   static ros::Duration period(world_->GetPhysicsEngine()->GetMaxStepSize());
                                       ^~~~~~~~~~~~~~~~
                                       SetPhysicsEnabled
/home/mecha/catkin_ws/src/robotiq/robotiq_gazebo/src/mimic_joint_plugin.cpp:173:26: error: ‘class gazebo::physics::Joint’ has no member named ‘GetAngle’; did you mean ‘GetForce’?
   double angle = joint_->GetAngle(0).Radian()*multiplier_+offset_;
                          ^~~~~~~~
                          GetForce
/home/mecha/catkin_ws/src/robotiq/robotiq_gazebo/src/mimic_joint_plugin.cpp:175:30: error: ‘class gazebo::physics::Joint’ has no member named ‘GetAngle’; did you mean ‘GetForce’?
   if(abs(angle-mimic_joint_->GetAngle(0).Radian())>=sensitiveness_)
                              ^~~~~~~~
                              GetForce
/home/mecha/catkin_ws/src/robotiq/robotiq_gazebo/src/mimic_joint_plugin.cpp:179:32: error: ‘class gazebo::physics::Joint’ has no member named ‘GetAngle’; did you mean ‘GetForce’?
       double a = mimic_joint_->GetAngle(0).Radian();
                                ^~~~~~~~
                                GetForce
/home/mecha/catkin_ws/src/robotiq/robotiq_gazebo/src/mimic_joint_plugin.cpp:183:31: error: ‘gazebo::math’ has not been declared
       double effort = gazebo::math::clamp(pid_.computeCommand(error, period), -max_effort_, max_effort_);
                               ^~~~
gazebo_ros_link_attacher/CMakeFiles/gazebo_ros_link_attacher.dir/build.make:62: recipe for target 'gazebo_ros_link_attacher/CMakeFiles/gazebo_ros_link_attacher.dir/src/gazebo_ros_link_attacher.cpp.o' failed
make[2]: *** [gazebo_ros_link_attacher/CMakeFiles/gazebo_ros_link_attacher.dir/src/gazebo_ros_link_attacher.cpp.o] Error 1
CMakeFiles/Makefile2:8021: recipe for target 'gazebo_ros_link_attacher/CMakeFiles/gazebo_ros_link_attacher.dir/all' failed
make[1]: *** [gazebo_ros_link_attacher/CMakeFiles/gazebo_ros_link_attacher.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
robotiq/robotiq_gazebo/CMakeFiles/gazebo_mimic_joint_plugin.dir/build.make:62: recipe for target 'robotiq/robotiq_gazebo/CMakeFiles/gazebo_mimic_joint_plugin.dir/src/mimic_joint_plugin.cpp.o' failed
make[2]: *** [robotiq/robotiq_gazebo/CMakeFiles/gazebo_mimic_joint_plugin.dir/src/mimic_joint_plugin.cpp.o] Error 1
CMakeFiles/Makefile2:8475: recipe for target 'robotiq/robotiq_gazebo/CMakeFiles/gazebo_mimic_joint_plugin.dir/all' failed
make[1]: *** [robotiq/robotiq_gazebo/CMakeFiles/gazebo_mimic_joint_plugin.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed

It seems that some package uses functions that doesn't exist in certain headers of Gazebo. However, for example, the message said ‘class gazebo::physics::World’ has no member named ‘GetPhysicsEngine’, but there is 'GetPhysicsEngine' in ‘class gazebo::physics::World’ (http://osrf-distributions.s3.amazonaws.com/gazebo/api/1.3.0/classgazebo_1_1physics_1_1World.html).

What caused this problem and how can I fix it?

click to hide/show revision 2
retagged

Gazebo header problem while building ros workspace

I am using Ubuntu 18.04 LTS, ROS melodic, so I think I'm using Gazebo 9 (http://gazebosim.org/tutorials/?tut=ros_wrapper_versions). This is the error message:

[ 97%] Building CXX object gazebo_ros_link_attacher/CMakeFiles/gazebo_ros_link_attacher.dir/src/gazebo_ros_link_attacher.cpp.o
[ 98%] Built target gazebo_disable_link_plugin
[100%] Built target roboticsgroup_gazebo_mimic_joint_plugin
[100%] Building CXX object robotiq/robotiq_gazebo/CMakeFiles/gazebo_mimic_joint_plugin.dir/src/mimic_joint_plugin.cpp.o
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp: In member function ‘virtual void gazebo::GazeboRosLinkAttacher::Load(gazebo::physics::WorldPtr, sdf::ElementPtr)’:
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:36:34: error: ‘class gazebo::physics::World’ has no member named ‘GetPhysicsEngine’; did you mean ‘SetPhysicsEnabled’?
     this->physics = this->world->GetPhysicsEngine();
                                  ^~~~~~~~~~~~~~~~
                                  SetPhysicsEnabled
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp: In member function ‘bool gazebo::GazeboRosLinkAttacher::attach(std::__cxx11::string, std::__cxx11::string, std::__cxx11::string, std::__cxx11::string)’:
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:66:40: error: ‘class gazebo::physics::World’ has no member named ‘GetByName’; did you mean ‘BaseByName’?
     physics::BasePtr b1 = this->world->GetByName(model1);
                                        ^~~~~~~~~
                                        BaseByName
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:72:40: error: ‘class gazebo::physics::World’ has no member named ‘GetByName’; did you mean ‘BaseByName’?
     physics::BasePtr b2 = this->world->GetByName(model2);
                                        ^~~~~~~~~
                                        BaseByName
In file included from /opt/ros/melodic/include/ros/ros.h:40:0,
                 from /home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:2:
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:94:100: error: ‘class gazebo::physics::Inertial’ has no member named ‘GetMass’; did you mean ‘SetMass’?
  inertia is not NULL, for example, mass is: " << l1->GetInertial()->GetMass());
                                                                     ^
/opt/ros/melodic/include/ros/console.h:358:64: note: in definition of macro ‘ROSCONSOLE_PRINT_STREAM_AT_LOCATION_WITH_FILTER’
     __rosconsole_print_stream_at_location_with_filter__ss__ << args; \
                                                                ^~~~
/opt/ros/melodic/include/ros/console.h:406:7: note: in expansion of macro ‘ROSCONSOLE_PRINT_STREAM_AT_LOCATION’
       ROSCONSOLE_PRINT_STREAM_AT_LOCATION(args); \
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/ros/melodic/include/ros/console.h:579:43: note: in expansion of macro ‘ROS_LOG_STREAM_COND’
 #define ROS_LOG_STREAM(level, name, args) ROS_LOG_STREAM_COND(true, level, name, args)
                                           ^~~~~~~~~~~~~~~~~~~
/opt/ros/melodic/include/rosconsole/macros_generated.h:59:32: note: in expansion of macro ‘ROS_LOG_STREAM’
 #define ROS_DEBUG_STREAM(args) ROS_LOG_STREAM(::ros::console::levels::Debug, ROSCONSOLE_DEFAULT_NAME, args)
                                ^~~~~~~~~~~~~~
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:94:9: note: in expansion of macro ‘ROS_DEBUG_STREAM’
         ROS_DEBUG_STREAM("link1 inertia is not NULL, for example, mass is: " << l1->GetInertial()->GetMass());
         ^
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:106:100: error: ‘class gazebo::physics::Inertial’ has no member named ‘GetMass’; did you mean ‘SetMass’?
  inertia is not NULL, for example, mass is: " << l2->GetInertial()->GetMass());
                                                                     ^
/opt/ros/melodic/include/ros/console.h:358:64: note: in definition of macro ‘ROSCONSOLE_PRINT_STREAM_AT_LOCATION_WITH_FILTER’
     __rosconsole_print_stream_at_location_with_filter__ss__ << args; \
                                                                ^~~~
/opt/ros/melodic/include/ros/console.h:406:7: note: in expansion of macro ‘ROSCONSOLE_PRINT_STREAM_AT_LOCATION’
       ROSCONSOLE_PRINT_STREAM_AT_LOCATION(args); \
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/ros/melodic/include/ros/console.h:579:43: note: in expansion of macro ‘ROS_LOG_STREAM_COND’
 #define ROS_LOG_STREAM(level, name, args) ROS_LOG_STREAM_COND(true, level, name, args)
                                           ^~~~~~~~~~~~~~~~~~~
/opt/ros/melodic/include/rosconsole/macros_generated.h:59:32: note: in expansion of macro ‘ROS_LOG_STREAM’
 #define ROS_DEBUG_STREAM(args) ROS_LOG_STREAM(::ros::console::levels::Debug, ROSCONSOLE_DEFAULT_NAME, args)
                                ^~~~~~~~~~~~~~
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:106:9: note: in expansion of macro ‘ROS_DEBUG_STREAM’
         ROS_DEBUG_STREAM("link2 inertia is not NULL, for example, mass is: " << l2->GetInertial()->GetMass());
         ^
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:118:27: error: ‘math’ has not been declared
     j.joint->Load(l1, l2, math::Pose());
                           ^~~~
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:136:14: error: ‘class gazebo::physics::Joint’ has no member named ‘SetHighStop’
     j.joint->SetHighStop(0, 0);
              ^~~~~~~~~~~
/home/mecha/catkin_ws/src/gazebo_ros_link_attacher/src/gazebo_ros_link_attacher.cpp:138:14: error: ‘class gazebo::physics::Joint’ has no member named ‘SetLowStop’; did you mean ‘SetPosition’?
     j.joint->SetLowStop(0, 0);
              ^~~~~~~~~~
              SetPosition
/home/mecha/catkin_ws/src/robotiq/robotiq_gazebo/src/mimic_joint_plugin.cpp: In destructor ‘virtual gazebo::MimicJointPlugin::~MimicJointPlugin()’:
/home/mecha/catkin_ws/src/robotiq/robotiq_gazebo/src/mimic_joint_plugin.cpp:50:18: error: ‘DisconnectWorldUpdateBegin’ is not a member of ‘gazebo::event::Events’
   event::Events::DisconnectWorldUpdateBegin(this->updateConnection);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mecha/catkin_ws/src/robotiq/robotiq_gazebo/src/mimic_joint_plugin.cpp: In member function ‘void gazebo::MimicJointPlugin::UpdateChild()’:
/home/mecha/catkin_ws/src/robotiq/robotiq_gazebo/src/mimic_joint_plugin.cpp:170:39: error: ‘class gazebo::physics::World’ has no member named ‘GetPhysicsEngine’; did you mean ‘SetPhysicsEnabled’?
   static ros::Duration period(world_->GetPhysicsEngine()->GetMaxStepSize());
                                       ^~~~~~~~~~~~~~~~
                                       SetPhysicsEnabled
/home/mecha/catkin_ws/src/robotiq/robotiq_gazebo/src/mimic_joint_plugin.cpp:173:26: error: ‘class gazebo::physics::Joint’ has no member named ‘GetAngle’; did you mean ‘GetForce’?
   double angle = joint_->GetAngle(0).Radian()*multiplier_+offset_;
                          ^~~~~~~~
                          GetForce
/home/mecha/catkin_ws/src/robotiq/robotiq_gazebo/src/mimic_joint_plugin.cpp:175:30: error: ‘class gazebo::physics::Joint’ has no member named ‘GetAngle’; did you mean ‘GetForce’?
   if(abs(angle-mimic_joint_->GetAngle(0).Radian())>=sensitiveness_)
                              ^~~~~~~~
                              GetForce
/home/mecha/catkin_ws/src/robotiq/robotiq_gazebo/src/mimic_joint_plugin.cpp:179:32: error: ‘class gazebo::physics::Joint’ has no member named ‘GetAngle’; did you mean ‘GetForce’?
       double a = mimic_joint_->GetAngle(0).Radian();
                                ^~~~~~~~
                                GetForce
/home/mecha/catkin_ws/src/robotiq/robotiq_gazebo/src/mimic_joint_plugin.cpp:183:31: error: ‘gazebo::math’ has not been declared
       double effort = gazebo::math::clamp(pid_.computeCommand(error, period), -max_effort_, max_effort_);
                               ^~~~
gazebo_ros_link_attacher/CMakeFiles/gazebo_ros_link_attacher.dir/build.make:62: recipe for target 'gazebo_ros_link_attacher/CMakeFiles/gazebo_ros_link_attacher.dir/src/gazebo_ros_link_attacher.cpp.o' failed
make[2]: *** [gazebo_ros_link_attacher/CMakeFiles/gazebo_ros_link_attacher.dir/src/gazebo_ros_link_attacher.cpp.o] Error 1
CMakeFiles/Makefile2:8021: recipe for target 'gazebo_ros_link_attacher/CMakeFiles/gazebo_ros_link_attacher.dir/all' failed
make[1]: *** [gazebo_ros_link_attacher/CMakeFiles/gazebo_ros_link_attacher.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
robotiq/robotiq_gazebo/CMakeFiles/gazebo_mimic_joint_plugin.dir/build.make:62: recipe for target 'robotiq/robotiq_gazebo/CMakeFiles/gazebo_mimic_joint_plugin.dir/src/mimic_joint_plugin.cpp.o' failed
make[2]: *** [robotiq/robotiq_gazebo/CMakeFiles/gazebo_mimic_joint_plugin.dir/src/mimic_joint_plugin.cpp.o] Error 1
CMakeFiles/Makefile2:8475: recipe for target 'robotiq/robotiq_gazebo/CMakeFiles/gazebo_mimic_joint_plugin.dir/all' failed
make[1]: *** [robotiq/robotiq_gazebo/CMakeFiles/gazebo_mimic_joint_plugin.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed

It seems that some package uses functions that doesn't exist in certain headers of Gazebo. However, for example, the message said ‘class gazebo::physics::World’ has no member named ‘GetPhysicsEngine’, but there is 'GetPhysicsEngine' in ‘class gazebo::physics::World’ (http://osrf-distributions.s3.amazonaws.com/gazebo/api/1.3.0/classgazebo_1_1physics_1_1World.html).

What caused this problem and how can I fix it?