RotatorCsc#
- class lsst.ts.mtrotator.RotatorCsc(config_dir=None, initial_state=State.STANDBY, override='', simulation_mode=0, bypass_ccw=False)#
Bases:
BaseCscMTRotator 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.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.
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.STANDBYand not simulating (simulation_mode = 0).
Notes
Error Codes
See
lsst.ts.xml.enums.MTRotator.ErrorCodeAttributes 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 the camera cable wrap is following.
Assert the motion is not locked.
Check the camera cable wrap following error.
Shut down pending tasks.
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 the vibration.
do_configureAcceleration(data)Specify the acceleration limit.
Configure the emergency acceleration limit.
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.DISABLEDtoState.ENABLED.do_fault(data)do_lockMotion(data)Lock the rotator motion.
do_move(data)Go to the position specified by the most recent
positionSetcommand.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.
Camera cable wrap (CCW) is following or not.
Controller is enabled or not.
Construct and return a mock controller.
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:
Notes
If you override this method then you should almost certainly override
add_kwargs_from_argsas 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 onargs. The index argument will already be present if relevant.
- Return type:
Notes
If you override this method then you should almost certainly override
add_argumentsas 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:
- assert_is_not_locked()#
Assert the motion is not locked.
- Raises:
AssertionError – When the motion is locked.
- Return type:
- 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:
- async config_callback(client)#
Called when the TCP/IP 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.
- async connect_callback(client)#
Called when the client socket connects or disconnects.
- Parameters:
client (
CommandTelemetryClient) – TCP/IP client.- Return type:
- async do_configureAcceleration(data)#
Specify the acceleration limit.
- Parameters:
data (
BaseMsgType)- Return type:
- 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:
- 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:
- 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:
- async do_configureVelocity(data)#
Specify the velocity limit.
- Parameters:
data (
BaseMsgType)- Return type:
- async do_enable(data)#
Transition from
State.DISABLEDtoState.ENABLED.- Parameters:
data (
cmd_enable.DataType) – Command data- Return type:
- 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:
- async do_move(data)#
Go to the position specified by the most recent
positionSetcommand.- Parameters:
data (
BaseMsgType)- Return type:
- async do_stop(data)#
Halt tracking or any other motion.
- Parameters:
data (
BaseMsgType)- Return type:
- async do_track(data)#
Specify a position, velocity, TAI time tracking update.
- Parameters:
data (
BaseMsgType)- Return type:
- async do_trackStart(data)#
Start tracking.
Once this is run you must issue
trackcommands at 10-20Hz until you are done tracking, then issue thestopcommand.- Parameters:
data (
BaseMsgType)- Return type:
- async do_unlockMotion(data)#
Unlock the rotator motion.
- Parameters:
data (
salobj.BaseMsgType) – Data of the SAL message.- Return type:
- 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:
- is_controller_enabled()#
Controller is enabled or not.
- Returns:
True if the controller is enabled. False otherwise.
- Return type:
- make_mock_controller()#
Construct and return a mock controller.
- Return type:
- async set_mtmount_camera_cable_wrap_following_callback(data)#
Callback function to set the camera cable wrap (CCW) following status.
- 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 telemetry_callback(client)#
Called when the TCP/IP controller outputs telemetry.
- Parameters:
client (
lsst.ts.hexrotcomm.CommandTelemetryClient) – TCP/IP client.- Return type: