API¶
RobotClientMX¶
-
class
aspyrobotmx.
RobotClientMX
(update_addr='tcp://localhost:2000', request_addr='tcp://localhost:2001')¶ RobotClientMX
subclassesaspyrobot.RobotClient
to add attributes and methods specific to the MX application. These include operation methods to calibrate, probe and mount samples.-
current_task
¶ str – Current task being executed on the robot
-
task_message
¶ str – Messages about current foreground task
-
task_progress
¶ str – Current task progress
-
status
¶ int – Status flag of the robot: bitwise or of codes.RobotStatus
-
model
¶ str – Model of the robot
-
time
¶ str – Time on robot controller (can be used as a heartbeat monitor)
-
at_home
¶ int – Whether the robot is in the home position
-
motors_on
¶ int – Whether the robot motors are on
-
motors_on_command
¶ int – Value of motors on instruction
-
toolset
¶ codes.Toolset – Current toolset the robot is in
-
foreground_done
¶ int – Whether the foreground is available
-
safety_gate
¶ int – Is the safety gate open
-
closest_point
¶ int – Closest labelled point to the robot’s coordinates
-
lid_open
¶ int – Dewar lid open status
-
lid_closed
¶ int – Dewar lid closed status
-
lid_command
¶ int – Value of lid open command
-
gripper_open
¶ int – Gripper open status
-
gripper_closed
¶ int – Gripper closed status
-
gripper_command
¶ int – Value of close gripper command
-
heater_hot
¶ int – Is the robot heater hot
-
heater_command
¶ int – Value of heater on/off request
-
heater_air_command
¶ int – Value of heater air on/off request
-
ln2_level
¶ int – Is the LN2 high flag set
-
pins_mounted
¶ int – Number of pins mounted
-
pins_lost
¶ int – Number of pins lost
-
dumbbell_state
¶ codes.DumbbellState – Status of the dumbbell
-
last_toolset_calibration
¶ str – Timestamp of last toolset calibration
-
last_left_calibration
¶ str – Timestamp of last left position calibration
-
last_middle_calibration
¶ str – Timestamp of last middle position calibration
-
last_right_calibration
¶ str – Timestamp of last right position calibration
-
last_goniometer_calibration
¶ str – Timestamp of last goni calibration
-
holder_types
¶ dict –
- keys (str): ‘left’, ‘middle’, ‘right’
- values (codes.HolderType): Type of sample holder in position
-
height_errors
¶ dict –
- keys (str): ‘left’, ‘middle’, ‘right’
- values (float): height error of cassette
-
puck_states
¶ dict –
- keys (str): ‘left’, ‘middle’, ‘right’
- values (dict): Dict of puck names (eg ‘A’) to codes.PuckStates
-
port_states
¶ dict –
- keys (str): ‘left’, ‘middle’, ‘right’
- values (list): 96 element list of codes.PortState values
-
port_distance
¶ dict –
- keys (str): ‘left’, ‘middle’, ‘right’
- values (list): 96 element list of float values
-
sample_locations
¶ dict –
- keys (str): ‘cavity’, ‘picker‘, ‘placer’, ‘goniometer’
- values (list): [position, port_index] of sample at location
-
mount_message
¶ str – Mount progress message
-
calibrate
(target, task_args, callback=None)¶ Calibrate the robot points.
Parameters: - target – ‘toolset’, ‘cassette’ or ‘goniometer’
- task_args – Arguments for the calibration function
- callback – Callback function to receive operation state updates
-
clear
(level, callback=None)¶ Clear the robot state.
Parameters: - level (str) – ‘status’ or ‘all’
- callback – Callback function to receive operation updates
-
dismount
(position, column, port, callback=None)¶ Dismount a sample to the specified port.
Parameters: - position – ‘left’, ‘middle’, ‘right’
- column – ‘A’, ‘B’, ..., ‘L’
- port – 1-16
- callback – Callback function to receive operation state updates
-
inspected
(callback=None)¶ Set the robot state as inspected by staff.
Parameters: callback – Callback function to receive operation state updates
-
mount
(position, column, port, callback=None)¶ Mount a sample.
Parameters: - position – ‘left’, ‘middle’, ‘right’
- column – ‘A’, ‘B’, ..., ‘L’
- port – 1-16
- callback – Callback function to receive operation state updates
-
prepare_for_mount
(callback=None)¶ Move the robot to the cooling point.
Parameters: callback – Callback function to receive operation state updates
-
probe
(ports, callback=None)¶ Probe the sample holder ports.
Parameters: - ports – Dictionary with keys: ‘left’, ‘middle’, ‘right’ and values that are 98 element lists of 1s and 0s
- callback – Callback function to receive operation state updates
-
reset_holders
(positions, callback=None)¶ Clear the holder type and port information for the given dewar positions.
Parameters: - positions – list of dewar positions: ‘left’, ‘middle’, ‘right’
- callback – Callback function to receive operation state updates
-
reset_ports
(ports, callback=None)¶ Clear the probe data for specific ports.
Parameters: - ports – dictionary with keys: ‘left’, ‘middle’, ‘right’ and values the ports to reset in each position
- callback – Callback function to receive operation state updates
-
run_operation
(operation, callback=None, **parameters)¶ Run an operation on the
RobotServer
.Parameters: - operation (str) – Name of the
RobotServer
method to run. - **parameters – keyword arguments to be passed to the operation method.
- callback – Callback function to receive updates about the operation.
Should handle arguments:
handle
,stage
,message
,error
Raises: ValueError
– Invalid operation name or parameters.- operation (str) – Name of the
-
run_query
(query_name, **parameters)¶ Fetch data from the
RobotServer
.Executes a query method on the robot server and returns the data.
Parameters: - query_name (str) – Name of the
RobotServer
method to run. - **parameters – keyword arguments to be passed to the query method.
Raises: RobotError
– Error happened on the server.- query_name (str) – Name of the
-
set_gripper
(value, callback=None)¶ Set gripper close state.
Parameters: - value – 0 or 1
- callback – Callback function to receive operation state updates
-
set_heater
(value, callback=None)¶ Set heater on or off.
Parameters: - value (int) – 1 for on, 0 for off
- callback – Callback function to receive operation state updates
-
set_heater_air
(value, callback=None)¶ Set heater air on or off.
Parameters: - value (int) – 1 for on, 0 for off
- callback – Callback function to receive operation state updates
-
set_lid
(value, callback=None)¶ Set lid open state.
Parameters: - value – 0 or 1
- callback – Callback function to receive operation state updates
-
set_port_state
(position, column, port, state, callback=None)¶ Set the state of port to be unknown, error etc.
Parameters: - position – ‘left’, ‘middle’, ‘right’
- column – ‘A’, ‘B’, ..., ‘L’
- port – 1-16
- state (codes.PortState) – port state integer
- callback – Callback function to receive operation state updates
-
set_sample_state
(position, column, port, state, callback=None)¶ Set which pin is currently mounted on the goniometer.
Parameters: - position – ‘left’, ‘middle’, ‘right’
- column – ‘A’, ‘B’, ..., ‘L’
- port – 1-16
- state (codes.SampleState) – sample state integer
- callback – Callback function to receive operation state updates
-
RobotServerMX¶
-
class
aspyrobotmx.
RobotServerMX
(robot, **kwargs)¶ A subclass of
aspyrobot.RobotServer
with extra functionality for the sample mounting robots at the MX beamlines of the Australian Synchrotron. Adds operations for calibrating, probing and mounting samples.Parameters: - robot (RobotMX) – An instance of RobotMX to enable communication with the robot EPICS IOC.
- **kwargs – Extra keyword parameters to be passed to RobotServer.
-
clear
(handle, level)¶ Clear robot state.
Parameters: level (str) – ‘status‘ or ‘all’
-
operation_update
(handle, message='', stage='update', error=None)¶ Add an operation update to the queue to be sent clients.
Parameters: - handle (int) – Operation handle.
- message (str) – Message to be sent to clients.
- stage (str) – ‘start’, ‘update’ or ‘end’
- error (str) – Error message.
-
shutdown
()¶ Request the server shuts down.
Causes the publisher and request threads to exit gracefully.
-
values_update
(update)¶ Add an robot attribute value update to the queue to be sent clients.
Parameters: update (dict) – robot attributes and their values. For example: {‘safety_gate’: 1, ‘motors_on’: 0}
RobotMX¶
-
class
aspyrobotmx.
RobotMX
(prefix)¶ RobotMX
subclassesaspyrobot.Robot
to add additionalPV
s for hardware I/O such as the robot gripper, dewar lid and heater.-
run_task
(name, args='', timeout=0.5)¶ Execute a foreground task on the robot.
Checks to see that the robot controller foreground thread is free and then executes a task. Blocks until the task is complete.
Parameters: - name (str) – Robot controller task to run
- args (str) – arguments to supply to the controller
- timeout (float) – Seconds to wait for the task to being
-
Codes¶
-
class
aspyrobotmx.codes.
CassettePosition
¶
-
class
aspyrobotmx.codes.
DumbbellState
¶
-
class
aspyrobotmx.codes.
HolderType
¶
-
class
aspyrobotmx.codes.
PortState
¶
-
class
aspyrobotmx.codes.
ProbeSpeed
¶
-
class
aspyrobotmx.codes.
PuckState
¶
-
class
aspyrobotmx.codes.
RobotStatus
¶
-
class
aspyrobotmx.codes.
SampleState
¶
-
class
aspyrobotmx.codes.
Toolset
¶