35 #include <QStringList>
55 mInternalStructure(internalStructure),
66 mCommunication->SetPortNumber(igstk::SerialCommunication::PortNumber0);
68 mCommunication->SetBaudRate(igstk::SerialCommunication::BaudRate115200);
69 mCommunication->SetDataBits(igstk::SerialCommunication::DataBits8);
70 mCommunication->SetStopBits(igstk::SerialCommunication::StopBits1);
71 mCommunication->SetHardwareHandshake(igstk::SerialCommunication::HandshakeOff);
73 bool logging =
settings()->
value(
"IGSTKDebugLogging",
true).toBool();
85 reportError(
"Tracker is of type TRACKER_NONE, this means it's not valid.");
93 report(
"Tracker is set to Polaris");
99 report(
"Polaris Classic is not supported");
107 report(
"Tracker is set to Aurora");
113 report(
"Tracker is set to Micron, not supported");
178 for (std::map<QString, IgstkToolPtr>::iterator it = tools.begin(); it != tools.end(); ++it)
182 if (tool && tool->getPointer())
186 "Tracker is attaching a tool that is not of the correct type. Trackers type: "
190 tool->getPointer()->RequestAttachToTracker(
mTracker);
192 if (tool->isReference())
193 mTracker->RequestSetReferenceTool(tool->getPointer());
205 for (std::map<QString, IgstkToolPtr>::iterator it = tools.begin(); it != tools.end(); ++it)
209 if (tool && tool->getPointer())
211 tool->getPointer()->RequestDetachFromTracker();
249 if (igstk::TrackerOpenEvent().CheckEvent(&event))
254 else if (igstk::TrackerCloseEvent().CheckEvent(&event))
259 else if (igstk::TrackerInitializeEvent().CheckEvent(&event))
264 reportWarning(
"This never happens for some reason... check code");
266 else if (igstk::TrackerStartTrackingEvent().CheckEvent(&event))
270 else if (igstk::TrackerStopTrackingEvent().CheckEvent(&event))
274 else if (igstk::TrackerUpdateStatusEvent().CheckEvent(&event))
278 else if (igstk::TrackerToolTransformUpdateEvent().CheckEvent(&event))
283 else if (igstk::CompletedEvent().CheckEvent(&event))
289 else if (igstk::CoordinateSystemSetTransformEvent().CheckEvent(&event))
294 else if (igstk::InvalidRequestErrorEvent().CheckEvent(&event))
296 reportWarning(
mUid +
" received an invalid request. This means that the internal igstk tracker did not accept the request. Do not know which request.");
299 else if (igstk::TrackerOpenErrorEvent().CheckEvent(&event))
304 else if (igstk::TrackerCloseErrorEvent().CheckEvent(&event))
309 else if (igstk::TrackerInitializeErrorEvent().CheckEvent(&event))
314 else if (igstk::TrackerStartTrackingErrorEvent().CheckEvent(&event))
319 else if (igstk::TrackerStopTrackingErrorEvent().CheckEvent(&event))
324 else if (igstk::TrackerUpdateStatusErrorEvent().CheckEvent(&event))
330 else if (igstk::InputOutputErrorEvent().CheckEvent(&event))
336 else if (igstk::InputOutputTimeoutEvent().CheckEvent(&event))
341 else if (igstk::OpenPortErrorEvent().CheckEvent(&event))
346 else if (igstk::ClosePortErrorEvent().CheckEvent(&event))
353 event.Print(std::cout);
359 bool logging =
settings()->
value(
"IGSTKDebugLogging",
true).toBool();
362 std::ofstream* loggerFile =
new std::ofstream();
382 report(
mUid +
" is " + (value ?
"open" :
"closed") +
".");
392 report(
mUid +
" is " + (value ?
"" :
"un") +
"initialized.");
402 report(
mUid +
" is " + (value ?
"" :
"not ") +
"tracking.");
408 reportWarning(
mUid +
" experienced a unrecoverable error, reconfiguration is required.");
QString qstring_cast(const T &val)
void internalError(bool value)
tsPOLARIS_CLASSIC
NDIs Polaris Classic tracker.
bool mTracking
whether or not the tracker is tracking
void reportError(QString msg)
InternalStructure mInternalStructure
the trackers type
igstk::SerialCommunicationForPosix CommunicationType
tsPOLARIS
NDIs Polaris tracker.
PolarisTrackerType::Pointer mTempPolarisTracker
pointer to a temp polaris tracker
bool mValid
whether this tracker is constructed correctly or not
boost::shared_ptr< IgstkTool > IgstkToolPtr
ObserverType::Pointer mTrackerObserver
observer listening for igstk events
bool isInitialized() const
void detachTools(std::map< QString, IgstkToolPtr > tools)
detach the list of tools from the tracker hw
cstring_cast_Placeholder cstring_cast(const T &val)
void trackerTransformCallback(const itk::EventObject &eventVar)
callback receiving events from the observer
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
void startTracking()
start tracking
void open()
open the tracker for communication
bool mOpen
whether or not the tracker is open
QString mLoggingFolderName
path to where log should be saved
TrackerType * mTracker
pointer to the base class of the internal igstk tracker
QString mUid
the trackers unique id
void internalTracking(bool value)
igstk::Tracker TrackerType
itk::ReceptorMemberCommand< IgstkTracker > ObserverType
void reportWarning(QString msg)
void shutdown()
shuts down the tracker, made to be used when an unrecoverable error occures
CommunicationType::Pointer mCommunication
pointer to the serial communication used to communicate with the NDI trackers
igstk::Logger::Pointer mTrackerLogger
logging the internal igstk behavior
bool isValid() const
whether this tracker is constructed correctly or not
TRACKING_SYSTEM getType() const
returns the trackers type
Settings * settings()
Shortcut for accessing the settings instance.
bool mInitialized
whether or not the tracker is initialized
TrackerType * getPointer() const
return a pointer to the internal tracker base
void internalOpen(bool value)
QString getUid() const
get the tracker unique id
static QStringList getSupportedTrackingSystems()
QString getName() const
get the trackers name
tsAURORA
NDIs Aurora tracker.
void internalInitialized(bool value)
void attachTools(std::map< QString, IgstkToolPtr > tools)
attach a list of tools to the tracker hw
TRACKING_SYSTEM mType
the trackers type
void addLogging()
adds logging to the internal igstk components
AuroraTrackerType::Pointer mTempAuroraTracker
pointer to a temp aurora tracker
itk::StdStreamLogOutput::Pointer mTrackerLogOutput
output to write the log to
QString mName
the trackers name
tsMICRON
Claron Technologys Micron tracker.
void stopTracking()
stop tracking
QString enum2string(const ENUM &val)