HexapodCsc#

class lsst.ts.mthexapod.HexapodCsc(index, config_dir=None, initial_state=State.STANDBY, override='', simulation_mode=0)#

Bases: BaseCsc

MTHexapod CSC.

Parameters:
  • index (SalIndex or int) – SAL index; see SalIndex for the allowed values.

  • config_dir (str or pathlib.Path or 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.State or int (optional)) – The initial state of the CSC. Must be lsst.ts.salobj.State.STANDBY unless simulating (simulation_mode != 0).

  • override (str, optional) – Configuration override file to apply if initial_state is State.DISABLED or State.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.STANDBY and not simulating (simulation_mode = 0).

Notes

Error Codes

See lsst.ts.xml.enums.MTHexapod.ErrorCode

Attributes Summary

compensation_mode

Return True if moves are compensated, False otherwise.

enable_lut_temperature

Enable the LUT temperature compensation or not.

host

Get the TCP/IP address of the low-level controller.

no_movement_idle_time

Time limit for no movement in seconds under the Enabled state.

port

Get the port of the low-level controller.

step_size_uv

Absolute maximum step size in the rx, ry rotation in deg.

step_size_w

Absolute maximum step size in the rz rotation in deg.

step_size_xy

Absolute maximum step size in the x, y direction in um.

step_size_z

Absolute maximum step size in the z direction in um.

valid_simulation_modes

version

Methods Summary

basic_run_command(command)

Acquire the write_lock and run the command.

compensation_loop()

Apply compensation at regular intervals.

compensation_wait()

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.

csc_level_fault()

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.

get_compensation_inputs()

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_camera_shutter_detailed_state(...)

Handle the camera shutter detailed state.

handle_summary_state()

Called when the summary state has changed.

idle_time_monitor([period, max_count])

Idle time monitor under the enabled state.

make_mock_controller()

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()

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:

bool

host#
no_movement_idle_time#

Time limit for no movement in seconds under the Enabled state.

Returns:

Time limit in seconds.

Return type:

float

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:

float

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:

float

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:

float

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:

float

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 by make_command.

Return type:

None

async compensation_loop()#

Apply compensation at regular intervals.

The algorithm is to repeat the following sequence: :rtype: None

  • Wait until it is time to apply compensation (see compensation_wait for 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:
Return type:

None

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:

None

async configure(config)#

Configure the CSC.

Parameters:

config (object) – The configuration, as described by the config schema, as a struct-like object.

Return type:

None

Notes

Called when running the start command, just before changing summary state from State.STANDBY to State.DISABLED.

csc_level_fault()#

Context manager to handle CSC level fault.

Return type:

AsyncIterator[None]

async do_configureAcceleration(data)#

Specify the acceleration limit.

Parameters:

data (BaseMsgType)

Return type:

None

async do_configureLimits(data)#

Specify position and rotation limits.

Parameters:

data (BaseMsgType)

Return type:

None

async do_configureVelocity(data)#

Specify velocity limits.

Parameters:

data (BaseMsgType)

Return type:

None

async do_move(data)#

Move to a specified position and orientation.

Parameters:

data (salobj.BaseMsgType) – Data of the SAL message.

Return type:

None

async do_moveInSteps(data)#

Move to a specified position and orientation in steps.

Parameters:

data (salobj.BaseMsgType) – Data of the SAL message.

Return type:

None

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:

None

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:

None

async do_setCompensationMode(data)#
Parameters:

data (BaseMsgType)

Return type:

None

async do_setPivot(data)#

Set the coordinates of the pivot point.

Parameters:

data (BaseMsgType)

Return type:

None

async do_stop(data)#

Halt tracking or any other motion.

Parameters:

data (BaseMsgType)

Return type:

None

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:

CompensationInputs or None

get_filter_offset(filter_name)#

Get the z offset for a given filter name.

Parameters:

filter_name (str) – Camera filter name.

Returns:

filter_offset – Filter offset.

Return type:

Position

async handle_camera_filter(filter_name)#

Move the hexapod in focusZ to account for the filter thickness.

Parameters:

filter_name (str) – Camera filter name.

Return type:

None

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:

None

async handle_summary_state()#

Called when the summary state has changed.

Override to perform tasks such as starting and stopping telemetry (example).

Return type:

None

Notes

The versions in BaseCsc and ConfigurableCsc do nothing, so if you subclass one of those you do not need to call await super().handle_summary_state().

async idle_time_monitor(period=1.0, max_count=10)#

Idle time monitor under the enabled state.

Parameters:
  • period (float, optional) – Polling period. (the default is 1.0)

  • max_count (int, optional) – Maximum count of the polling. When the count reachs the maximum, the idle time will be updated. This is to save the system resource to acquire/release the asynchronous lock. (the default is 10)

Return type:

None

make_mock_controller()#

Construct and return a mock controller.

Return type:

MockMTHexapodController

async monitor_camera_filter(camera)#

Monitor the camera filter and apply compensation as needed.

Parameters:

camera (str) – Camera name.

Return type:

None

async start()#

Finish constructing the CSC. :rtype: None

  • Call set_simulation_mode. If this fails, set self.start_task to the exception, call stop, making the CSC unusable, and return.

  • Call handle_summary_state

  • Set self.start_task done.

async stop_motion()#

Stop motion and wait for it to stop.

Return type:

None

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:

None

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:

None

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:

bool

Returns:

  • is_stopped (bool) – Is motion stopped? Always True unless max_nstatus is not None.

  • Raises – asyncio.CancelledError if not in enabled state.