Running C++ ROS code outside package

asked 2016-01-27 07:06:44 -0600

esillen gravatar image

I have a C++ program built without using ROS in mind. Now I want to be able to plot stuff from this program using ROS messages to rviz. I have troubles compiling and need some help!

I know that you can run a python ROS script without doing

rosrun package node

but simply

python my_ros_program.py

and still be able to send ros messages. I want to be able to be able to compile and run my c++ program like that without the extra effort of creating a package and a catkin workspace.

I am a c++ newbie but my guess is that I only need to put the correct inludes inside my CMakeLists.txt-file.

How do I run my program stand-alone but using ROS messages?

edit retag flag offensive close merge delete

Comments

2

Why would you want to do that? To compile your node you need tons of dependencies that catkin is managing. IMO it would be a nightmare otherwise.

Javier V. Gómez gravatar image Javier V. Gómez  ( 2016-01-27 07:24:46 -0600 )edit

You will need the correct includes and linking directives in the CMakeLists.txt. Which these are is precisely, what catkin figures out for you. It really just does a quite cmake-y find_package like any other cmake library. There is considerable less effort in setting up a catkin workspace.

dornhege gravatar image dornhege  ( 2016-01-27 07:42:39 -0600 )edit

Ok that's annoying but I'm going to take your advice! Thanks.

esillen gravatar image esillen  ( 2016-01-27 08:00:32 -0600 )edit

@esillen You will see that having a minimum structure in your folder allows to implement many other things much easier :)

Javier V. Gómez gravatar image Javier V. Gómez  ( 2016-01-27 11:36:46 -0600 )edit