14 #include <QStringList> 26 mInternalStructure(internalStructure),
37 mCommunication->SetPortNumber(igstk::SerialCommunication::PortNumber0);
39 mCommunication->SetBaudRate(igstk::SerialCommunication::BaudRate115200);
40 mCommunication->SetDataBits(igstk::SerialCommunication::DataBits8);
41 mCommunication->SetStopBits(igstk::SerialCommunication::StopBits1);
42 mCommunication->SetHardwareHandshake(igstk::SerialCommunication::HandshakeOff);
44 bool logging =
settings()->
value(
"IGSTKDebugLogging",
true).toBool();
56 reportError(
"Tracker is of type TRACKER_NONE, this means it's not valid.");
64 report(
"Tracker is set to Polaris");
70 report(
"Polaris Classic is not supported");
78 report(
"Tracker is set to Aurora");
84 report(
"Tracker is set to Micron, not supported");
149 for (std::map<QString, IgstkToolPtr>::iterator it = tools.begin(); it != tools.end(); ++it)
153 if (tool && tool->getPointer())
157 "Tracker is attaching a tool that is not of the correct type. Trackers type: " 161 tool->getPointer()->RequestAttachToTracker(
mTracker);
163 if (tool->isReference())
164 mTracker->RequestSetReferenceTool(tool->getPointer());
176 for (std::map<QString, IgstkToolPtr>::iterator it = tools.begin(); it != tools.end(); ++it)
180 if (tool && tool->getPointer())
182 tool->getPointer()->RequestDetachFromTracker();
220 if (igstk::TrackerOpenEvent().CheckEvent(&event))
225 else if (igstk::TrackerCloseEvent().CheckEvent(&event))
230 else if (igstk::TrackerInitializeEvent().CheckEvent(&event))
235 reportWarning(
"This never happens for some reason... check code");
237 else if (igstk::TrackerStartTrackingEvent().CheckEvent(&event))
241 else if (igstk::TrackerStopTrackingEvent().CheckEvent(&event))
245 else if (igstk::TrackerUpdateStatusEvent().CheckEvent(&event))
249 else if (igstk::TrackerToolTransformUpdateEvent().CheckEvent(&event))
254 else if (igstk::CompletedEvent().CheckEvent(&event))
260 else if (igstk::CoordinateSystemSetTransformEvent().CheckEvent(&event))
265 else if (igstk::InvalidRequestErrorEvent().CheckEvent(&event))
267 reportWarning(
mUid +
" received an invalid request. This means that the internal igstk tracker did not accept the request. Do not know which request.");
270 else if (igstk::TrackerOpenErrorEvent().CheckEvent(&event))
275 else if (igstk::TrackerCloseErrorEvent().CheckEvent(&event))
280 else if (igstk::TrackerInitializeErrorEvent().CheckEvent(&event))
285 else if (igstk::TrackerStartTrackingErrorEvent().CheckEvent(&event))
290 else if (igstk::TrackerStopTrackingErrorEvent().CheckEvent(&event))
295 else if (igstk::TrackerUpdateStatusErrorEvent().CheckEvent(&event))
301 else if (igstk::InputOutputErrorEvent().CheckEvent(&event))
307 else if (igstk::InputOutputTimeoutEvent().CheckEvent(&event))
312 else if (igstk::OpenPortErrorEvent().CheckEvent(&event))
317 else if (igstk::ClosePortErrorEvent().CheckEvent(&event))
324 event.Print(std::cout);
330 bool logging =
settings()->
value(
"IGSTKDebugLogging",
true).toBool();
333 std::ofstream* loggerFile =
new std::ofstream();
353 report(
mUid +
" is " + (value ?
"open" :
"closed") +
".");
363 report(
mUid +
" is " + (value ?
"" :
"un") +
"initialized.");
373 report(
mUid +
" is " + (value ?
"" :
"not ") +
"tracking.");
379 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.