ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

program structure callback

asked 2014-10-06 21:36:55 -0600

AlexKolb gravatar image

updated 2014-10-06 21:39:01 -0600

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

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2014-10-06 23:17:05 -0600

ahendrix gravatar image

Any of those approaches will work.

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

edit flag offensive delete link more
1

answered 2014-10-06 23:39:28 -0600

BennyRe gravatar image

@ahendrix is absolutely right.

Object Oriented Programming should be the weapon of choice.

Always remember the side effect of global variables.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-10-06 21:36:55 -0600

Seen: 464 times

Last updated: Oct 06 '14