14 #include <QStringList> 27 mInternalStructure(internalStructure),
38 mCommunication->SetPortNumber(igstk::SerialCommunication::PortNumber0);
40 mCommunication->SetBaudRate(igstk::SerialCommunication::BaudRate115200);
41 mCommunication->SetDataBits(igstk::SerialCommunication::DataBits8);
42 mCommunication->SetStopBits(igstk::SerialCommunication::StopBits1);
43 mCommunication->SetHardwareHandshake(igstk::SerialCommunication::HandshakeOff);
45 bool logging =
settings()->
value(
"IGSTKDebugLogging",
true).toBool();
57 reportError(
"Tracker is of type TRACKER_NONE, this means it's not valid.");
65 report(
"Tracker is set to Polaris");
71 report(
"Polaris Classic is not supported");
79 report(
"Tracker is set to Aurora");
85 report(
"Tracker is set to Micron, not supported");
150 for (std::map<QString, IgstkToolPtr>::iterator it = tools.begin(); it != tools.end(); ++it)
154 if (tool && tool->getPointer())
158 "Tracker is attaching a tool that is not of the correct type. Trackers type: " 162 tool->getPointer()->RequestAttachToTracker(
mTracker);
164 if (tool->isReference())
165 mTracker->RequestSetReferenceTool(tool->getPointer());
177 for (std::map<QString, IgstkToolPtr>::iterator it = tools.begin(); it != tools.end(); ++it)
181 if (tool && tool->getPointer())
183 tool->getPointer()->RequestDetachFromTracker();
221 if (igstk::TrackerOpenEvent().CheckEvent(&event))
226 else if (igstk::TrackerCloseEvent().CheckEvent(&event))
231 else if (igstk::TrackerInitializeEvent().CheckEvent(&event))
236 reportWarning(
"This never happens for some reason... check code");
238 else if (igstk::TrackerStartTrackingEvent().CheckEvent(&event))
242 else if (igstk::TrackerStopTrackingEvent().CheckEvent(&event))
246 else if (igstk::TrackerUpdateStatusEvent().CheckEvent(&event))
250 else if (igstk::TrackerToolTransformUpdateEvent().CheckEvent(&event))
255 else if (igstk::CompletedEvent().CheckEvent(&event))
261 else if (igstk::CoordinateSystemSetTransformEvent().CheckEvent(&event))
266 else if (igstk::InvalidRequestErrorEvent().CheckEvent(&event))
268 reportWarning(
mUid +
" received an invalid request. This means that the internal igstk tracker did not accept the request. Do not know which request.");
271 else if (igstk::TrackerOpenErrorEvent().CheckEvent(&event))
276 else if (igstk::TrackerCloseErrorEvent().CheckEvent(&event))
281 else if (igstk::TrackerInitializeErrorEvent().CheckEvent(&event))
286 else if (igstk::TrackerStartTrackingErrorEvent().CheckEvent(&event))
291 else if (igstk::TrackerStopTrackingErrorEvent().CheckEvent(&event))
296 else if (igstk::TrackerUpdateStatusErrorEvent().CheckEvent(&event))
302 else if (igstk::InputOutputErrorEvent().CheckEvent(&event))
308 else if (igstk::InputOutputTimeoutEvent().CheckEvent(&event))
313 else if (igstk::OpenPortErrorEvent().CheckEvent(&event))
318 else if (igstk::ClosePortErrorEvent().CheckEvent(&event))
325 event.Print(std::cout);
331 bool logging =
settings()->
value(
"IGSTKDebugLogging",
true).toBool();
334 std::ofstream* loggerFile =
new std::ofstream();
354 report(
mUid +
" is " + (value ?
"open" :
"closed") +
".");
364 report(
mUid +
" is " + (value ?
"" :
"un") +
"initialized.");
374 report(
mUid +
" is " + (value ?
"" :
"not ") +
"tracking.");
380 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.