Camera::SetHFOV functions are ambiguous when a double is passed

Issue #1830 new
Steven Peters created an issue

I've been testing gazebo_ros_pkgs with our gazebo7 candidate, and there's an issue with the rendering::Camera::SetHFOV functions modified in pull request #1995. Currently the function signatures are:

      /// \brief Set the camera FOV (horizontal)
      /// \param[in] _angle Horizontal field of view
      /// \deprecated See function the accepts an ignition::math parameter
      public: void SetHFOV(math::Angle _angle) GAZEBO_DEPRECATED(7.0);

      /// \brief Set the camera FOV (horizontal)
      /// \param[in] _angle Horizontal field of view
      public: void SetHFOV(const ignition::math::Angle &_angle);

The gazebo_ros_camera_utils.cpp file currently calls SetHFOV with a double input, which confuses the compiler since both ignition::math::Angle and gazebo::math::Angle have constructors from type double. So it fails to compile:

gazebo_plugins/src/gazebo_ros_camera_utils.cpp: In member function void gazebo::GazeboRosCameraUtils::SetHFOV(const ConstPtr&):
gazebo_plugins/src/gazebo_ros_camera_utils.cpp:363:36: error: call of overloaded SetHFOV(const _data_type&) is ambiguous
   this->camera_->SetHFOV(hfov->data);
                                    ^
gazebo_plugins/src/gazebo_ros_camera_utils.cpp:363:36: note: candidates are:
In file included from gazebo_plugins/src/gazebo_ros_camera_utils.cpp:41:0:
gazebo/rendering/Camera.hh:301:20: note: void gazebo::rendering::Camera::SetHFOV(gazebo::math::Angle)
       public: void SetHFOV(math::Angle _angle) GAZEBO_DEPRECATED(7.0);
                    ^
gazebo/rendering/Camera.hh:305:20: note: void gazebo::rendering::Camera::SetHFOV(const ignition::math::Angle&)
       public: void SetHFOV(const ignition::math::Angle &_angle);
                    ^

There are workarounds for this, but it's worth keeping in mind as we continue our quest to use ignition::math.

Comments (2)

  1. Log in to comment