Ask Your Question

Is there a (preferred) syntax for designing ROS applications?

asked 2018-05-29 11:55:14 -0500

HaroldVD gravatar image

Im writing a program for a robot that uses a camera to analyse its environment and determine its position using the data of the image.
I have the following sets of nodes for it;

Camera-node -(subscribed)-> imageAnalyse-node -(subscribed)-> locationDetermine-node

Is it fine if I merge the the imageAnalyse-node and locationDetermine-node to a single node since the output of the imageAnalyse will only be used for the locationDetermine-node, even thought that means it will be a single node with a lot of code in it compared to the other nodes??

It doesn't have any advantage splitting these notes and it makes the performance of my application worse (speed-wise)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2018-05-29 15:36:01 -0500

vinaykumarhs2020 gravatar image

It is up to you to decide how you want to split your code. If you think that you will have some other node depending on imageAnalysis-node, it might be a good idea to make it as an independent node.

Splitting nodes and transferring images between them comes with serialization/deserialization overheads. You should consider ROS nodelets to utilize zero copy transport between your algorithms.

ROS Nodelets: Porting Nodes to Nodelets:

edit flag offensive delete link more


I assume using nodelets doesn't provide any advantages over an implementation where I put all the code in a single node since it doesn't transfer the image then?

HaroldVD gravatar image HaroldVD  ( 2018-05-31 04:54:18 -0500 )edit

The advantage is on the design / software engineering side. If you don't care about that and are perfectly fine creating one big monolithic program, then there would be little difference, yes.

But then the question suggests itself: why are you using ROS?

gvdhoorn gravatar image gvdhoorn  ( 2018-05-31 05:24:42 -0500 )edit

answered 2018-05-30 04:07:40 -0500

NEngelhard gravatar image

I think it's perfectly fine to have both functions within the same node. You could (and should) however try to keep the implementation separated. One class each for ImageAnalysis and Localization can be used together in the node but with a well defined interface. This will be better for code quality and help you when you have to break up the node in the future.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-05-29 11:55:14 -0500

Seen: 79 times

Last updated: May 30 '18