0
$\begingroup$

Rosanswers logo

Hi there

i have a basic question about program structure. I want to write a node that calls the laser_assembler service and publishes those scans witch have been taken during one tilt motion of my servo motor. To do so i thought of subscribing to the motor state msg the motor service publishes. How would you structure this node. Would you bind all the objects that are needed (service client, publisher ...) to the callback? Or would you write a class for this (witch would be basically my whole node). Or is it ok to have a couple of global variables?

thanks Alex


Originally posted by AlexKolb on ROS Answers with karma: 30 on 2014-10-06

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Any of those approaches will work.

As your program gets bigger and more complicated, having a class will probably be the most maintainable.


Originally posted by ahendrix with karma: 47576 on 2014-10-06

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$
0
$\begingroup$

Rosanswers logo

@ahendrix is absolutely right.

Object Oriented Programming should be the weapon of choice.

Always remember the side effect of global variables.


Originally posted by BennyRe with karma: 2949 on 2014-10-06

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.