Ask Your Question
0

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

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

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
2

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

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: http://wiki.ros.org/nodelet Porting Nodes to Nodelets: http://wiki.ros.org/nodelet/Tutorials...

edit flag offensive delete link more

Comments

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 imageHaroldVD ( 2018-05-31 04:54:18 -0600 )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 imagegvdhoorn ( 2018-05-31 05:24:42 -0600 )edit
0

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

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

2 followers

Stats

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

Seen: 53 times

Last updated: May 30 '18