M2 Common Code

https://img.shields.io/badge/GitHub-ts__m2com-green.svg https://img.shields.io/badge/Jenkins-ts__m2com-green.svg https://img.shields.io/badge/Jira-ts__m2com-green.svg

Overview

This module contains the common code for the main telescope M2 commandable SAL component (CSC) and graphical user interface (GUI) to operate the M2 mirror control system. The eups is used as the package manager. This package also supports the conda package manager.

The badges above navigate to the GitHub repository for the common code and Jira issues.

Dependencies

JSON String

The JSON string is used in the TCP/IP communication between the M2 CSC/GUI and hardware. The design here takes the following documents as references: TS JSON Message Format Proposal and TS JSON Message Format Proposal.

Architecture

The classes and files for each module are listed below.

m2com

@startuml
Controller "1" *-- "2" TcpClient
Controller <|-- ControllerCell
@enduml

Figure 1 Class diagram of M2 common code

  • Controller has the business logic to communicate with hardware by TCP/IP interface.

  • TcpClient is a TCP/IP client.

  • ControllerCell is a high-level class to integrate with the controller class to communicate with the M2 cell controller.

m2com.mock

@startuml
package "tcpip" #DDDDDD {
  class OneClientServer
}

MockServer "1" *-- "2" OneClientServer
MockServer *-- MockModel
MockServer *-- MockMessageTelemetry
MockServer *-- MockMessageEvent
MockServer *-- MockCommand

MockCommand ..> MockMessageEvent
MockCommand --> MockModel

MockModel *-- MockScriptEngine
MockModel *-- MockControlOpenLoop
MockModel *-- MockControlClosedLoop

@enduml

Figure 2 Class diagram of mock module in M2 common code

  • MockServer is a mock server of M2 to support the simulation mode.

  • MockModel simulates the hardware behavior to be used by MockServer.

  • MockScriptEngine simulates the execution of binary script.

  • MockControlOpenLoop simulates the open-loop control.

  • MockControlClosedLoop simulates the closed-loop control.

  • MockCommand simulates the execution of command in real hardware.

  • MockMessageEvent simulates the message of event from real hardware.

  • MockMessageTelemetry simulates the message of telemetry from real hardware.

APIs

This section is autogenerated from docstrings.

lsst.ts.m2com Package

Functions

check_queue_size(queue, log[, name])

Check the size of queue and log the information if needed.

collect_queue_messages(queue, name[, flush])

Collect the specific messages in queue.

get_config_dir([env_variable, relative_path])

Get the directory of configuration files.

get_queue_message_latest(queue, name[, flush])

Get the latest message in queue.

is_coroutine(function)

Input function is a coroution or not.

read_yaml_file(filepath)

Read the yaml file.

write_json_packet(writer, msg_input)

Write the json packet.

Classes

ActuatorDisplacementUnit(value)

Unit of the actuator displacement.

CommandActuator(value)

Action to command the actuators.

CommandScript(value)

Action to command the script execution.

CommandStatus(value)

Command status.

Controller([log, timeout_in_second, ...])

Controller class.

ControllerCell([log, timeout_in_second, ...])

Cell controller class.

DetailedState(value)

Detailed substates of the Offline state.

DigitalInput(value)

Bit of digital input.

DigitalOutput(value)

Bit of digital output.

MockCommand([is_csc])

Mock command to simulate the execution of command in real hardware.

MockControlClosedLoop()

Mock closed-loop control.

MockControlOpenLoop()

Mock open-loop control.

MockMessageEvent(writer)

Mock message of event to simulate the message from real hardware.

MockMessageTelemetry(writer)

Mock message of telemetry to simulate the message from real hardware.

MockModel([log, inclinometer_angle, ...])

Mock Model class.

MockScriptEngine()

Mock script engine class to simulate the execution of binary script.

MockServer(host[, port_command, ...])

Mock server of M2.

MsgType(value)

Message type to the cell controller.

PowerType(value)

Type of the power.

TcpClient(host, port[, timeout_in_second, ...])

TCP/IP client.

Build and Test

Using docker is highly recommended. The built docker image is develop_env.

To setup and test the code using Docker, enter:

docker run -it --rm -v ${repo_location}:/home/saluser/ts_m2com lsstts/develop-env:${tag}
cd ts_m2com
setup -k -r .

The environment shall be setup either from /home/saluser/.setup_dev.sh.

Version History

The version history is at the following link.

The released version is here.

Contributing

To contribute, please start a new pull request on GitHub. Feature requests shall be filled in JIRA with the ts_m2com or M2 label. In all cases, reaching out to the contacts for this CSC is recommended.

Contact Personnel

For questions not covered in the documentation, emails should be addressed to the developers: Tiago Ribeiro <tribeiro@lsst.org> and Te-Wei Tsai <ttsai@lsst.org>. The product owner is Sandrine Thomas <sthomas@lsst.org>.

This page was last modified 2022-09-22.