@@ -176,9 +176,13 @@ def connect_to_serial(
176
176
#: list[str]: Default axes sequence of the Tiger Controller
177
177
self .default_axes_sequence = self .get_default_motor_axis_sequence ()
178
178
179
- def get_default_motor_axis_sequence (self ) -> None :
179
+ def get_default_motor_axis_sequence (self ) -> list [ str ] :
180
180
"""Get the default motor axis sequence from the ASI device
181
181
182
+ Only returns stage types XYMotor, ZMotor, Theta. Avoids problems associated
183
+ with other tiger controller cards, which could include piezos, filter wheels,
184
+ logic cards, etc.
185
+
182
186
Returns
183
187
-------
184
188
list[str]
@@ -187,15 +191,23 @@ def get_default_motor_axis_sequence(self) -> None:
187
191
self .send_command ("BU X" )
188
192
response = self .read_response ()
189
193
lines = response .split ("\r " )
194
+ motor_axes , axis_types = [], []
190
195
for line in lines :
191
196
if line .startswith ("Motor Axes:" ):
192
- default_axes_sequence = line [line .index (":" ) + 2 :].split (" " )[:- 2 ]
193
- self .report_to_console (
194
- "Get the default axes sequence from the ASI device " "successfully!"
195
- )
196
- break
197
+ motor_axes = line .split ("Motor Axes:" )[1 ].split ()
198
+ if line .startswith ("Axis Types:" ):
199
+ axis_types = line .split ("Axis Types:" )[1 ].split ()
197
200
198
- return default_axes_sequence
201
+ if len (motor_axes ) == 0 or len (axis_types ) == 0 :
202
+ raise TigerException (":N-5" )
203
+
204
+ if len (motor_axes ) != len (axis_types ):
205
+ raise TigerException (":N-5" )
206
+
207
+ for i in range (len (axis_types ) - 1 , - 1 , - 1 ):
208
+ if axis_types [i ] not in ["x" , "z" , "t" ]:
209
+ motor_axes .pop (i )
210
+ return motor_axes
199
211
200
212
##### TODO: Modify these to accept dictionaries and send a
201
213
# single command for all axes
@@ -326,12 +338,12 @@ def report_to_console(self, message: str) -> None:
326
338
if self .verbose :
327
339
print (message )
328
340
329
- def send_command (self , cmd : bytes ) -> None :
341
+ def send_command (self , cmd : str ) -> None :
330
342
"""Send a serial command to the device.
331
343
332
344
Parameters
333
345
----------
334
- cmd : bytes
346
+ cmd : str
335
347
Serial command to send to the device
336
348
"""
337
349
# always reset the buffers before a new command is sent
0 commit comments