PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
vtkPlusChRoboticsTracker.h
Go to the documentation of this file.
1 /*=Plus=header=begin======================================================
2 Program: Plus
3 Copyright (c) Laboratory for Percutaneous Surgery. All rights reserved.
4 See License.txt for details.
5 =========================================================Plus=header=end*/
6 
7 #ifndef __vtkPlusChRoboticsTracker_h
8 #define __vtkPlusChRoboticsTracker_h
9 
10 #include "vtkPlusDataCollectionExport.h"
11 
12 #include "ChrDataItem.h"
13 #include "vtkPlusDevice.h"
14 
15 class SerialLine;
16 class ChrSerialPacket;
17 
26 class vtkPlusDataCollectionExport vtkPlusChRoboticsTracker : public vtkPlusDevice
27 {
28 public:
29 
30  static vtkPlusChRoboticsTracker *New();
32  void PrintSelf( ostream& os, vtkIndent indent );
33 
36 
39 
43  PlusStatus Probe();
44 
51 
53  virtual PlusStatus ReadConfiguration(vtkXMLDataElement* config);
54 
56  virtual PlusStatus WriteConfiguration(vtkXMLDataElement* config);
57 
58  virtual bool IsTracker() const { return true; }
59 
60  vtkSetMacro(SerialPort, unsigned long);
61  vtkSetMacro(BaudRate, unsigned long);
62  vtkSetMacro(FirmwareDirectory, std::string);
63 
64 protected:
65 
68 
74 
77 
82  PlusStatus FindFirmwareDefinition(const std::string& id, vtkXMLDataElement* foundDefinition);
83 
85  void GetFileNamesFromDirectory(std::vector<std::string> &fileNames, const std::string &dir);
86 
88  PlusStatus LoadFirmwareDescriptionForConnectedDevice();
89 
91  PlusStatus UpdateDataItemDescriptors();
92 
94  void UpdateDataItemValues(ChrSerialPacket& packet);
95 
97  PlusStatus FindDataItemDescriptor(const std::string itemName, ChrDataItem &foundItem);
98 
100  PlusStatus SendCommand( ChrSerialPacket& requestPacket, ChrSerialPacket& replyPacket );
101 
102  PlusStatus SendPacket( ChrSerialPacket& packet );
103  PlusStatus ReceivePacket( ChrSerialPacket& packet );
104 
105  PlusStatus ProcessPacket( ChrSerialPacket& packet );
106 
107 private: // Functions.
108 
110  void operator=( const vtkPlusChRoboticsTracker& );
111 
112 
113 private: // Variables.
114 
116  SerialLine* Serial;
117 
119  unsigned long SerialPort;
120 
122  unsigned long BaudRate;
123 
128  std::string FirmwareDirectory;
129 
130  vtkPlusDataSource* OrientationSensorTool;
131 
132  vtkXMLDataElement* FirmwareDefinition;
133  std::string FirmwareVersionId;
134 
136  ChrDataItem EulerRoll;
138  ChrDataItem EulerPitch;
140  ChrDataItem EulerYaw;
141 
142 };
143 
144 #endif
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
virtual PlusStatus InternalStopRecording()
Abstract interface for tracker and video devices.
Definition: vtkPlusDevice.h:60
virtual PlusStatus InternalConnect()
igsioStatus PlusStatus
Definition: PlusCommon.h:40
virtual PlusStatus Probe()
Class for reading and writing data through the serial (RS-232) port.
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *)
virtual PlusStatus WriteConfiguration(vtkXMLDataElement *)
Interface for the CH Robotics CHR-UM6 tracker.
virtual PlusStatus InternalStartRecording()
virtual PlusStatus InternalDisconnect()
virtual PlusStatus InternalUpdate()
static vtkPlusDevice * New()
Interface to a 3D positioning tool, video source, or generalized data stream.