[IGSTK-Developers] checking the state of tracker and trackertools
Kevin A. Gary
kgary at asu.edu
Fri Jan 7 14:12:32 EST 2011
Hi Zein,
There is no way to examine the state of an IGSTK component directly for
safety reasons. We realize this may not be the answer you want to hear,
but understand that one of the ways that IGSTK ensures safety is by
encapsulating state and forcing clients of a component to make a request
to the public interface. Otherwise, you might write code like:
if (tracker->getState() == COMMUNICATION_ESTABLISHED_STATE) {
// then do something assuming you are fine
}
IGSTK seeks to avoid these kinds of if statements, because:
1) It increases the chances for human error
2) It creates a dependence directly to the component state machine,
making a tight coupling and therefore a maintenance issue.
3) It increases the complexity of unit testing.
4) It places the responsibility for knowing what you can do with a
component on the client and not in the component where it should be.
I note in your followup email that you also call transform.isValidNow()
which actually contradicts the pattern above (not sure when this method
was added, we may need to look at this).
The best resolution is to rely on the returned event of something like
Tracker::RequestOpen(), or if that does not suit your purpose, add a
method that makes a request through the public interface.
We know this can initially be an awkward programming model, but it is a
core concept in IGSTK. Our book has a complete description of this
technique, and we are happy to help guide you in this direction.
Hope this helps. Thanks for using IGSTK!
Kevin
On 1/7/11 8:33 AM, Zein Salah wrote:
> Hello,
> is there a way to check in which state is an igstk Tracker or
> TrackerTool? I need something like this to test if the connection to the
> ndi tracker and configuration of tracher tools habe been established
> successfully.
> thanks,
> Zein
>
>
>
> _______________________________________________
> IGSTK-Developers mailing list
> IGSTK-Developers at public.kitware.com
> http://public.kitware.com/cgi-bin/mailman/listinfo/igstk-developers
--
Kevin A. Gary
Associate Professor
Associate Chair for Computing
Department of Engineering
College of Technology & Innovation
Arizona State University
(480)727-1373
kgary at asu.edu
http://dcs.asu.edu/faculty/KevinGary
More information about the IGSTK-Developers
mailing list