RotatorCsc#

class lsst.ts.mtrotator.RotatorCsc(config_dir=None, initial_state=State.STANDBY, override='', simulation_mode=0, bypass_ccw=False)#

Bases: BaseCsc

MTRotator CSC.

Parameters:
  • config_dir (str, 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.

  • bypass_ccw (bool, optional) – Bypass the check of camera cable wrapper (CCW) or not. (the default is False)

Raises:

ValueError – If initial_state != lsst.ts.salobj.State.STANDBY and not simulating (simulation_mode = 0).

Notes

Error Codes

See lsst.ts.xml.enums.MTRotator.ErrorCode

Attributes Summary

Methods Summary

add_arguments(parser)

Add arguments to the parser created by make_from_cmd_line.

add_kwargs_from_args(args, kwargs)

Add constructor keyword arguments based on parsed arguments.

assert_camera_cable_wrap_is_following()

Assert the camera cable wrap is following.

assert_is_not_locked()

Assert the motion is not locked.

check_ccw_following_error()

Check the camera cable wrap following error.

close_tasks()

Shut down pending tasks.

command_llv_fault()

Command the low-level controller to go to fault state.

config_callback(client)

Called when the TCP/IP controller outputs configuration.

configure(config)

Configure the CSC.

connect_callback(client)

Called when the client socket connects or disconnects.

detect_vibration()

Detect the vibration.

do_configureAcceleration(data)

Specify the acceleration limit.

do_configureEmergencyAcceleration(data)

Configure the emergency acceleration limit.

do_configureEmergencyJerk(data)

Configure the emergency jerk limit.

do_configureJerk(data)

Configure the jerk limit.

do_configureVelocity(data)

Specify the velocity limit.

do_enable(data)

Transition from State.DISABLED to State.ENABLED.

do_fault(data)

do_lockMotion(data)

Lock the rotator motion.

do_move(data)

Go to the position specified by the most recent positionSet command.

do_stop(data)

Halt tracking or any other motion.

do_track(data)

Specify a position, velocity, TAI time tracking update.

do_trackStart(data)

Start tracking.

do_unlockMotion(data)

Unlock the rotator motion.

is_camera_cable_wrap_following()

Camera cable wrap (CCW) is following or not.

is_controller_enabled()

Controller is enabled or not.

make_mock_controller()

Construct and return a mock controller.

set_mtmount_camera_cable_wrap_following_callback(data)

Callback function to set the camera cable wrap (CCW) following status.

start()

Finish constructing the CSC.

telemetry_callback(client)

Called when the TCP/IP controller outputs telemetry.

Attributes Documentation

COMMAND_TIMEOUT = 10#
valid_simulation_modes: Sequence[int] = [0, 1]#
version = '1.3.2'#

Methods Documentation

classmethod add_arguments(parser)#

Add arguments to the parser created by make_from_cmd_line.

Parameters:

parser (argparse.ArgumentParser) – The argument parser.

Return type:

None

Notes

If you override this method then you should almost certainly override add_kwargs_from_args as well.

classmethod add_kwargs_from_args(args, kwargs)#

Add constructor keyword arguments based on parsed arguments.

Parameters:
  • args (argparse.Namespace) – Parsed command.

  • kwargs (dict) – Keyword argument dict for the constructor. Update this based on args. The index argument will already be present if relevant.

Return type:

None

Notes

If you override this method then you should almost certainly override add_arguments as well.

assert_camera_cable_wrap_is_following()#

Assert the camera cable wrap is following.

Raises:

AssertionError – When the camera cable wrap is not following.

Return type:

None

assert_is_not_locked()#

Assert the motion is not locked.

Raises:

AssertionError – When the motion is locked.

Return type:

None

async check_ccw_following_error()#

Check the camera cable wrap following error.

Publish the value, if the camera cable wrap angle can be read. If ENABLED and the value is too large, then go to FAULT state.

Note: this is designed to be called by telemetry_callback. Thus it is called every time telemetry is read from the low-level controller.

Return type:

None

async close_tasks()#

Shut down pending tasks. Called by close.

Return type:

None

async command_llv_fault()#

Command the low-level controller to go to fault state.

Return type:

None

async config_callback(client)#

Called when the TCP/IP 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.

async connect_callback(client)#

Called when the client socket connects or disconnects.

Parameters:

client (CommandTelemetryClient) – TCP/IP client.

Return type:

None

async detect_vibration()#

Detect the vibration.

Return type:

None

async do_configureAcceleration(data)#

Specify the acceleration limit.

Parameters:

data (BaseMsgType)

Return type:

None

async do_configureEmergencyAcceleration(data)#

Configure the emergency acceleration limit.

Parameters:

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

Raises:

salobj.ExpectedError – When the value is 0 or negative.

Return type:

None

async do_configureEmergencyJerk(data)#

Configure the emergency jerk limit.

Parameters:

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

Raises:

salobj.ExpectedError – When the value is 0 or negative.

Return type:

None

async do_configureJerk(data)#

Configure the jerk limit.

Parameters:

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

Raises:

salobj.ExpectedError – When the value is 0 or negative.

Return type:

None

async do_configureVelocity(data)#

Specify the velocity limit.

Parameters:

data (BaseMsgType)

Return type:

None

async do_enable(data)#

Transition from State.DISABLED to State.ENABLED.

Parameters:

data (cmd_enable.DataType) – Command data

Return type:

None

async do_fault(data)#
Parameters:

data (BaseMsgType)

Return type:

None

async do_lockMotion(data)#

Lock the rotator motion.

Parameters:

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

Raises:

salobj.ExpectedError – When the motion is failed to stop.

Return type:

None

async do_move(data)#

Go to the position specified by the most recent positionSet command.

Parameters:

data (BaseMsgType)

Return type:

None

async do_stop(data)#

Halt tracking or any other motion.

Parameters:

data (BaseMsgType)

Return type:

None

async do_track(data)#

Specify a position, velocity, TAI time tracking update.

Parameters:

data (BaseMsgType)

Return type:

None

async do_trackStart(data)#

Start tracking.

Once this is run you must issue track commands at 10-20Hz until you are done tracking, then issue the stop command.

Parameters:

data (BaseMsgType)

Return type:

None

async do_unlockMotion(data)#

Unlock the rotator motion.

Parameters:

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

Return type:

None

is_camera_cable_wrap_following()#

Camera cable wrap (CCW) is following or not. If the check of CCW is bypassed, then always return True.

Returns:

True if CCW is following. False otherwise.

Return type:

bool

is_controller_enabled()#

Controller is enabled or not.

Returns:

True if the controller is enabled. False otherwise.

Return type:

bool

make_mock_controller()#

Construct and return a mock controller.

Return type:

MockMTRotatorController

async set_mtmount_camera_cable_wrap_following_callback(data)#

Callback function to set the camera cable wrap (CCW) following status.

Parameters:

data (object) – Data of the SAL message.

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 telemetry_callback(client)#

Called when the TCP/IP controller outputs telemetry.

Parameters:

client (lsst.ts.hexrotcomm.CommandTelemetryClient) – TCP/IP client.

Return type:

None