ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

vision_opencv install/build error

asked 2017-07-05 22:49:46 -0500

Allen Ayala gravatar image

I have been trying to install the ROS package called vision_opencv, in order to run some OpenCV 3.2 code with ROS Kinetic on a Parrot 1.0 AR Drone. I tried the install by executing git clone https://github.com/ros-perception/vision_opencv within my ~/catkin_ws/src directory. Then, I ran catkin_make in ~/catkin_ws but received the following error:

.....(some terminal ouput intentionally left blank)......

[ 96%] Built target ardronelib
[ 97%] Built target ardrone_driver
/home/robotics/catkin_ws/src/vision_opencv/image_geometry/src/pinhole_camera_model.cpp: In member function ‘bool image_geometry::PinholeCameraModel::fromCameraInfo(const CameraInfo&)’:
/home/robotics/catkin_ws/src/vision_opencv/image_geometry/src/pinhole_camera_model.cpp:87:12: error: no match for ‘operator=’ (operand types are ‘boost::shared_ptr<image_geometry::PinholeCameraModel::Cache>’ and ‘std::shared_ptr<image_geometry::PinholeCameraModel::Cache>’)
     cache_ = std::make_shared<Cache>();
            ^
In file included from /usr/include/boost/shared_ptr.hpp:17:0,
                 from /usr/include/boost/format/alt_sstream.hpp:21,
                 from /usr/include/boost/format/internals.hpp:23,
                 from /usr/include/boost/format.hpp:38,
                 from /usr/include/boost/math/policies/error_handling.hpp:31,
                 from /usr/include/boost/math/special_functions/round.hpp:14,
                 from /opt/ros/kinetic/include/ros/time.h:58,
                 from /opt/ros/kinetic/include/ros/serialization.h:34,
                 from /opt/ros/kinetic/include/sensor_msgs/CameraInfo.h:14,
                 from /opt/ros/kinetic/include/image_geometry/pinhole_camera_model.h:4,
                 from /home/robotics/catkin_ws/src/vision_opencv/image_geometry/src/pinhole_camera_model.cpp:3:
/usr/include/boost/smart_ptr/shared_ptr.hpp:500:18: note: candidate: boost::shared_ptr<T>& boost::shared_ptr<T>::operator=(const boost::shared_ptr<T>&) [with T = image_geometry::PinholeCameraModel::Cache]
     shared_ptr & operator=( shared_ptr const & r ) BOOST_NOEXCEPT
                  ^
/usr/include/boost/smart_ptr/shared_ptr.hpp:500:18: note:   no known conversion for argument 1 from ‘std::shared_ptr<image_geometry::PinholeCameraModel::Cache>’ to ‘const boost::shared_ptr<image_geometry::PinholeCameraModel::Cache>&’
/usr/include/boost/smart_ptr/shared_ptr.hpp:509:18: note: candidate: template<class Y> boost::shared_ptr<T>& boost::shared_ptr<T>::operator=(const boost::shared_ptr<Y>&) [with Y = Y; T = image_geometry::PinholeCameraModel::Cache]
     shared_ptr & operator=(shared_ptr<Y> const & r) BOOST_NOEXCEPT
                  ^
/usr/include/boost/smart_ptr/shared_ptr.hpp:509:18: note:   template argument deduction/substitution failed:
/home/robotics/catkin_ws/src/vision_opencv/image_geometry/src/pinhole_camera_model.cpp:87:12: note:   ‘std::shared_ptr<image_geometry::PinholeCameraModel::Cache>’ is not derived from ‘const boost::shared_ptr<X>’
     cache_ = std::make_shared<Cache>();
            ^
In file included from /usr/include/boost/shared_ptr.hpp:17:0,
                 from /usr/include/boost/format/alt_sstream.hpp:21,
                 from /usr/include/boost/format/internals.hpp:23,
                 from /usr/include/boost/format.hpp:38,
                 from /usr/include/boost/math/policies/error_handling.hpp:31,
                 from /usr/include/boost/math/special_functions/round.hpp:14,
                 from /opt/ros/kinetic/include/ros/time.h:58,
                 from /opt/ros/kinetic/include/ros/serialization.h:34,
                 from /opt/ros/kinetic/include/sensor_msgs/CameraInfo.h:14,
                 from /opt/ros/kinetic/include/image_geometry/pinhole_camera_model.h:4,
                 from /home/robotics/catkin_ws/src/vision_opencv/image_geometry/src/pinhole_camera_model.cpp:3:
/usr/include/boost/smart_ptr/shared_ptr.hpp:520:18: note: candidate: template<class Y> boost::shared_ptr<T>& boost::shared_ptr<T>::operator=(std::auto_ptr<_Up>&) [with Y = Y; T = image_geometry::PinholeCameraModel::Cache]
     shared_ptr & operator=( std::auto_ptr<Y> & r ...
(more)
edit retag flag offensive close merge delete

Comments

Which version of ROS are you using ?

jeanpolochon gravatar image jeanpolochon  ( 2017-07-06 01:47:33 -0500 )edit

As mentioned in the question, I am using ROS Kinetic and OpenCV 3.2

Allen Ayala gravatar image Allen Ayala  ( 2017-07-06 08:33:11 -0500 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2017-07-07 23:24:11 -0500

Ed Venator gravatar image

Someone else reported this problem in an issue on GitHub. I described the root cause in my comment there. You can fix the problem either by uninstalling the packaged version of image_geometry or by editing the CMakeLists.txt file so that include_directories(include) comes before include_directories(${catkin_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} )

edit flag offensive delete link more

Comments

Thanks for the suggestion, but a friend of mine was able to solve the issue. Details of how he solved it are outlined in my answer.

Allen Ayala gravatar image Allen Ayala  ( 2017-07-08 15:17:35 -0500 )edit
0

answered 2017-07-08 15:16:08 -0500

Allen Ayala gravatar image

The issue has been solved. A friend of mine helped me out and figured out that there were two pinhole_camera_model.h files that existed on my computer. One in /opt/ros/kinetic/include/image_geometry while the other was in the vision_opencv package pulled from the Git repo. These two files were the same, except for their data type choice of shared_ptr<image_geometry::PinholeCameraModel::Cache. The one within /opt/kinetic... was of type boost:shared_ptr... while the one from the Git repo was of type std::shared_ptr..... Since pinhole_camera_model.cpp included pinhole_camera_model.h , it had chosen that from /opt/kinetic/... instead of that from the repo. To fix this, the filename of the header file from the repo was changed. Along with changing the filename in include statement of the source file and the filename int he CMakeLists.txt file of my package, the build issue was solved.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2017-07-05 22:49:46 -0500

Seen: 1,010 times

Last updated: Jul 08 '17