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

Wrap existing crrcsim project in ROS

asked 2011-12-11 18:46:47 -0600

HNygaard gravatar image

updated 2011-12-12 19:12:32 -0600

Hi - I would love to use CRRCSIM with ROS.

CRRCSIM is an open source RC-plane simulator - compiled with autotools (autoheader/automake etc..). This is all fine and easy, except when you want to integrate ROS. My Makefile experience is not big enough to wrap ROS into the existing project - circumventing rosmake.

So far I have succeeded in adding the ROS includes manually to the existing Makefile, however it seems that the Linker fails to identify ROS functions. Adding "include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)" to the CRRCSIM CMakeList.txt returns errors when compiling the project.

I have looked at Wrapping external packages but got none the wiser - could someone point me in the right direction of how to integrate ROS in this program without using rosmake - or editing the makefilesystem to make rosmake work - either way works for me?

Thanks /Hjalte

EDIT: DimitriProsser helped getting the simulator compiling with rosmake by supplying a Makefile and CMakeList.txt - Thank you!

However, my goal is not quite reached yet - as I wish to have the simulator publish sensor(IMU/GPS/etc) data and subscribe to servo controls (for controlling the plane). But when I #include <ros/ros.h> in the crrc_main.cpp file it fails to find the header as it's build with its own Makefile, I can edit the Makefile.in DEFAULT_INCLUDES to include my ros directory -> it then finds the headers, but fails with:

    /CRRCsim/build/crrcsim-0.9.11/src/crrc_main.cpp:573: undefined reference to `ros::init(int&, char**, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)'
>  collect2: ld returned 1 exit status

(I just added ros::init(argc, argv, "crrc_main"); as the very first line of the main loop). And then I'm back at square one.

So now the question is, how do I "Ros'ify" the simulator to make it publish/subscribe and use all the wonderful features of ROS?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2011-12-12 02:41:32 -0600

DimitriProsser gravatar image

updated 2011-12-13 02:19:08 -0600

I just took a look at this software and I managed to get it to compile under ROS. I just put together a quick Makefile to help you on your way. This can definitely be improved in the future. Here's what I did:

roscreate-pkg CRRCsim roscpp

Replace the contents of Makefile with this.

Replace the contents of CMakeLists.txt with this.

Then, rosmake will work correctly. NOTE: I did not write a rosdep for this package, and it requires plib, so you'd need to write that rosdep for this to work properly.

EDIT: The general idea is that you do not modify the existing library. This is to allow for updates from the original project without causing huge amounts of conflicts between your added code and the original project's update.

Take Gazebo for example... ROS compiles Gazebo as is from the original Gazebo source. Maybe some patches are applied to this process (which can exist outside of the source distribution, thus the source is modified without actually changing its files). Then, ROS provides Gazeboros, which is a ROS program that handles the Gazebo/ROS interface. This is done using the Gazebo API. If CRRCsim has a code API, then this could easily be accomplished. Otherwise, patches might be more appropriate.

edit flag offensive delete link more

Comments

Thank you very much for your help DimitriProsser. I successfully compiled with rosmake (removing the MD5SUM_FILE parameter). However, I still fail at my goal, which is to have the simulator publishing sensor data and subscribing to servocontrols. Please refer to question edit for details. Thank you
HNygaard gravatar image HNygaard  ( 2011-12-12 19:09:22 -0600 )edit
Thank you for your patience. It is unclear to me how i should access and control the simulator externally (using an API). Tried making a small test patch with diff -rupN oldcrrc/ new/ > my.patch and add it to the Makefile, but it fails with: 2 out of 2 hunks FAILED, perhaps I'm doing it wrong..
HNygaard gravatar image HNygaard  ( 2011-12-13 03:06:58 -0600 )edit
I'm not very knowledgeable when it comes to patching. I think a good option would be to start another thread to address that issue (since it's a whole new question).
DimitriProsser gravatar image DimitriProsser  ( 2011-12-13 05:21:05 -0600 )edit
Thank you, I will do that
HNygaard gravatar image HNygaard  ( 2011-12-13 23:51:08 -0600 )edit

Question Tools

Stats

Asked: 2011-12-11 18:46:47 -0600

Seen: 949 times

Last updated: Dec 13 '11