Search code examples
roscatkin

Can a ROS node be created outside a catkin workspace?


I want to create a ROS publisher node outside a catkin workspace. Can it be created?


Solution

  • Of course you can. Treat ROS like any other cpp library or python package.

    In python you have to keep PYTHONPATH environment variable pointing to ros packages in /opt/ros/kinetic/lib/python2.7/dist-packages.

    In cpp you have to tell compiler where to look for includes (/opt/ros/kinetic/include), libraries (/opt/ros/kinetic/lib) and which library to import. For the simplest application -lroscpp -lrostime -lrosconsole should be sufficient. Ex:

    g++ node.cpp -o node -I/opt/ros/kinetic/include -L/opt/ros/kinetic/lib -lroscpp -lrostime -lrosconsole
    

    Remember that you still need ros environment variables like ROS_MASTER_URI.

    However, I don't know if there is an easy way to generate custom ros messages without using catkin_make and cmake files.