katsu.motion module
Wrappers around Pyserial instances
- class katsu.motion.AgilisRotationStage(channel=1, axis=1, port='COM1', baudrate=921600, bytesize=8, data_bits=8, parity='N', stop_bits=1, timeout=1, termination_character='\r\n', encoding='utf-8')
Bases:
BaseRotationStage- Attributes:
angular_offsetProperty containing the angular offset from the horizontal, provided by user
angular_positionProperty containing the current angular position, radians
angular_step_sizeProperty containing the angular step size, provided by user
Methods
absolute_move(target_position)starts a process to move to an absolute position, this interrupts USB communication.
close()close the serial communication
Computes current angular position and writes to angular position attribute
Returns the status of the axis
Returns current target position when using absolute move
return current jog mode, see start_jog_motion
Returns the number of accumullated steps in the forward direction minus the number of steps in backward direction since powering the controller or since the last zero point.
get the error of the previous command,
Returns the current step amplitude, should be in the range -50 to 50
return current step delay
starts a process to measure current position.
move_to_limit(jog_mode)Moves to limit with a jog motion at the defined speed specified by an integer
relative_move(steps)Move relative to current position in steps whose amplitude are defined by the SU command (defaults to 16)
Resets the controller, all temporary settings are reset to default and controller is in local mode
sets to local mode, where only status queries are allowed
sets to local mode, where status queries and motion control are allowed
set_step_amplitude(amplitude)Sets step amplitude in positive and negative direction.
set_step_delay(delay)Sets the step delay of the stepping mode, applies for both positive and negative directions.
start_jog_motion(jog_mode)Starts a jog motion at the defined speed specified by an integer
Stops the motion on the defined axis, sets state to be ready
Returns the limits switch status of the controller, the returns are the following
resets the step counter to zero
- absolute_move(target_position)
starts a process to move to an absolute position, this interrupts USB communication. After the position is found USB coms are opened again.
Notes
The absolute position is found by moving from the current position to the motion limit, twice As such, this takes some time and is not reccomended for quick use.
- Parameters:
target_position (int) – target position in 1/1000th of total travel
- property angular_offset
Property containing the angular offset from the horizontal, provided by user
- Returns:
angular offset, radians
- Return type:
float
- property angular_position
Property containing the current angular position, radians
- Returns:
Current angular position of rotation stage, radians
- Return type:
float
- property angular_step_size
Property containing the angular step size, provided by user
- Returns:
angular step size, radians
- Return type:
float
- compute_angular_position()
Computes current angular position and writes to angular position attribute
- get_axis_status()
Returns the status of the axis
FIXME: This stalls indefinitely when not moving
Axis Status 0 : Ready (Not moving) 1 : Stepping (Currently executing a PR command) 2 : Jogging (Currently executing a JA command) 3 : Moving to limit (Currently executing a MV, MA, or PA command)
- Returns:
string containing the current axis status
- Return type:
string
- get_current_target_position()
Returns current target position when using absolute move
- Returns:
string containing the current target position
- Return type:
string
- get_jog_mode()
return current jog mode, see start_jog_motion
- Returns:
string containing the current jog mode
- Return type:
string
- get_number_of_steps()
Returns the number of accumullated steps in the forward direction minus the number of steps in backward direction since powering the controller or since the last zero point.
- Returns:
string containing the number of accumulated steps
- Return type:
string
- get_previous_command_error()
get the error of the previous command,
FIXME: This stalls indefinitely if there’s no error
Notes
0 : No Error -1 : Unknown command -2 : Axis out of range -3 : Wrong format for parameter nn -4 : Parameter nn out of range -5 : Not allowed in local mode -6 : Note allowed in current state
- Returns:
string containing the error code
- Return type:
string
- get_step_amplitude()
Returns the current step amplitude, should be in the range -50 to 50
- get_step_delay()
return current step delay
FIXME: This stalls indefinitely, can’t figure out source. It might be that it’s waiting for 8 bytes and not returning 8 bytes?
- Returns:
string containing the current step delay
- Return type:
string
- measure_current_position()
starts a process to measure current position. Interrupts USB communication during the process. This can last up to 2 minutes
- Returns:
string containing the current position
- Return type:
string
- move_to_limit(jog_mode)
Moves to limit with a jog motion at the defined speed specified by an integer
Notes
the sign of the jog mode defines forward (+) or backward (-) motion jog_mode = -4 or 4, 666 steps/s at defined step amplitude jog_mode = -3 or 3, 1700 steps/s at defined step amplitude jog_mode = -2 or 2, 100 steps/s at defined step amplitude jog_mode = -1 or 1, 5 steps/s at defined step amplitude jog_mode = 0, No move, go to READY state
- Parameters:
jog_mode (int) – jog mode to begin motion
- relative_move(steps)
Move relative to current position in steps whose amplitude are defined by the SU command (defaults to 16)
- Parameters:
steps (int) – number of steps to move
- reset_controller()
Resets the controller, all temporary settings are reset to default and controller is in local mode
- set_mode_local()
sets to local mode, where only status queries are allowed
- set_mode_remote()
sets to local mode, where status queries and motion control are allowed
- set_step_amplitude(amplitude)
Sets step amplitude in positive and negative direction.
Notes
Only positive integers are permitted, so amplitude is automatically converted to its nearest integer magnitude. Too small a step size may result in nonlinear motion, or no motion at all. Furthermore there is no gurantee of a linear correlation between the step amplitude and effective motion size, so it must be calibrated before experimentation.
- Parameters:
amplitude (int) – amplitude of steps taken
- set_step_delay(delay)
Sets the step delay of the stepping mode, applies for both positive and negative directions. Delay is programmed as multiples of 10 microseconds. Max value is equal to 2 second delay
- Parameters:
delay (int) – delay in units of 10 microseconds
- start_jog_motion(jog_mode)
Starts a jog motion at the defined speed specified by an integer
Notes
the sign of the jog mode defines forward (+) or backward (-) motion jog_mode = -4 or 4, 666 steps/s at defined step amplitude jog_mode = -3 or 3, 1700 steps/s at defined step amplitude jog_mode = -2 or 2, 100 steps/s at defined step amplitude jog_mode = -1 or 1, 5 steps/s at defined step amplitude jog_mode = 0, No move, go to READY state
- Parameters:
jog_mode (int) – jog mode to begin motion
- stop_motion()
Stops the motion on the defined axis, sets state to be ready
- tell_limit_status()
Returns the limits switch status of the controller, the returns are the following
PH0 : No limit switch active PH1 : Limit switch of channel #1 is active, #2 is not PH2 : Limit switch of channel #2 is active, #1 is not PH3 : Limit switch of channel #1 and #2 are
- zero_position()
resets the step counter to zero