Ask Your Question
2

Compiling External Libraries (Bullet 2.81) with ROS package [closed]

asked 2013-02-28 16:31:36 -0500

barragan gravatar image

updated 2014-04-20 14:09:40 -0500

ngrennan gravatar image

Apologies in advance for the long winded explanation. I want to make sure I explain clearly.

I have written some code that works with the Bullet Physics Engine to simulate some models for a bayesian filter. I can compile this code using g++ with this command line statement:

g++ main.cpp BasicDemo.cpp -lGL -lGLU -I ~/Documents/cppCode/bullet-2.81-rev2613/src/ ~/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/BulletDynamics/libBulletDynamics.a ~/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/BulletCollision/libBulletCollision.a ~/Documents/cppCode/bullet-2.81-rev2613/bullet-build/src/LinearMath/libLinearMath.a -o main

where those paths lead to the proper files on my particular system. I am using a PR2 to generate observations for my bayesian filter. Up to this point, I simply used another bullet simulation to do this but now want to use the PR2 instead. So I have written the necessary code on the PR2 side and the communication code to send a command to the PR2 to execute an action and return an observation. My plan was to add the other side of this communication code to my bullet and filter code and thus have the connection I'm looking for. As a first step, I placed the bullet and filter code into a ros package. I needed to modify my CMakelists to link to the compiled bullet code that exists on my machine. After much arguing and experimenting, I produced the CMakeLists.txt file that I have copied and pasted at the bottom of this post.

This compiled the code with no errors. The reason that the CMakeLists is written the way it is is because ROS Fuerte has a version of bullet physics in it. However, the version is older than the version that I need for parts of my code. I am using bullet 2.81. So I had to force cmake to find my libraries before it found the ones in my regular ROS search paths. This caused the manually adding flags section. Before I did this, it would tell me that certain classes did not have certain members which was true for the older bullet physics in ROS but is not true for the newer version I have been using. After these changes, the errors went away.

However, when I run the code, it throws a segmentation fault. This code is an exact copy (besides changing the header files to the regular way that a ros package would have them [for example instead of "BasicDemo.h" in my old files, it would be <basicbayesv2wrobot basicdemo.h=""> where basicBayesV2wRobot is the name of the package]) of the code that compiles and runs properly when compiled with the g++ command above.

I have very little experience with cmake and especially with compiling external libraries in a ROS package and making sure ROS finds my libraries which are a newer version of libraries it has. Does anyone have any experience with this. The line that seg faults (according to gdb) is a line that gives no errors ... (more)

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by tfoote
close date 2013-04-05 07:29:18

Comments

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-03-05 07:31:26 -0500

KruseT gravatar image

I cannot tell you where this goes wrong. but if you are more comfortable with plain Make, you could just not use cmake (nor rosmake) to create your executable.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-02-28 16:31:36 -0500

Seen: 703 times

Last updated: Mar 05 '13