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:
ConfigurableCscM2 commandable SAL component (CSC) class.
Parameters#
- host
strorNone, 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_command
intorNone, 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_telemetry
intorNone, 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_dir
str,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.Stateorint, optional The initial state of the CSC. (the default is salobj.State.STANDBY)
- simulation_mode
int, optional Simulation mode. The default is 0: do not simulate.
- verbose
bool, optional Print the debug message to standard output or not. (the default is False)
Attributes#
- log
logging.Logger A logger.
- controller_cell
lsst.ts.m2com.ControllerCell Controller to do the TCP/IP communication with the servers of M2 cell.
- config
types.SimpleNamespaceor None Namespace with configuration values.
- mtmount
lsst.ts.salobj.Remote Remote object of MTMount CSC.
- ilc_retry_times
int Retry times to transition the inner-loop controller (ILC) state.
- ilc_timeout
float Timeout in second for the transition of ILC state.
- system_is_ready
bool 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.
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.
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.
Reset the enabled faults mask to default.
do_resetForceOffsets(data)Resets user defined forces to zeros.
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.
Command to switch force balance system on and off.
end_start(data)End do_start; called after state changes but before command acknowledged.
Get the name of the configuration package, e.g. "ts_config_ocs".
Handle summary state changes.
The commandable SAL component (CSC) is the commander or not.
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#
- parser
argparse.ArgumentParser The argument parser.
Notes#
If you override this method then you should almost certainly override
add_kwargs_from_argsas well.- parser
- classmethod add_kwargs_from_args(args: Namespace, kwargs: Dict[str, Any]) None#
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.
Notes#
If you override this method then you should almost certainly override
add_argumentsas well.- args
- async begin_disable(data: BaseMsgType) None#
Begin do_disable; called before state changes.
Parameters#
- data
DataType Command data
- data
- async begin_enable(data: BaseMsgType) None#
Begin do_enable; called before state changes.
Parameters#
- data
DataType Command data
- data
- async begin_standby(data: BaseMsgType) None#
Begin do_standby; called before the state changes.
Parameters#
- data
DataType Command data
- data
- async begin_start(data: BaseMsgType) None#
Begin do_start; configure the CSC before changing state.
Parameters#
- data
cmd_start.DataType Command data
Notes#
The
overridefield 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.
- data
- async close_tasks() None#
Shut down pending tasks. Called by
close.
- async configure(config: SimpleNamespace) None#
Configure CSC.
Parameters#
- config
types.SimpleNamespace Namespace with configuration values.
- config
- 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#
- data
object Data of the SAL message.
- data
- async do_applyForces(data: BaseMsgType) None#
Apply force.
Parameters#
- data
object Data of the SAL message.
- data
- async do_bypassErrorCode(data: BaseMsgType) None#
Bypass the error code in control loop.
Notes#
This command might break the system.
Parameters#
- data
object Data of the SAL message.
Raises#
ValueErrorWhen the error code is unrecognized.
- data
- async do_clearErrors(data: BaseMsgType) None#
Emulate clearError command.
Parameters#
- data
object Data of the SAL message.
- data
- async do_enableLutTemperature(data: BaseMsgType) None#
Command to enable or disable the temperature look-up table (LUT) correction.
Parameters#
- data
object Data of the SAL message.
- data
- async do_enableOpenLoopMaxLimit(data: BaseMsgType) None#
Enable the maximum force limit in open-loop control.
Parameters#
- data
object Data of the SAL message.
- data
- async do_killActuatorBumpTest(data: BaseMsgType) None#
Kill the running actuator bump test in the closed-loop control.
Parameters#
- data
object Data of the SAL message.
- data
- async do_moveActuator(data: BaseMsgType) None#
Move the actuator in open-loop control.
Parameters#
- data
object Data of the SAL message.
Raises#
ValueErrorWhen both of the displacement and step are not zero.
- data
- async do_positionMirror(data: BaseMsgType) None#
Position Mirror.
Parameters#
- data
object Data of the SAL message.
- data
- async do_resetActuatorSteps(data: BaseMsgType) None#
Resets user defined actuator steps to zeros.
Parameters#
- data
object Data of the SAL message.
- data
- 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#
- data
object Data of the SAL message.
- data
- async do_resetForceOffsets(data: BaseMsgType) None#
Resets user defined forces to zeros.
Parameters#
- data
object Data of the SAL message.
- data
- async do_selectInclinationSource(data: BaseMsgType) None#
Command to select source of inclination data.
Parameters#
- data
object Data of the SAL message.
- data
- async do_setConfigurationFile(data: BaseMsgType) None#
Set the system configuration file.
Parameters#
- data
object Data of the SAL message.
Raises#
RuntimeErrorWhen the communication power is on.
RuntimeErrorWhen no available configuration files.
ValueErrorWhen the configuration file is not allowed.
- data
- async do_setHardpointList(data: BaseMsgType) None#
Set the hardpoint list.
Parameters#
- data
object Data of the SAL message.
- data
- async do_setTemperatureOffset(data: BaseMsgType) None#
Command to set temperature offset for the LUT temperature correction.
Parameters#
- data
object Data of the SAL message.
- data
- async do_switchForceBalanceSystem(data: BaseMsgType) None#
Command to switch force balance system on and off.
Parameters#
- data
object Data of the SAL message.
- data
- async end_start(data: BaseMsgType) None#
End do_start; called after state changes but before command acknowledged.
Parameters#
- data
DataType Command data
- 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.
- host