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

Undefined references after catkinizing an old fuerte package

asked 2013-08-13 04:47:48 -0500

Schluchti gravatar image

updated 2016-10-24 09:01:53 -0500

ngrennan gravatar image

Hi, i am trying to use "arm_3d_cb_calib" which is part of the "gt-ros-pkg.cpl" to calibrate a Kinect with my workspace.

In order to use it i had to catkinize the package since i am using ROS Groovy. The Problem is when trying to compile it i get a lot of undefined references errors.

I feel like i missed some dependencies but i am too inexperienced to figure out what i have to add where.

Alternatively a different, working package to calibrate a Kinect with any Robot would work as well.

Cmakelists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(arm_3d_cb_calib)
# Load catkin and all dependencies required for this package
# TODO: remove all from COMPONENTS that are not catkin packages.
find_package(catkin REQUIRED COMPONENTS roscpp cv_bridge stereo_msgs sensor_msgs tf camera_calibration)

include_directories(include ${Boost_INCLUDE_DIR} ${catkin_INCLUDE_DIRS})
# CATKIN_MIGRATION: removed during catkin migration
# cmake_minimum_required(VERSION 2.4.6)

# CATKIN_MIGRATION: removed during catkin migration
# include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)


#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)


find_package(GTSAM)

find_package(PCL 1.3 REQUIRED COMPONENTS common io)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

add_library(${PROJECT_NAME} src/calib_3d_cbs.cpp)
add_executable(test_cb_calib src/test_cb_calib.cpp)
target_link_libraries(test_cb_calib ${PROJECT_NAME} gtsam-static)
add_executable(find_cb_calib src/find_cb_calib.cpp)
target_link_libraries(find_cb_calib ${PROJECT_NAME} gtsam-static)

# TODO: fill in what other packages will need to use this package
## DEPENDS: system dependencies of this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## INCLUDE_DIRS: 
## LIBRARIES: libraries you create in this project that dependent projects also need
catkin_package(
    DEPENDS roscpp cv_bridge opencv2 stereo_msgs sensor_msgs tf camera_calibration
    CATKIN_DEPENDS opencv2# TODO
    INCLUDE_DIRS # TODO include
    LIBRARIES # TODO
)

Package.xml:

<package>
  <name>arm_3d_cb_calib</name>
  <version>1.0.0</version>
  <description>Utility for calibrating cameras and RGB-D sensors to a robot arm
      holding a checkerboard.  The optimization procedure takes a set of 
      3D checkerboard corner detections and corresponding end effector
      poses to find the both, the transformation between the end effector 
      and the checkerboard frame, and the transformation between the /base_link
      and the sensor's frame. The assumption is that the pose of the checkerboard
      with respect to the end effector is fixed, and that enough samples are obtained
      such that the checkerboard offset can be uniquely determined.  In practice,
      having over 12 checkerboard captures is recommended such that all 6 degrees of 
      freedom of its pose are expressed in the sensor.</description>
  <!-- <maintainer>Kelsey</maintainer> -->

  <license>BSD</license>
  <maintainer <a href="mailto:email="kelsey@todo.todo">kelsey</maintainer">email="kelsey@todo.todo">kelsey</maintainer</a>>
  <url type="website"></url>
  <!-- <url type="bugtracker"></url> -->

  <author>Kelsey</author>

<buildtool_depend>catkin</buildtool_depend>

  <build_depend>roscpp</build_depend> 
  <build_depend>cv_bridge</build_depend> 
 <build_depend>opencv2</build_depend> 
 <build_depend>stereo_msgs</build_depend> 
  <build_depend>sensor_msgs</build_depend>
 <build_depend>tf</build_depend> 
 <build_depend>camera_calibration</build_depend> 
  <run_depend>roscpp</run_depend> 
  <run_depend>cv_bridge</run_depend> 
 <run_depend>opencv2</run_depend> 
 <run_depend>stereo_msgs</run_depend>
 <run_depend>sensor_msgs</run_depend> 
 <run_depend>tf</run_depend> 
  <run_depend>camera_calibration</run_depend>
  <!-- <test_depend>roscpp</test_depend> -->
  <!-- <test_depend>cv_bridge</test_depend> -->
  <!-- <test_depend>opencv2</test_depend> -->
  <!-- <test_depend>stereo_msgs</test_depend> -->
  <!-- <test_depend>sensor_msgs ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-08-13 05:01:59 -0500

thebyohazard gravatar image

updated 2013-08-16 04:07:40 -0500

The linker needs link your code with the ros libraries you use. The cmake macro find_package(catkin REQUIRED COMPONENTS whatever-package) loads the libraries from whatever-package into a variable called catkin_LIBRARIES. So then you need to tell the linker to use these libraries with the macro target_link_libraries(whatever-executable ${catkin_LIBRARIES})

EDIT:

Overlays let you roll your own stack on top of an existing one. For example, if you'd like to add a new feature to roscpp, you could make your own version and use environment variables to make your system find that one instead of the default one. You could just as easily change it back. However, I guess if you don't know what it is, it likely isn't your current problem!

edit flag offensive delete link more

Comments

I modified my cmakelists with the line "find_package(catkin REQUIRED COMPONENTS pcl pcl_ros rosbag roscpp)" and the target_link_libraries macro and it solved 95% of the reference errors. I still get undefined reference to ros::param::has and ros::param::get though. I thought this was part of roscpp?

Schluchti gravatar image Schluchti  ( 2013-08-14 02:42:55 -0500 )edit

Yeah, it is. I don't know why it wouldn't find them. You're not overlaying on top of roscpp, are you?

thebyohazard gravatar image thebyohazard  ( 2013-08-14 04:18:35 -0500 )edit

I have no idea what you mean by that. :)

Schluchti gravatar image Schluchti  ( 2013-08-16 01:42:27 -0500 )edit

Is there any other explanation to these undefined reference to ros:param:has errors?

Schluchti gravatar image Schluchti  ( 2013-08-20 02:49:53 -0500 )edit

That's a linker error rather than a compilation one. Did you build from source? The only other thing would be if roscpp didn't build correctly. If you're successfully linking against the right library, you shouldn't have any problems. I'd hesitate to say "bug" unless somebody else has the problem.

thebyohazard gravatar image thebyohazard  ( 2013-08-20 03:24:03 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2013-08-13 04:47:48 -0500

Seen: 317 times

Last updated: Aug 16 '13