Commit 5c432f0f6ecb84b8abad82cf8a6b0f856368261e
Committed by
Thiago Franco de Moraes
1 parent
05b7be51
Exists in
master
and in
10 other branches
Fix trackers connection (#76)
* Fix polhemus tracker connection -adjust trigger baudrate * Fix ISOTRAK connection * Fix FASTRAK * remove unnecessary print
Showing
3 changed files
with
7 additions
and
12 deletions
Show diff stats
invesalius/data/coordinates.py
... | ... | @@ -192,12 +192,8 @@ def PolhemusSerialCoord(trck_init, trck_id, ref_mode): |
192 | 192 | try: |
193 | 193 | plh1 = [float(s) for s in data[1:len(data)]] |
194 | 194 | j = 1 |
195 | - except ValueError: | |
196 | - trck_init.write("P") | |
197 | - data = trck_init.readline() | |
198 | - data = data.replace('-', ' -') | |
199 | - data = [s for s in data.split()] | |
200 | - print "Trying to fix the error!!" | |
195 | + except: | |
196 | + print "error!!" | |
201 | 197 | |
202 | 198 | coord = data[0:6] |
203 | 199 | return coord | ... | ... |
invesalius/data/trackers.py
... | ... | @@ -132,11 +132,10 @@ def PlhWrapperConnection(): |
132 | 132 | |
133 | 133 | |
134 | 134 | def PlhSerialConnection(tracker_id): |
135 | - trck_init = None | |
136 | 135 | try: |
137 | 136 | import serial |
138 | 137 | |
139 | - trck_init = serial.Serial(0, baudrate=115200, timeout=0.2) | |
138 | + trck_init = serial.Serial('COM1', baudrate=115200, timeout=0.2) | |
140 | 139 | |
141 | 140 | if tracker_id == 2: |
142 | 141 | # Polhemus FASTRAK needs configurations first |
... | ... | @@ -145,6 +144,7 @@ def PlhSerialConnection(tracker_id): |
145 | 144 | elif tracker_id == 3: |
146 | 145 | # Polhemus ISOTRAK needs to set tracking point from |
147 | 146 | # center to tip. |
147 | + trck_init.write("F") | |
148 | 148 | trck_init.write("Y") |
149 | 149 | |
150 | 150 | trck_init.write('P') |
... | ... | @@ -154,6 +154,7 @@ def PlhSerialConnection(tracker_id): |
154 | 154 | trck_init = None |
155 | 155 | |
156 | 156 | except: |
157 | + trck_init = None | |
157 | 158 | print 'Could not connect to Polhemus serial.' |
158 | 159 | |
159 | 160 | return trck_init |
... | ... | @@ -183,9 +184,7 @@ def PlhUSBConnection(tracker_id): |
183 | 184 | if not data: |
184 | 185 | trck_init = None |
185 | 186 | |
186 | - except uc.USBError as err: | |
187 | - print 'Could not set configuration %s' % err | |
188 | - else: | |
187 | + except: | |
189 | 188 | print 'Could not connect to Polhemus USB.' |
190 | 189 | |
191 | 190 | return trck_init | ... | ... |
invesalius/data/trigger.py
... | ... | @@ -35,7 +35,7 @@ class Trigger(threading.Thread): |
35 | 35 | try: |
36 | 36 | import serial |
37 | 37 | |
38 | - self.trigger_init = serial.Serial('COM1', baudrate=115200, timeout=0) | |
38 | + self.trigger_init = serial.Serial('COM1', baudrate=9600, timeout=0) | |
39 | 39 | self.nav_id = nav_id |
40 | 40 | self._pause_ = False |
41 | 41 | self.start() | ... | ... |