AtTcpipCsc#
- class lsst.ts.attcpip.AtTcpipCsc(name, index, config_schema, config_dir=None, check_if_duplicate=False, initial_state=State.STANDBY, override='', simulation_mode=0)#
Bases:
ConfigurableCscBase Configurable CSC with common code.
The base Configurable CSC is intended to be used by systems that connect to the AuxTel LabVIEW servers via TCP/IP, like ATMCS and ATPneumatics.
- Parameters:
name (
str) – Name of SAL component.index (
intorNone) – SAL component index, or 0 or None if the component is not indexed.check_if_duplicate (
bool, optional) – Check for heartbeat events from the same SAL name and index at startup (before starting the heartbeat loop)? Defaults to False in order to speed up unit tests, butamainsets it true.initial_state (
State,intorNone, optional) – Initial state for this CSC. If None use the class attributedefault_initial_state. Typically,State.STANDBY(orState.OFFLINEfor an externally commandable CSC) but can also beState.DISABLED, orState.ENABLED, in which case you may also want to specifyoverridefor a configurable CSC.override (
str, optional) – Configuration override file to apply ifinitial_stateisState.DISABLEDorState.ENABLED. Ignored if the CSC is not configurable.simulation_mode (
int, optional) – Simulation mode. The default is 0: do not simulate.allow_missing_callbacks (
bool, optional) – Allow missingdo_<name>callback methods? Missing method will be replaced with one that raises salobj.ExpectedError. This is intended for mock controllers, which may only support a subset of commands.
Attributes Summary
Methods Summary
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.
call_set_write(data)Call await
set_writefor an event or telemetry.Shut down pending tasks.
Execute the command and event loop.
configure(config)Configure the CSC.
end_disable(data)End do_disable; called after state changes but before command acknowledged.
end_enable(data)End do_enable; called after state changes but before command acknowledged.
end_standby(data)End do_standby; called after state changes but before command acknowledged.
end_start(data)End do_start; called after state changes but before command acknowledged.
fault(code, report[, traceback])Enter the fault state and output the
errorCodeevent.Get the name of the configuration package, e.g. "ts_config_ocs".
Utility method to perform the common part of any state transition.
Start the clients for the TCP/IPconnections as well as background tasks.
Stop all clients and background tasks.
Execute the telemetry loop.
wait_cmd_done(command)Write a command and wait for it to be reported as Done or Fail by AT.
wait_fail_reason_event(sequence_id)Wait for the fail reason event to arrive.
wait_fututre_done_or_fault(future)Wait for either the future to be done or for the CSC to go to FAULT, whichever comes first.
write_command(command, **params)Write the command JSON string to the TCP/IP command/event server.
Attributes Documentation
- connected#
- valid_simulation_modes: Sequence[int] = [0, 1]#
Methods Documentation
- async begin_disable(data)#
Begin do_disable; called before state changes.
- Parameters:
data (
salobj.BaseMsgType) – Command data- Return type:
- async begin_enable(data)#
Begin do_enable; called before state changes.
- Parameters:
data (
salobj.BaseMsgType) – Command data- Return type:
- async begin_standby(data)#
Begin do_standby; called before the state changes.
- Parameters:
data (
salobj.BaseMsgType) – Command data- Return type:
- async call_set_write(data)#
Call await
set_writefor an event or telemetry.datacontains both the event or telemetry name and the attribute values. The method will first extract the name and the values and then write.- Parameters:
data (
dict`[`str,Any]) – Data.- Return type:
- async close_tasks()#
Shut down pending tasks. Called by
close.Perform all cleanup other than disabling logging to SAL and closing the dds domain.
- Return type:
- async cmd_evt_loop()#
Execute the command and event loop.
This loop waits for incoming command and event messages and processes them when they arrive.
- 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 end_disable(data)#
End do_disable; called after state changes but before command acknowledged.
- Parameters:
data (
salobj.BaseMsgType) – Command data- Return type:
- async end_enable(data)#
End do_enable; called after state changes but before command acknowledged.
- Parameters:
data (
salobj.BaseMsgType) – Command data- Return type:
- async end_standby(data)#
End do_standby; called after state changes but before command acknowledged.
- Parameters:
data (
salobj.BaseMsgType) – Command data- Return type:
- async end_start(data)#
End do_start; called after state changes but before command acknowledged.
- Parameters:
data (
salobj.BaseMsgType) – Command data- Return type:
- async fault(code, report, traceback='')#
Enter the fault state and output the
errorCodeevent.- Parameters:
code (
int) – Error code for theerrorCodeevent. IfNonethenerrorCodeis not output, and you should output it yourself. SpecifyingNoneis deprecated; please always specify an integer error code.report (
str) – Description of the error.traceback (
str, optional) – Description of the traceback, if any.
- Return type:
- static get_config_pkg()#
Get the name of the configuration package, e.g. “ts_config_ocs”.
- Return type:
- async perform_common_part_of_state_transition(command, expected_states)#
Utility method to perform the common part of any state transition.
State-specific code is executed in the specific
being_xxxandend_xxxmethods.- Parameters:
command (
CommonCommand) – The command to be executed.expected_states (
list`[`sal_enums.State]) – List of states AT is expected to be in.
- Return type:
- async start_clients()#
Start the clients for the TCP/IPconnections as well as background tasks.
If simulator_mode == 1 then the simulator gets initialized and started as well.
- Return type:
- async stop_clients()#
Stop all clients and background tasks.
If simulator_mode == 1 then the simulator gets stopped as well.
- Return type:
- async telemetry_loop()#
Execute the telemetry loop.
This loop waits for incoming telemetry messages and processes them when they arrive.
- Return type:
- async wait_cmd_done(command)#
Write a command and wait for it to be reported as Done or Fail by AT.
- Parameters:
command (
CommonCommand) – The command to wait for.- Return type:
- async wait_fail_reason_event(sequence_id)#
Wait for the fail reason event to arrive.
If the fail reason event doesn’t arrive after FAIL_REASON_TIMEOUT the issued command is set to FAIL without a reason.
- async wait_fututre_done_or_fault(future)#
Wait for either the future to be done or for the CSC to go to FAULT, whichever comes first.
- Parameters:
future (
Future)- Return type:
- async write_command(command, **params)#
Write the command JSON string to the TCP/IP command/event server.
- Parameters:
command (
str) – The command to write.**params (
typing.Any) – The parameters for the command. This may be empty.
- Returns:
command_issued – An instance of CommandIssued to monitor the future state of the command.
- Return type:
Notes
If no command parameters are passed on then a default parameter named
valueis added since the real ATMCS expects this. This will be removed in DM-39629.