HexapodCsc#
- class lsst.ts.mthexapod.HexapodCsc(index, config_dir=None, initial_state=State.STANDBY, override='', simulation_mode=0)#
Bases:
BaseCscMTHexapod CSC.
- Parameters:
index (
SalIndexorint) – SAL index; seeSalIndexfor the allowed values.config_dir (
strorpathlib.Pathor None, optional) – Directory of configuration files, or None for the standard configuration directory (obtained from_get_default_config_dir). This is provided for unit testing.initial_state (
lsst.ts.salobj.Stateorint(optional)) – The initial state of the CSC. Must belsst.ts.salobj.State.STANDBYunless simulating (simulation_mode != 0).override (
str, optional) – Configuration override file to apply ifinitial_stateisState.DISABLEDorState.ENABLED.simulation_mode (
int(optional)) –Simulation mode. Allowed values:
0: regular operation.
1: simulation: use a mock low level controller.
- Raises:
ValueError – If
initial_state != lsst.ts.salobj.State.STANDBYand not simulating (simulation_mode = 0).
Notes
Error Codes
See
lsst.ts.xml.enums.MTHexapod.ErrorCodeAttributes Summary
Return True if moves are compensated, False otherwise.
Enable the LUT temperature compensation or not.
Get the TCP/IP address of the low-level controller.
Time limit for no movement in seconds under the Enabled state.
Get the port of the low-level controller.
Absolute maximum step size in the rx, ry rotation in deg.
Absolute maximum step size in the rz rotation in deg.
Absolute maximum step size in the x, y direction in um.
Absolute maximum step size in the z direction in um.
Methods Summary
basic_run_command(command)Acquire the write_lock and run the command.
Apply compensation at regular intervals.
Wait until it is time to apply the next compensation update.
compute_compensation(uncompensated_pos)Check uncompensated and, if relevant, compensated position and return compensation information.
config_callback(client)Called when the low-level controller outputs configuration.
configure(config)Configure the CSC.
Context manager to handle CSC level fault.
do_configureAcceleration(data)Specify the acceleration limit.
do_configureLimits(data)Specify position and rotation limits.
do_configureVelocity(data)Specify velocity limits.
do_move(data)Move to a specified position and orientation.
do_moveInSteps(data)Move to a specified position and orientation in steps.
do_offset(data)Move by a specified offset in position and orientation.
do_offsetInSteps(data)Move by a specified offset in position and orientation in steps.
do_setCompensationMode(data)do_setPivot(data)Set the coordinates of the pivot point.
do_stop(data)Halt tracking or any other motion.
Return the current compensation inputs, or None if not available.
get_filter_offset(filter_name)Get the z offset for a given filter name.
handle_camera_filter(filter_name)Move the hexapod in focusZ to account for the filter thickness.
Handle the camera shutter detailed state.
Called when the summary state has changed.
idle_time_monitor([period, max_count])Idle time monitor under the enabled state.
Construct and return a mock controller.
monitor_camera_filter(camera)Monitor the camera filter and apply compensation as needed.
start()Finish constructing the CSC.
Stop motion and wait for it to stop.
telemetry_callback(client)Called when the low-level controller outputs telemetry.
wait_n_telemetry([n_telemetry])Wait for n_telemetry telemetry messages since the most recent low-level command.
wait_stopped([n_telemetry])Wait for the current motion, if any, to stop.
Attributes Documentation
- compensation_mode#
Return True if moves are compensated, False otherwise.
- enable_lut_temperature#
Enable the LUT temperature compensation or not.
- Returns:
True if the LUT temperature compensation is enabled, False otherwise.
- Return type:
- host#
- no_movement_idle_time#
Time limit for no movement in seconds under the Enabled state.
- Returns:
Time limit in seconds.
- Return type:
- port#
- step_size_uv#
Absolute maximum step size in the rx, ry rotation in deg. 0 means to do the movement in a single step.
- Returns:
Step size uv in deg.
- Return type:
- step_size_w#
Absolute maximum step size in the rz rotation in deg. 0 means to do the movement in a single step.
- Returns:
Step size w in deg.
- Return type:
- step_size_xy#
Absolute maximum step size in the x, y direction in um. 0 means to do the movement in a single step.
- Returns:
Step size xy in um.
- Return type:
- step_size_z#
Absolute maximum step size in the z direction in um. 0 means to do the movement in a single step.
- Returns:
Step size z in um.
- Return type:
- valid_simulation_modes: Sequence[int] = [0, 1]#
- version = '1.8.1'#
Methods Documentation
- async basic_run_command(command)#
Acquire the write_lock and run the command.
- Parameters:
command (
Command) – Command to run, as constructed bymake_command.- Return type:
- async compensation_loop()#
Apply compensation at regular intervals.
The algorithm is to repeat the following sequence: :rtype:
NoneWait until it is time to apply compensation (see
compensation_waitfor details).Compute the compensation offset and apply it if large enough.
If a compensation update fails then compensation is disabled.
- async compensation_wait()#
Wait until it is time to apply the next compensation update.
Wait for motion to stop, then wait for self.compensation_interval seconds (a configuration parameter). Warn and repeat if the axes are moving again (very unlikely).
- Raises:
asyncio.CancelledError – If the CSC is no longer enabled.
asyncio.TimeoutError – If waiting for motion to stop takes longer than
self.max_move_duration.
- Return type:
- compute_compensation(uncompensated_pos)#
Check uncompensated and, if relevant, compensated position and return compensation information.
- Parameters:
uncompensated_pos (
Position) – Target position (without compensation applied).- Returns:
compensation_info – Compensation information.
- Return type:
CompensationInfo- Raises:
salobj.ExpectedError – If uncompensated or compensated position is out of bounds.
- async config_callback(client)#
Called when the low-level controller outputs configuration.
- Parameters:
client (
lsst.ts.hexrotcomm.CommandTelemetryClient) – TCP/IP client.- Return type:
- async configure(config)#
Configure the CSC.
- Parameters:
config (
object) – The configuration, as described by the config schema, as a struct-like object.- Return type:
Notes
Called when running the
startcommand, just before changing summary state fromState.STANDBYtoState.DISABLED.
- csc_level_fault()#
Context manager to handle CSC level fault.
- Return type:
- async do_configureAcceleration(data)#
Specify the acceleration limit.
- Parameters:
data (
BaseMsgType)- Return type:
- async do_configureLimits(data)#
Specify position and rotation limits.
- Parameters:
data (
BaseMsgType)- Return type:
- async do_configureVelocity(data)#
Specify velocity limits.
- Parameters:
data (
BaseMsgType)- Return type:
- async do_move(data)#
Move to a specified position and orientation.
- Parameters:
data (
salobj.BaseMsgType) – Data of the SAL message.- Return type:
- async do_moveInSteps(data)#
Move to a specified position and orientation in steps.
- Parameters:
data (
salobj.BaseMsgType) – Data of the SAL message.- Return type:
- async do_offset(data)#
Move by a specified offset in position and orientation.
See note for self._move_hexapod() regarding checking the target position.
- Parameters:
data (
BaseMsgType)- Return type:
- async do_offsetInSteps(data)#
Move by a specified offset in position and orientation in steps.
See note for self._move_hexapod() regarding checking the target position.
- Parameters:
data (
BaseMsgType)- Return type:
- async do_setPivot(data)#
Set the coordinates of the pivot point.
- Parameters:
data (
BaseMsgType)- Return type:
- async do_stop(data)#
Halt tracking or any other motion.
- Parameters:
data (
BaseMsgType)- Return type:
- get_compensation_inputs()#
Return the current compensation inputs, or None if not available.
Log a warning if inputs are missing and the missing list does not match the previous warning.
- Returns:
compensation_inputs – The compensation inputs, if all inputs are available, else
None.- Return type:
- get_filter_offset(filter_name)#
Get the z offset for a given filter name.
- async handle_camera_filter(filter_name)#
Move the hexapod in focusZ to account for the filter thickness.
- async handle_camera_shutter_detailed_state(camera_shutter_detailed_state)#
Handle the camera shutter detailed state.
- Parameters:
camera_shutter_detailed_state (
BaseMsgType) – The camera shutterDetailedState event payload.- Return type:
- async handle_summary_state()#
Called when the summary state has changed.
Override to perform tasks such as starting and stopping telemetry (example).
- Return type:
Notes
The versions in
BaseCscandConfigurableCscdo nothing, so if you subclass one of those you do not need to callawait super().handle_summary_state().
- async idle_time_monitor(period=1.0, max_count=10)#
Idle time monitor under the enabled state.
- Parameters:
- Return type:
- make_mock_controller()#
Construct and return a mock controller.
- Return type:
- async monitor_camera_filter(camera)#
Monitor the camera filter and apply compensation as needed.
- async start()#
Finish constructing the CSC. :rtype:
NoneCall
set_simulation_mode. If this fails, setself.start_taskto the exception, callstop, making the CSC unusable, and return.Call
handle_summary_stateSet
self.start_taskdone.
- async stop_motion()#
Stop motion and wait for it to stop.
- Return type:
- Raises:
asyncio.CancelledError if not in enabled state.
- async telemetry_callback(client)#
Called when the low-level controller outputs telemetry.
- Parameters:
client (
lsst.ts.hexrotcomm.CommandTelemetryClient) – TCP/IP client.- Return type:
- async wait_n_telemetry(n_telemetry=4)#
Wait for n_telemetry telemetry messages since the most recent low-level command.
- Parameters:
n_telemetry (
int, optional) – Minimum number of telemetry messages since the most recent low-level command. Must be positive. A value of 3 is necessary to reliably allow stop or move to interrupt another move.- Raises:
asyncio.CancelledError – If the system goes out of enabled state.
- Return type:
- async wait_stopped(n_telemetry=4)#
Wait for the current motion, if any, to stop.
- Parameters:
n_telemetry (
int, optional) – Minimum number of telemetry messages since the most recent low-level command. Must be positive. A value of 3 is necessary to reliably allow stop or move to interrupt another move.- Return type:
- Returns:
is_stopped (
bool) – Is motion stopped? Always True unless max_nstatus is not None.Raises – asyncio.CancelledError if not in enabled state.