Robotics StackExchange | Archived questions

Is it possible to run a ros2 node from a class method outside the package ?

I am wondering if it is possible to have a method call to a ros2 node from outside the ros package. The hierarchy looks as follows:

PROJECT/
        FUNCTIONS/ func1 func2 ...
        build/
        MY_ROS_PACKAGE/ package.xml cmakelist.txt rosnode.cpp build 
        Cmakelist.txt
        main.cpp

My idea is to init the rosnode.cpp inside main.cpp. Is it possible ? If so, any guidance please.

Asked by frieder on 2022-11-11 10:53:27 UTC

Comments

Answers

This package will be outside the ROS workspace, how do you want to use it?

Perhaps a script with a call to this package launch file in the ros2_ws (e.g. use the system() function from stdlib.h) would be enough?

Asked by ljaniec on 2022-11-14 05:20:58 UTC

Comments