Running a cpp program outside ROS and publishing messages

asked 2018-11-21 06:52:11 -0500

MSK gravatar image

Hi, I am trying to case specific drone which uses image processing, the code I built works ideally when it is a standalone but becomes terribly slow when run within ROS core. I would like to know whether there is any method of running the CPP code outside ROS yet be able to publish messages.

PS: I need the publishing part to send commands and operate the drone

edit retag flag offensive close merge delete

Comments

Pedantic and not an answer, but:

but becomes terribly slow when run within ROS core

ROS nodes do not run inside ROS core. They are stand-alone programs, just like other Linux binaries.

gvdhoorn gravatar imagegvdhoorn ( 2018-11-21 13:50:58 -0500 )edit

But I have tested it in such a way, first as a standalone code and then with rosrun. I thought rosrun means it is running within the ros framework.

MSK gravatar imageMSK ( 2018-11-21 23:21:51 -0500 )edit

Technically, there is no way to "run <something> inside/within the ROS framework". That would imply that your entire control flow is taken over. That is not how typical ROS nodes work.

They are just programs that happen to use topics/services/actions for input-output.

gvdhoorn gravatar imagegvdhoorn ( 2018-11-22 00:09:37 -0500 )edit

I'm not doubting what you saw, but perhaps, to avoid an xy-problem, you can give us a little bit more information about your setup.

How does your non-ROS program work? Does it interface directly with your camera for instance? How is this done in your ROS-based one? Etc.

gvdhoorn gravatar imagegvdhoorn ( 2018-11-22 00:10:49 -0500 )edit