MTDomeCom#
- class lsst.ts.mtdomecom.MTDomeCom(log, config, config_dir, simulation_mode=ValidSimulationMode.NORMAL_OPERATIONS, telemetry_callbacks=None, reject_small_azimuth_motions=False, start_periodic_tasks=True, communication_error=False, timeout_error=False)#
Bases:
objectTCP/IP interface to the MTDome controller.
- Parameters:
log (
logging.Logger) – Logger for which a child logger is created.config (
SimpleNameSpace) – The configuration to use. This should contain the host name and port to connect to.config_dir (
pathlib.Path) – The configuration directory as used by the CSC. This must be the full path including the schema version directory.simulation_mode (
ValidSimulationMode) – The simulation mode to use. Defaults toNORMAL_OPERATIONS.telemetry_callbacks (
dict`[`LlcName,typing.Callable]) – List of telemetry callback coroutines to use. Defaults toNone.reject_small_azimuth_motions (
bool) – Reject small azimuth motions or not? Defaults toFalse.start_periodic_tasks (
bool) – Start the periodic tasks or not. Defaults toTrue. Unit tests may set this toFalse.communication_error (
bool) – Is there a communication error with the rotating part (True) or not (False)? This is for unit tests only. The default is False.timeout_error (
bool) – Do command replies timeout of not? This is for unit tests only. The default is False.
Attributes Summary
Methods Summary
Check if all commands have received a reply.
Close all louvers.
Close the shutter.
config_llcs(system, settings)Config command not to be executed by SAL.
connect()Connect to the dome controller's TCP/IP port.
crawl_az(velocity)Crawl AZ.
crawl_el(velocity)Crawl El.
Disconnect from the TCP/IP controller, if connected, and stop the mock controller, if running.
exit_fault(sub_system_ids)Indicate that all hardware errors have been resolved.
Indicate that all AMCS hardware errors have been resolved.
Indicate that all LWSCS hardware errors have been resolved.
Indicate that all LCS hardware errors have been resolved.
Indicate that all ApSCS hardware errors have been resolved.
Indicate that all ThCS hardware errors have been resolved.
fans(speed)Set the speed of the fans.
Check if a non-status command is running.
home(sub_system_ids, direction)Search the home position of the Aperture Shutter in the indicated direction.
inflate(action)Inflate or deflate the inflatable seal.
is_moveAz_same_as_current(position, velocity)Is the received moveAz command the same as the current moveAz command or not.
move_az(position, velocity)Move AZ.
move_el(position)Move El.
one_periodic_task(method, interval[, ...])Run one method forever at the specified interval.
Open the shutter.
park()Park the dome.
Process the commands in the queue, if there are any.
Query the status of all lower level components.
Return a copy of a dict with specified items removed.
request_llc_status(llc_name)Generic method for retrieving the status of a lower level component.
reset_drives_az(reset)Reset one or more AZ drives.
reset_drives_louvers(reset)Reset one or more Louver drives.
reset_drives_shutter(reset)Reset one or more Aperture Shutter drives.
set_louvers(position)Set the positions of the louvers.
set_operational_mode(operational_mode, ...)Indicate that one or more sub_systems need to operate in degraded or normal state.
set_power_management_mode(power_management_mode)Set the power management mode.
set_temperature(temperature)Set the preferred temperature in the dome.
Take the current position of the dome as zero.
AMCS status command.
ApSCS status command.
CBCS status command.
CSCS status command.
LCS status command.
LLC status command.
LWSCS status command.
MonCS status command.
RAD status command.
ThCS status command.
stop_az(engage_brakes)Stop AZ motion and engage the brakes if indicated.
stop_el(engage_brakes)Stop EL motion and engage the brakes if indicated.
stop_louvers(engage_brakes)Stop Louvers motion and engage the brakes if indicated.
stop_shutter(engage_brakes)Stop Shutter motion and engage the brakes if indicated.
stop_sub_systems(sub_system_ids, engage_brakes)Stop all motion and engage the brakes if indicated in the data.
Update the status of the non-status command.
write_then_read_reply(command, **params)Write the cmd string and then read the reply to the command.
Attributes Documentation
- connected#
Methods Documentation
- async check_all_commands_have_replies()#
Check if all commands have received a reply.
If a command hasn’t received a reply after at least COMMANDS_REPLIED_PERIOD seconds, a warning is logged.
If a command hasn’t received a reply after at least 2 * COMMANDS_REPLIED_PERIOD seconds, an error is logged and the command is removed from the waiting list.
- Return type:
- async config_llcs(system, settings)#
Config command not to be executed by SAL.
This command will be used to send the values of one or more parameters to configure the lower level components.
- async connect()#
Connect to the dome controller’s TCP/IP port.
Start the mock controller, if simulating.
- Return type:
- async crawl_az(velocity)#
Crawl AZ.
Notes
The AMCS expects the velocity in radians/sec. This method takes care the conversion to radians.
- async crawl_el(velocity)#
Crawl El.
Notes
The LWSCS expects the velocity in radians/sec. This method takes care the conversion to radians.
- async disconnect()#
Disconnect from the TCP/IP controller, if connected, and stop the mock controller, if running.
- Return type:
- async exit_fault(sub_system_ids)#
Indicate that all hardware errors have been resolved.
- async exit_fault_el()#
Indicate that all LWSCS hardware errors have been resolved.
- Return type:
- async exit_fault_louvers()#
Indicate that all LCS hardware errors have been resolved.
- Return type:
- async exit_fault_shutter()#
Indicate that all ApSCS hardware errors have been resolved.
- Return type:
- async exit_fault_thermal()#
Indicate that all ThCS hardware errors have been resolved.
- Return type:
- async fans(speed)#
Set the speed of the fans.
- async has_non_status_command()#
Check if a non-status command is running.
- Returns:
status – True if a non-status command is running, False otherwise.
- Return type:
- async home(sub_system_ids, direction)#
Search the home position of the Aperture Shutter in the indicated direction.
This is necessary in case the ApSCS (Aperture Shutter Control system) was shutdown with the Aperture Shutter not fully open or fully closed.
- async inflate(action)#
Inflate or deflate the inflatable seal.
- Parameters:
action (
OnOff) – The action to perform.- Return type:
- is_moveAz_same_as_current(position, velocity)#
Is the received moveAz command the same as the current moveAz command or not.
- Parameters:
- Returns:
False if
reject_small_azimuth_motionsis False, True if the issued moveAz command is the same as the current moveAz command or False otherwise.- Return type:
Notes
If
reject_small_azimuth_motionsis False, this method will always return False.The moveAz command is regarded to be the same as the current one if and only if the position is the same and the velocity is 0.0. In all other cases the command is regarded not to be the same. This is important because, if the velocity != 0.0, the dome is following a moving target and the chance of it being at exactly the commanded position with the commanded velocity can be considered zero and therefore the moveAz command has to be sent to the dome.
The very first moveAz command, when connecting to the low-level controller, always is executed, even if the position matches the current position of the dome. This may lead to a full 360º rotation by the dome, but it is a small risk.
The tolerance for the position is 0.25 deg as specified in LTS-97. The tolerance for the velocity is set to a small but non-zero value. See
lsst.ts.mtdomecom.enumsfor more information.
- async move_az(position, velocity)#
Move AZ.
- Parameters:
- Return type:
Notes
The AMCS expects the position in radians and the velocity in radians/s. On top of that, the AMCS internal angle is offset by about 32 degrees east with respect to 0 degrees azimuth. This method takes care of the offset and the conversion to radians.
- async move_el(position)#
Move El.
Notes
The LWSCS expects the position in radians. This method takes care of the conversion to radians.
- async one_periodic_task(method, interval, wrap_with_async_task=True)#
Run one method forever at the specified interval.
- Parameters:
method (
typing.Callable) – The periodic method to run.interval (
float) – The interval (sec) at which to run the status method.wrap_with_async_task (
bool, optional) – Wrap the method in an asyncio task or not. Defaults toTrue.
- Return type:
- async process_command_queue()#
Process the commands in the queue, if there are any.
Depending on the power management state, certain commands take precedence over others. Whether a command actually can be issued depends on the expected power draw for the command and the available power for the rotating part of the dome. If a command can be issued then it is removed from the queue, otherwise not.
- Return type:
- remove_keys_from_dict(dict_with_too_many_keys, keys_to_remove)#
Return a copy of a dict with specified items removed.
- async request_llc_status(llc_name)#
Generic method for retrieving the status of a lower level component.
The status also is pre_processed, meaning prepared for further processing downstream.
- async reset_drives_az(reset)#
Reset one or more AZ drives.
This is necessary when exiting from FAULT state without going to Degraded Mode since the drives don’t reset themselves.
- Parameters:
reset (
list`[`int]) – List of indices of the motors to reset.- Return type:
- async reset_drives_louvers(reset)#
Reset one or more Louver drives.
This is necessary when exiting from FAULT state without going to Degraded Mode since the drives don’t reset themselves.
- Parameters:
reset (
list`[`int]) – List of indices of the motors to reset.- Return type:
- async reset_drives_shutter(reset)#
Reset one or more Aperture Shutter drives.
This is necessary when exiting from FAULT state without going to Degraded Mode since the drives don’t reset themselves.
- Parameters:
reset (
list`[`int]) – List of indices of the motors to reset.- Return type:
- async set_louvers(position)#
Set the positions of the louvers.
- async set_operational_mode(operational_mode, sub_system_ids)#
Indicate that one or more sub_systems need to operate in degraded or normal state.
- async set_power_management_mode(power_management_mode)#
Set the power management mode.
- Parameters:
power_management_mode (
PowerManagementMode) – The power management mode to set.- Return type:
- async set_temperature(temperature)#
Set the preferred temperature in the dome.
- async set_zero_az()#
Take the current position of the dome as zero.
This is necessary as long as the racks and pinions on the drives have not been installed yet to compensate for slippage of the drives.
- Return type:
- async stop_az(engage_brakes)#
Stop AZ motion and engage the brakes if indicated. Also disengage the locking pins if engaged.
- async stop_el(engage_brakes)#
Stop EL motion and engage the brakes if indicated. Also disengage the locking pins if engaged.
- async stop_louvers(engage_brakes)#
Stop Louvers motion and engage the brakes if indicated. Also disengage the locking pins if engaged.
- async stop_shutter(engage_brakes)#
Stop Shutter motion and engage the brakes if indicated. Also disengage the locking pins if engaged.
- async stop_sub_systems(sub_system_ids, engage_brakes)#
Stop all motion and engage the brakes if indicated in the data. Also disengage the locking pins if engaged.
- async update_status_of_non_status_command(status)#
Update the status of the non-status command.
- async write_then_read_reply(command, **params)#
Write the cmd string and then read the reply to the command.
Notes
For the function that calls this method, it might need to call the self.update_status_of_non_status_command() first and set the argument to be True if it is a non-status command. Otherwise, the continuous status commands in self.query_status() will block this in the TCP/IP pipe.
- Parameters:
command (
CommandName) – The command to write.**params (
typing.Any) – The parameters for the command. This may be empty.
- Returns:
data – A dict of the form {“response”: ResponseCode, “timeout”: TimeoutValue} where “response” can be zero for “OK” or non-zero for any other situation.
- Return type:
- Raises:
TimeoutError – If waiting for a command reply takes longer than _TIMEOUT seconds.