35 #include <QStringList> 48 mInternalStructure(internalStructure),
59 mCommunication->SetPortNumber(igstk::SerialCommunication::PortNumber0);
61 mCommunication->SetBaudRate(igstk::SerialCommunication::BaudRate115200);
62 mCommunication->SetDataBits(igstk::SerialCommunication::DataBits8);
63 mCommunication->SetStopBits(igstk::SerialCommunication::StopBits1);
64 mCommunication->SetHardwareHandshake(igstk::SerialCommunication::HandshakeOff);
66 bool logging =
settings()->
value(
"IGSTKDebugLogging",
true).toBool();
78 reportError(
"Tracker is of type TRACKER_NONE, this means it's not valid.");
86 report(
"Tracker is set to Polaris");
92 report(
"Polaris Classic is not supported");
100 report(
"Tracker is set to Aurora");
106 report(
"Tracker is set to Micron, not supported");
171 for (std::map<QString, IgstkToolPtr>::iterator it = tools.begin(); it != tools.end(); ++it)
175 if (tool && tool->getPointer())
179 "Tracker is attaching a tool that is not of the correct type. Trackers type: " 183 tool->getPointer()->RequestAttachToTracker(
mTracker);
185 if (tool->isReference())
186 mTracker->RequestSetReferenceTool(tool->getPointer());
198 for (std::map<QString, IgstkToolPtr>::iterator it = tools.begin(); it != tools.end(); ++it)
202 if (tool && tool->getPointer())
204 tool->getPointer()->RequestDetachFromTracker();
242 if (igstk::TrackerOpenEvent().CheckEvent(&event))
247 else if (igstk::TrackerCloseEvent().CheckEvent(&event))
252 else if (igstk::TrackerInitializeEvent().CheckEvent(&event))
257 reportWarning(
"This never happens for some reason... check code");
259 else if (igstk::TrackerStartTrackingEvent().CheckEvent(&event))
263 else if (igstk::TrackerStopTrackingEvent().CheckEvent(&event))
267 else if (igstk::TrackerUpdateStatusEvent().CheckEvent(&event))
271 else if (igstk::TrackerToolTransformUpdateEvent().CheckEvent(&event))
276 else if (igstk::CompletedEvent().CheckEvent(&event))
282 else if (igstk::CoordinateSystemSetTransformEvent().CheckEvent(&event))
287 else if (igstk::InvalidRequestErrorEvent().CheckEvent(&event))
289 reportWarning(
mUid +
" received an invalid request. This means that the internal igstk tracker did not accept the request. Do not know which request.");
292 else if (igstk::TrackerOpenErrorEvent().CheckEvent(&event))
297 else if (igstk::TrackerCloseErrorEvent().CheckEvent(&event))
302 else if (igstk::TrackerInitializeErrorEvent().CheckEvent(&event))
307 else if (igstk::TrackerStartTrackingErrorEvent().CheckEvent(&event))
312 else if (igstk::TrackerStopTrackingErrorEvent().CheckEvent(&event))
317 else if (igstk::TrackerUpdateStatusErrorEvent().CheckEvent(&event))
323 else if (igstk::InputOutputErrorEvent().CheckEvent(&event))
329 else if (igstk::InputOutputTimeoutEvent().CheckEvent(&event))
334 else if (igstk::OpenPortErrorEvent().CheckEvent(&event))
339 else if (igstk::ClosePortErrorEvent().CheckEvent(&event))
346 event.Print(std::cout);
352 bool logging =
settings()->
value(
"IGSTKDebugLogging",
true).toBool();
355 std::ofstream* loggerFile =
new std::ofstream();
375 report(
mUid +
" is " + (value ?
"open" :
"closed") +
".");
385 report(
mUid +
" is " + (value ?
"" :
"un") +
"initialized.");
395 report(
mUid +
" is " + (value ?
"" :
"not ") +
"tracking.");
401 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)
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
ObserverType::Pointer mTrackerObserver
observer listening for igstk events
bool isInitialized() const
boost::shared_ptr< class IgstkTool > IgstkToolPtr
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
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
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
void addLogging()
adds logging to the internal igstk components
AuroraTrackerType::Pointer mTempAuroraTracker
pointer to a temp aurora tracker
ToolFileParser::TrackerInternalStructure mInternalStructure
the trackers type
itk::StdStreamLogOutput::Pointer mTrackerLogOutput
output to write the log to
QString mName
the trackers name
tsMICRON
Claron Technologys Micron tracker.
void stopTracking()
stop tracking
Namespace for all CustusX production code.