Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gazebo7 fixes #381

Merged
merged 4 commits into from
Jan 16, 2016
Merged

Gazebo7 fixes #381

merged 4 commits into from
Jan 16, 2016

Conversation

scpeters
Copy link
Member

This fixes three separate build errors when using gazebo7 (related to #375):

  • a27311b: a boost header was removed from a gazebo header and was being used implicitly by gazebo_ros_joint_state_publisher.cpp
  • ce0ab10: resolve ambiguity between overloaded functions ( upstream issue ).
  • 194ebf8: sensor pointers changed from boost to std shared pointers. I've added a macro called GAZEBO_SENSORS_USING_DYNAMIC_POINTER_CAST to gazebo_ros_utils.h that provides a using statement so that dynamic_pointer_cast can be used more easily.

The SensorPtr types have changed from boost:: pointers
to std:: pointers,
which requires boost::dynamic_pointer_cast to change to
std::dynamic_pointer_cast.
A helper macro is added that adds a `using` statement
corresponding to the correct type of dynamic_pointer_cast.
This macro should be narrowly scoped to protect
other code.
Some boost headers were remove from gazebo7 header files
and gazebo_ros_joint_state_publisher.cpp was using it
implicitly.
In gazebo7, the rendering::Camera::SetHFOV function
is overloaded with a potential for ambiguity,
as reported in the following issue:
https://bitbucket.org/osrf/gazebo/issues/1830
This fixes the build by explicitly defining the
Angle type.
@@ -41,6 +41,14 @@
#include <gazebo/sensors/Sensor.hh>
#include <ros/ros.h>

#ifndef GAZEBO_SENSORS_USING_DYNAMIC_POINTER_CAST
# if GAZEBO_MAJOR_VERSION >= 7
#define GAZEBO_SENSORS_USING_DYNAMIC_POINTER_CAST using std::dynamic_pointer_cast
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for my own education, what's the reasoning behind using using as opposed to making xxx::dynamic_pointer_cast a macro?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In urdfdom we made wrapper functions in types.h so you could call urdf::dynamic_pointer_cast. In this case, we haven't switched all of gazebo's pointers yet (sensors uses std:: in gazebo7 while physics still uses boost::). It seemed like these using macros (which can be scoped) would be a more compact way to allow for different pointer types.

@hsu
Copy link
Collaborator

hsu commented Jan 15, 2016

other than the comment about the macro, everything looks good and compiles. Thanks!

@hsu
Copy link
Collaborator

hsu commented Jan 15, 2016

+1

Make sure to include gazebo_config.h,
which defines the GAZEBO_MAJOR_VERSION macro
scpeters added a commit that referenced this pull request Jan 16, 2016
@scpeters scpeters merged commit 048770a into indigo-devel Jan 16, 2016
@scpeters scpeters deleted the gazebo7_fixes branch January 16, 2016 01:36
cohen39 pushed a commit to cohen39/gazebo_ros_pkgs that referenced this pull request Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants