-
Notifications
You must be signed in to change notification settings - Fork 766
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
Gazebo7 fixes #381
Conversation
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
other than the comment about the macro, everything looks good and compiles. Thanks! |
+1 |
Make sure to include gazebo_config.h, which defines the GAZEBO_MAJOR_VERSION macro
This fixes three separate build errors when using gazebo7 (related to #375):
GAZEBO_SENSORS_USING_DYNAMIC_POINTER_CAST
togazebo_ros_utils.h
that provides ausing
statement so thatdynamic_pointer_cast
can be used more easily.