An implementation of smile detection using OpenCV, cv_bridge, ROS and Python is available in full at the bottom of this post.
I’ve been developing in ROS for awhile now, and I’ve settled into a pattern for creating nodes that I find works really well for me. It has three components:
- Create a single class that encapsulates the entirety of what the node is supposed to do
- All subscriber callbacks are restricted to saving the content of the message to a member variable to hold until ready to be processed
- Have a run function in the code that is the main ROS loop, and calls the update functions to process data
Functionally, it looks like this:
(I’m using FaceFinder as an example)