Subcriber able to switch between multiple callback function
I have a class which contains a 2 callback function, and based on a boolean it determines which one to use.. The problem is that the state of the boolean get sets in the constructor, and main kept spinning it. so the boolean gets reset..
How overcome this problem, they the callback function both retrieve images and based on the boolean perform different vision actions.
Asked by 215 on 2015-03-19 14:43:20 UTC
Answers
The easiest way to do what you want is having a single subscriber callback and taking the decision which processing step to perform based on the boolean from within the callback.
Like so:
imageCallback(ImageConstPtr img)
{
//Check the bool
if (use_default_image_processing){
defaultProcess(img);
}else{
someOtherProcessingStep(img)
}
}
Asked by Stefan Kohlbrecher on 2015-03-20 02:42:56 UTC
Comments
Where should i initialize it, and how / where should i change it?
Asked by 215 on 2015-03-20 03:02:55 UTC
Comments