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

Undefined symbol in custom costmap layer during runtime caused by tf2 Buffer transform

asked 2017-08-01 01:40:09 -0500

9a3eedi gravatar image

updated 2017-08-01 04:02:05 -0500

I am writing a custom costmap layer to read data from a radar sensor and turn it into a costmap, and I'm facing some issues running it. I get the following error when it runs:

symbol lookup error: /home/mkhoory/sdc/catkin_ws/devel/lib//libRadarDataLayer.so: undefined symbol: _ZN3tf212getTimestampIN13geometry_msgs15PolygonStamped_ISaIvEEEEERKN3ros4TimeERKT_

What the related code is trying to do is create a PolygonStamped from the radar data and convert it to world coordinates via tf2.

tfBuffer.transform(polyRadar, polyWorld, globalFrame);

I'm not sure what I'm doing wrong here. The code compiles fine, and it's only when the plugin reaches the above line that it tells me that it's an undefined reference. I tried including tf2_geometry_msgs.h but that didn't do anything. What am I missing?

EDIT: Here's my CMakeLists.txt:


cmake_minimum_required(VERSION 2.8.3)
project(my_project_processing)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  geometry_msgs
  message_generation
  tf
  tf2
  tf2_geometry_msgs
  costmap_2d
  dynamic_reconfigure
  my_project_sensors
)

find_package(Boost REQUIRED COMPONENTS system thread)

add_message_files(
    FILES
    CommandMessage.msg
)

generate_messages(
  DEPENDENCIES
  std_msgs
  geometry_msgs
)

catkin_package(
  INCLUDE_DIRS include
  LIBRARIES
  CATKIN_DEPENDS roscpp rospy std_msgs tf message_runtime geometry_msgs message_generation
  DEPENDS Boost
)

# let's use C++11
SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")

include_directories(
  include
  ${tf2_INCLUDE_DIRS}
  ${catkin_INCLUDE_DIRS}
  ${Boost_INCLUDE_DIRS}
)

# Costmap2D Layer plugin
add_library(RadarDataLayer lib/RadarDataLayer.cpp)
target_link_libraries(RadarDataLayer ${Boost_LIBRARIES} ${catkin_LIBRARIES})
edit retag flag offensive close merge delete

Comments

This is a (deferred) linker error, not a compilation issue.

Please post your CMakeLists.txt -- make sure to remove all the boilerplate comments from it first (lines starting with #).

gvdhoorn gravatar image gvdhoorn  ( 2017-08-01 02:27:29 -0500 )edit

I think I may have found the problem. tf2_geometry_msgs only supports native transformations certain types of messages from geometry_msgs, and PolygonStamped isn't one of them, according to this link http://wiki.ros.org/tf2_geometry_msgs . I'm not sure yet so I'm going to try another type first.

9a3eedi gravatar image 9a3eedi  ( 2017-08-01 03:17:48 -0500 )edit

I would expect to see a compiler error ("no candidates" or "no matching function call for ..") in that case, not a linker error. A 'missing symbol error' basically means that the compiler embedded the use of an external symbol in your library, but you didn't link against all needed dependencies.

gvdhoorn gravatar image gvdhoorn  ( 2017-08-01 03:20:09 -0500 )edit

Hi, I added my CMakeLists.

9a3eedi gravatar image 9a3eedi  ( 2017-08-01 04:02:50 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-08-09 00:50:09 -0500

9a3eedi gravatar image

It turns out that tf2_geometry_msgs does not support transforming PolygonStamped!

I changed my code so that instead of transforming PolygonStamped, it would transform each individual Point in it (i.e. I was transforming PointStamped instead now). This seems to work fine and did not get any issues.

edit flag offensive delete link more

Comments

Ok. Thanks for reporting back.

Would it make sense to add the support and submit a pull request against tf2_geometry_msgs to get it merged upstream?

gvdhoorn gravatar image gvdhoorn  ( 2017-08-09 01:47:40 -0500 )edit

I think it would make sense for convenience sake. I can imagine a lot of reasons why you'd want to do it.

9a3eedi gravatar image 9a3eedi  ( 2017-08-10 00:44:28 -0500 )edit

Seeing as you've already done it, would it be possible for you submit a PR? :)

gvdhoorn gravatar image gvdhoorn  ( 2017-08-10 02:49:29 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2017-08-01 01:40:09 -0500

Seen: 461 times

Last updated: Aug 09 '17