Ask Your Question

Error when building package of calibration_publisher while installing Autoware

asked 2019-08-31 22:29:18 -0600

park gravatar image

updated 2019-09-01 06:15:02 -0600

gvdhoorn gravatar image

In autoware 1.12.0, I build the packages as the tutorial from source, and I came across the errors by calibration_publisher as follows:

--- stderr: calibration_publisher                                                                                                
CMakeFiles/calibration_publisher.dir/src/calibration_publisher.cpp.o: In function `main':
calibration_publisher.cpp:(.text.startup+0x9b4): undefined reference to `cv::read(cv::FileNode const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [devel/lib/calibration_publisher/calibration_publisher] Error 1
make[1]: *** [CMakeFiles/calibration_publisher.dir/all] Error 2
make: *** [all] Error 2
Failed   <<< calibration_publisher  [ Exited with code 2 ]
Aborted  <<< ds4                                                                                                                              
Aborted  <<< detected_objects_visualizer                                                                                                  
Aborted  <<< decision_maker_panel

I have tried many times to fix it, but not work

edit retag flag offensive close merge delete


I add an empty file named "COLCON_IGNORE" in the package of calibration_publisher to avoid the bug, and finally build successfully

Ignore calibration_publisher, the demo test will fail.

park gravatar image park  ( 2019-09-01 05:19:15 -0600 )edit

Can you please provide information about your system? ROS version? Did you install OpenCV from source? (if so what version?).

amc-nu gravatar image amc-nu  ( 2019-09-02 01:14:59 -0600 )edit

Sorry, I didn't provide enough information

Hardware Platform: Jetson AGX Xavier

OS: Ubuntu 18.04, installed by the SDK Manager

ROS: melodic, installed from sources by using installROSXavier script

OpenCV: version is 3.4.3, installed from sources by using buildOpenCVXavier script in the path /usr/local, and during install ROS, 3.2.0 is also installed in the path /usr

I also notice that the error also existed in opencv's answers camera_calibration.cpp: undefined reference to cv::read

park gravatar image park  ( 2019-09-02 01:29:03 -0600 )edit

I haven’t used the Jetson Hacks’ script you mentioned. I would recommend you to try a clean install. Don’t forget to run rosdep to install the opencv version to which ros’ cv_bridge was linked.( please also have in mind that Nvidia provides its own versions of OpenCV. In the case you selected that when you set up your AGX).

amc-nu gravatar image amc-nu  ( 2019-09-02 02:48:27 -0600 )edit

Yes, I have tried the version of OpenCV provided by Nvidia, but it also failed. Next step, I will try to build autoware 1.12.0 on a x86_64 platform for test

park gravatar image park  ( 2019-09-02 03:04:31 -0600 )edit

The error is caused by the codes in calibration_publisher.cpp;

fs["CameraExtrinsicMat"] >> CameraExtrinsicMat;
fs["CameraMat"] >> CameraMat;
fs["DistCoeff"] >> DistCoeff;
fs["ImageSize"] >> ImageSize;
fs["DistModel"] >> DistModel;
park gravatar image park  ( 2019-09-02 03:09:05 -0600 )edit

Please use apt versions of OpenCV. The easiest way is to use rosdep to install the correct ones.

amc-nu gravatar image amc-nu  ( 2019-09-02 03:21:02 -0600 )edit

Yes I have also tried and it doesn't seem to be a problem of the OpenCV installation.

Now, I comment the following line:

fs["DistModel"] >> DistModel;

and passed the build, very strange.

park gravatar image park  ( 2019-09-02 03:55:37 -0600 )edit

2 Answers

Sort by » oldest newest most voted

answered 2020-11-02 06:02:05 -0600

jdj gravatar image

This error occurs when the opencv library cannot be loaded. Please refer to the address below

edit flag offensive delete link more


Awesome! It works.

heylypp gravatar image heylypp  ( 2020-11-11 01:58:58 -0600 )edit

answered 2019-09-02 04:20:03 -0600

park gravatar image

updated 2019-09-02 04:21:24 -0600

I add a definition in the file of calibration_publisher.cpp:

static cv::Mat CameraExtrinsicMat;
static cv::Mat CameraMat;
static cv::Mat DistCoeff;
static cv::Size ImageSize;
static std::string DistModel
static cv::String DistModel_cv;

then modify the corresponding code to:

fs["DistModel"] >> DistModel_cv;
DistModel = DistModel_cv.operator std::string();

that is to convert cv::String to std::string, and the error is finally solved. I will test the demo next step.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-08-31 22:29:18 -0600

Seen: 476 times

Last updated: Nov 02 '20