ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Throst Gunnulf's profile - activity

2013-09-18 23:37:08 -0500 received badge  Famous Question (source)
2013-08-26 06:55:38 -0500 answered a question Undefined reference to log4cxx when adding openni_camera dependency to package

Hey, I don't know if this is still useful, but I just solved a similar problem. In any case, I'll leave my solution here.

What I did was to add the following line to the begginning of my CMakeLists.txt.


What this does is link every executable to the log4cxx library.

Keep in mind that link_libraries() is deprecated, so if this problem only occurs with one executable, it is preferred to use target_link_libraries(). I did not use this because the errors occurred in every executable, so link_libraries() was an easier solution.

If this does not solve your problem, don't hesitate in asking me for help, I'll try my best to help you solve the problem.

2013-08-23 23:05:26 -0500 received badge  Notable Question (source)
2013-08-22 04:24:30 -0500 received badge  Popular Question (source)
2013-08-22 04:02:01 -0500 answered a question Unable to lookup transform, cache is empty.

I finally solved this problem. I'm posting the answer because it might help someone else.

If you look into the code I had before you will notice I made all my calculations inside the callback function of the topic the node subscribes to. This post instructed me that the callback function is not the best place to perform calculations.

Knowing this, I restructured my code into this, which solved the problem.

2013-08-16 00:33:52 -0500 received badge  Supporter (source)
2013-08-12 23:46:44 -0500 asked a question Unable to lookup transform, cache is empty.

Hi everybody! I'm a newcomer to the ROS world, so please do correct me when necessary, it will be appreciated. If there's a better way of doing something, I'm also interested and open to corrections. I have searched a lot for questions with similar problems, but none of the solutions work in my case. Now, onto the question:

Edit: I forgot to mention I'm using ROS Fuerte.

I have a Kinect mounted on top of a robot, 16 cm above the robot's referential. What I want to do is to transform the point cloud and depth image that Kinect publishes (in the /camera/depth_registered/points topic) to be referenced to the robot's referential. Also, I want to publish a new point cloud that uses spherical coordinates instead of cartesian coordinates.

Everything seems to be doing what is expected (things appear correct when I see them with Rviz), but after some seconds, the following error message starts to appear repeatedly and everything freezes in Rviz:

Unable to lookup transform, cache is empty, when looking up transform from frame [/camera_rgb_optical_frame] to frame [/impep_frame]

Also, Rviz produces the following warning message:

MessageFilter [target=/impep_frame ]: Discarding message from [/kinectRef2IMPEPRef] due to empty frame_id.  This message will only print once.

This is the launch file I use:

  <!-- Launch the static transform publisher that defines the transform
      from IMPEP's referential to Kinect's referential. -->
  <node name="impep_frame_publisher" pkg="tf" type="static_transform_publisher" args="0 0 0.16 0.5 -0.5 0.5 0.5 /impep_frame /camera_link 100" />

  <!-- Launch the node that transforms data from Kinect's referential to
       IMPEP's referential -->
  <node name="kinectRef2IMPEPRef" pkg="IMPEP" type="kinectRef2IMPEPRef" />

  <!-- Include the openni launch file to start the Kinect nodes. -->
  <include file="$(find IMPEP)/launch/openni.launch" />

Note: I changed the following line in the openni.launch file to have depth registered output.

<!-- Use OpenNI's factory-calibrated depth->RGB registration? -->
<arg name="depth_registration" default="true" />

This is the code I've written to do all this. I'm aware that some things can be optimized, but I want to understand what's going wrong with this code before I start optimizing it. I put it in Pastebin for easier reading, it is too big to post here (185 lines).

Note: PointDTPRGB is a point type created by myself to contain the spherical coordinates.

Edit2: I just noticed that, after I shutdown the nodes launched by the launch file above, this message related to my problematic node appears:

[kinectRef2IMPEPRef-3] escalating to SIGTERM

If you need any information I might have forgotten, please do ask for it, I will post it as soon as possible. Thanks in advance!

2013-07-17 06:24:42 -0500 received badge  Teacher (source)
2013-07-16 10:45:41 -0500 received badge  Editor (source)
2013-07-16 10:33:59 -0500 answered a question Problem using ROS-Package-Headers in Gazebo-Plugin

Solution 2 (better)

I realised there is a much simpler way of solving this problem. Just create a ROS package as usual with your plugin code in the /src/ folder of the ROS package directory. Then, edit your CMakeLists.txt to be something like this

cmake_minimum_required(VERSION 2.4.6)

include (FindPkgConfig)
  pkg_check_modules(GAZEBO gazebo)

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)


#set the default path for built executables to the "bin" directory
#set the default path for built libraries to the "lib" directory

#uncomment if you have defined messages
#uncomment if you have defined services


#common commands for building c++ executables and libraries
rosbuild_add_library(${PROJECT_NAME} ${GAZEBO_libraries} src/
#target_link_libraries(${PROJECT_NAME} another_library)
#rosbuild_link_boost(${PROJECT_NAME} thread)
#rosbuild_add_executable(example examples/example.cpp)
target_link_libraries(${PROJECT_NAME} ${GAZEBO_libraries})

What this does is compile your plugin into a .so file (output to the /lib/ folder). Put this plugin into one of the directories in the GAZEBO_PLUGIN_PATH environment variable and everything should run just fine.

Solution 1

Hey, sorry for the delay. I am quite new to Gazebo and ROS, so take everything I say with a grain of salt. The following makes sense in my head, but I might be terribly wrong about some things. Nevertheless, it solved my problem. I hope this helps. Don't hesitate to ask for a better explanation of something I might have overlooked.

First, I assume you use a CMake script similar to this one to compile your plugin into a .so file.

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

include (FindPkgConfig)
  pkg_check_modules(GAZEBO gazebo)


add_library(example SHARED
target_link_libraries(example ${GAZEBO_libraries})

The first thing I did, to solve the missing header files, was to change the sixth and the last lines to the following.

include_directories(${GAZEBO_INCLUDE_DIRS} /path/to/ROS/include/folder)

target_link_libraries(example ${GAZEBO_libraries} ${LD_LIBRARY_PATH})

Notice you should change /path/to/ROS/include/folder to the correct path to your ROS include folder. In my system, the path is /opt/ros/fuerte/include/

Now, if you run the CMake script, the compiler should find the header files and compile everything without problems. But, if you're using functions that are defined in the example_package package, when you run the Gazebo plugin, you will probably get an error saying something like "undefined symbol". This is because the linker doesn't know where the code of the functions is.

The problem here is that this code is defined in the example_package package, and I don't know how to link a program with a ROS package. Luckily, I found the following CMake script, which, when included in your ...

2013-07-16 03:35:58 -0500 commented question Problem using ROS-Package-Headers in Gazebo-Plugin

I'll try to post an answer later today. I am new to these forums, so I need to learn how to correctly format everything and can only do that later.

2013-07-16 01:46:55 -0500 commented question Problem using ROS-Package-Headers in Gazebo-Plugin

Hey, are you using simulator_gazebo (the ROS package) or the Gazebo 1.9 (the standalone)? If you're using the standalone, I might be able to help you as I just solved a similar problem.