intel / gazebo-realsense

A RealSense Camera Gazebo plugin
Apache License 2.0
99 stars 63 forks source link

Fix for compilation errors due to API change in gazebo::physics::World #1

Closed stevegray954 closed 6 years ago

stevegray954 commented 6 years ago

Encountered the following while building (using Gazebo 7.11 w/ ROS Kinetic):

/home/robot/apps/intel_aero/gazebo-realsense/gzrs/RealSensePlugin.cc: In member function ‘virtual void gazebo::RealSensePlugin::Load(gazebo::physics::ModelPtr, sdf::ElementPtr)’:
/home/robot/apps/intel_aero/gazebo-realsense/gzrs/RealSensePlugin.cc:194:60: error: ‘class gazebo::physics::World’ has no member named ‘Name’
   this->dataPtr->transportNode->Init(this->dataPtr->world->Name());
                                                            ^
/home/robot/apps/intel_aero/gazebo-realsense/gzrs/RealSensePlugin.cc: In member function ‘virtual void gazebo::RealSensePlugin::OnNewFrame(gazebo::rendering::CameraPtr, gazebo::transport::PublisherPtr) const’:
/home/robot/apps/intel_aero/gazebo-realsense/gzrs/RealSensePlugin.cc:244:55: error: ‘class gazebo::physics::World’ has no member named ‘SimTime’
   msgs::Set(msg.mutable_time(), this->dataPtr->world->SimTime());
                                                       ^
/home/robot/apps/intel_aero/gazebo-realsense/gzrs/RealSensePlugin.cc: In member function ‘virtual void gazebo::RealSensePlugin::OnNewDepthFrame() const’:
/home/robot/apps/intel_aero/gazebo-realsense/gzrs/RealSensePlugin.cc:309:55: error: ‘class gazebo::physics::World’ has no member named ‘SimTime’
   msgs::Set(msg.mutable_time(), this->dataPtr->world->SimTime());

Fixed by using the update API calls GetName() and GetSimTime().

rchiossi commented 6 years ago

That's quite currious. This change in API name happend when we moved from gazebo 7 to gazebo 8 (and apparently we forgot to update the README), but looking at API 8.2, Name() and SimTime() were deprecated and GetName() and GetSimTime() were brought back.

Thanks for the patch.

stevegray954 commented 6 years ago

I'm setting up the px4 SITL simulation for use with the Intel Aero. px4 seems like they've standardized on ROS Kinetic for the time being (https://dev.px4.io/en/simulation/ros_interface.html), so it'd be good to keep supporting gazebo7 for as long as they do that. Thanks!