M2#

class lsst.ts.m2.M2(host: str | None = None, port_command: int | None = None, port_telemetry: int | None = None, config_dir: str | Path | None = None, initial_state: State = State.STANDBY, simulation_mode: int = 0, verbose: bool = False)#

Bases: ConfigurableCsc

M2 commandable SAL component (CSC) class.

Parameters#

hoststr or None, optional

IP address of the TCP/IP interface. (the default is None and the value in ts_config_mttcs configuration files will be applied.)

port_commandint or None, optional

Command port number of the TCP/IP interface. (the default is None and the value in ts_config_mttcs configuration files will be applied.)

port_telemetryint or None, optional

Telemetry port number of the TCP/IP interface. (the default is None and the value in ts_config_mttcs configuration files will be applied.)

config_dirstr, 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_statelsst.ts.salobj.State or int, optional

The initial state of the CSC. (the default is salobj.State.STANDBY)

simulation_modeint, optional

Simulation mode. The default is 0: do not simulate.

verbosebool, optional

Print the debug message to standard output or not. (the default is False)

Attributes#

loglogging.Logger

A logger.

controller_celllsst.ts.m2com.ControllerCell

Controller to do the TCP/IP communication with the servers of M2 cell.

configtypes.SimpleNamespace or None

Namespace with configuration values.

mtmountlsst.ts.salobj.Remote

Remote object of MTMount CSC.

ilc_retry_timesint

Retry times to transition the inner-loop controller (ILC) state.

ilc_timeoutfloat

Timeout in second for the transition of ILC state.

system_is_readybool

System is ready or not.

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.

begin_disable(data)

Begin do_disable; called before state changes.

begin_enable(data)

Begin do_enable; called before state changes.

begin_standby(data)

Begin do_standby; called before the state changes.

begin_start(data)

Begin do_start; configure the CSC before changing state.

close_tasks()

Shut down pending tasks.

configure(config)

Configure CSC.

do_actuatorBumpTest(data)

Exercise the actuator bump test in the closed-loop control, which is performed at +/push and -/pull directions.

do_applyForces(data)

Apply force.

do_bypassErrorCode(data)

Bypass the error code in control loop.

do_clearErrors(data)

Emulate clearError command.

do_enableLutTemperature(data)

Command to enable or disable the temperature look-up table (LUT) correction.

do_enableOpenLoopMaxLimit(data)

Enable the maximum force limit in open-loop control.

do_killActuatorBumpTest(data)

Kill the running actuator bump test in the closed-loop control.

do_moveActuator(data)

Move the actuator in open-loop control.

do_positionMirror(data)

Position Mirror.

do_resetActuatorSteps(data)

Resets user defined actuator steps to zeros.

do_resetEnabledFaultsMask(data)

Reset the enabled faults mask to default.

do_resetForceOffsets(data)

Resets user defined forces to zeros.

do_selectInclinationSource(data)

Command to select source of inclination data.

do_setConfigurationFile(data)

Set the system configuration file.

do_setHardpointList(data)

Set the hardpoint list.

do_setTemperatureOffset(data)

Command to set temperature offset for the LUT temperature correction.

do_switchForceBalanceSystem(data)

Command to switch force balance system on and off.

end_start(data)

End do_start; called after state changes but before command acknowledged.

get_config_pkg()

Get the name of the configuration package, e.g. "ts_config_ocs".

handle_summary_state()

Handle summary state changes.

is_csc_commander()

The commandable SAL component (CSC) is the commander or not.

set_mount_elevation_callback(data)

Callback function to set the mount elevation.

Attributes Documentation

COMMAND_TIMEOUT = 10#
COMMAND_TIMEOUT_LONG = 60#
COMMAND_TIMEOUT_LONG_ENABLE = 400#
SLEEP_TIME_MEDIUM = 5.0#
SLEEP_TIME_SHORT = 3.0#
valid_simulation_modes: Sequence[int] = (0, 1)#
version = '0.13.20'#

Methods Documentation

classmethod add_arguments(parser: ArgumentParser) None#

Add arguments to the parser created by make_from_cmd_line.

Parameters#

parserargparse.ArgumentParser

The argument parser.

Notes#

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

classmethod add_kwargs_from_args(args: Namespace, kwargs: Dict[str, Any]) None#

Add constructor keyword arguments based on parsed arguments.

Parameters#

argsargparse.Namespace

Parsed command.

kwargsdict

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

Notes#

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

async begin_disable(data: BaseMsgType) None#

Begin do_disable; called before state changes.

Parameters#

dataDataType

Command data

async begin_enable(data: BaseMsgType) None#

Begin do_enable; called before state changes.

Parameters#

dataDataType

Command data

async begin_standby(data: BaseMsgType) None#

Begin do_standby; called before the state changes.

Parameters#

dataDataType

Command data

async begin_start(data: BaseMsgType) None#

Begin do_start; configure the CSC before changing state.

Parameters#

datacmd_start.DataType

Command data

Notes#

The override field must be one of:

  • The name of a config label or config file

  • The name and version of a config file, formatted as <file_name>:<version>, where the version is a git reference, such as a git tag or commit hash. This form does not support labels.

async close_tasks() None#

Shut down pending tasks. Called by close.

async configure(config: SimpleNamespace) None#

Configure CSC.

Parameters#

configtypes.SimpleNamespace

Namespace with configuration values.

async do_actuatorBumpTest(data: BaseMsgType) None#

Exercise the actuator bump test in the closed-loop control, which is performed at +/push and -/pull directions.

Parameters#

dataobject

Data of the SAL message.

async do_applyForces(data: BaseMsgType) None#

Apply force.

Parameters#

dataobject

Data of the SAL message.

async do_bypassErrorCode(data: BaseMsgType) None#

Bypass the error code in control loop.

Notes#

This command might break the system.

Parameters#

dataobject

Data of the SAL message.

Raises#

ValueError

When the error code is unrecognized.

async do_clearErrors(data: BaseMsgType) None#

Emulate clearError command.

Parameters#

dataobject

Data of the SAL message.

async do_enableLutTemperature(data: BaseMsgType) None#

Command to enable or disable the temperature look-up table (LUT) correction.

Parameters#

dataobject

Data of the SAL message.

async do_enableOpenLoopMaxLimit(data: BaseMsgType) None#

Enable the maximum force limit in open-loop control.

Parameters#

dataobject

Data of the SAL message.

async do_killActuatorBumpTest(data: BaseMsgType) None#

Kill the running actuator bump test in the closed-loop control.

Parameters#

dataobject

Data of the SAL message.

async do_moveActuator(data: BaseMsgType) None#

Move the actuator in open-loop control.

Parameters#

dataobject

Data of the SAL message.

Raises#

ValueError

When both of the displacement and step are not zero.

async do_positionMirror(data: BaseMsgType) None#

Position Mirror.

Parameters#

dataobject

Data of the SAL message.

async do_resetActuatorSteps(data: BaseMsgType) None#

Resets user defined actuator steps to zeros.

Parameters#

dataobject

Data of the SAL message.

async do_resetEnabledFaultsMask(data: BaseMsgType) None#

Reset the enabled faults mask to default. This will remove all the bypassed error codes in control loop.

Parameters#

dataobject

Data of the SAL message.

async do_resetForceOffsets(data: BaseMsgType) None#

Resets user defined forces to zeros.

Parameters#

dataobject

Data of the SAL message.

async do_selectInclinationSource(data: BaseMsgType) None#

Command to select source of inclination data.

Parameters#

dataobject

Data of the SAL message.

async do_setConfigurationFile(data: BaseMsgType) None#

Set the system configuration file.

Parameters#

dataobject

Data of the SAL message.

Raises#

RuntimeError

When the communication power is on.

RuntimeError

When no available configuration files.

ValueError

When the configuration file is not allowed.

async do_setHardpointList(data: BaseMsgType) None#

Set the hardpoint list.

Parameters#

dataobject

Data of the SAL message.

async do_setTemperatureOffset(data: BaseMsgType) None#

Command to set temperature offset for the LUT temperature correction.

Parameters#

dataobject

Data of the SAL message.

async do_switchForceBalanceSystem(data: BaseMsgType) None#

Command to switch force balance system on and off.

Parameters#

dataobject

Data of the SAL message.

async end_start(data: BaseMsgType) None#

End do_start; called after state changes but before command acknowledged.

Parameters#

dataDataType

Command data

static get_config_pkg() str#

Get the name of the configuration package, e.g. “ts_config_ocs”.

async handle_summary_state() None#

Handle summary state changes.

is_csc_commander() bool#

The commandable SAL component (CSC) is the commander or not.

Returns#

bool

True if the CSC is the commander. Otherwise, False.

async set_mount_elevation_callback(data: BaseMsgType) None#

Callback function to set the mount elevation.

Parameters#

dataobject

Data of the SAL message.