Closed davelkan-zz closed 8 years ago
Thanks @davelkan. The Apriltags node will actually stop running detections if there are no subscribers, so another option is to simply unsubscribe from the topic when you are not scanning for fiducials.
It might be a little bit slower, if that matters for your use case, but doing it this way also unsubscribes the node from the upstream image topic, which can free up lot of network bandwidth by not transporting the camera images.
https://github.com/personalrobotics/apriltags/blob/master/src/apriltags.cpp#L244
That's a good point. I was actually considering looking into setting up apriltags with shared pointers to eliminate the need for subscription, but that's a little ways off.
After looking into this a little I've confirmed that disabling the subscription has a dramatic reduction in cpu usage vs intercepting a flag in the callback, so i'll be doing that. Thanks for the tip.
I do have the changes I made working locally, though i have decided not to use them as your suggestion is better. If you would like me to push upstream anyways let me know.
Glad to hear it's working for you!
This is may not technically be an issue, but it is negatively impacting my project and I'm fixing it. In case anyone else has a similar problem I want to share my solution.
I'm working on a robotics application with high CPU needs. I occasionally need to scan for fiducials, but having apriltags scan constantly for them consumes too much cpu and negatively impacts other aspects of robot functionality.
To address this I am adding a flag which will allow you to disable and enable apriltags by publishing a bool. I should have it running shortly and will make a pull request once done. It should not add any computational demand, nor should it have any impact on users not using the flag.