Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement nodes as classes #5

Open
wpmccormick opened this issue Mar 7, 2019 · 0 comments
Open

Implement nodes as classes #5

wpmccormick opened this issue Mar 7, 2019 · 0 comments

Comments

@wpmccormick
Copy link
Contributor

That's how the nodes in the ROS-I training material are designed, so I think it's a best-practice pattern (example template).

In summary:

  • Make the publishers, subscribers, service clients, service servers, etc. class member variables for a new ServoNode class.
  • Have the constructor take the node handle as an argument. Do parameter loading and servo TCP/UDP socket setup in the class constructor
  • Put the contents of the while loop into a callback that gets triggered by a timer.
  • Have a very minimal main function that just creates a new instance of ServoNode and then spins.

Originally posted by @schornakj in #4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant