CommandTelemetryClient¶
-
class
lsst.ts.hexrotcomm.
CommandTelemetryClient
(*, log, config, telemetry, command_port, telemetry_port, host='127.0.0.1')¶ Bases:
object
Client for a mock Moog TCP/IP controller.
The controller uses two TCP/IP _client_ sockets, one to read commands and the other to write telemetry. Both sockets must be connected for the controller to operate; if either becomes disconnected the controller will stop moving, close any open sockets and try to reconnect.
Parameters: - log :
logging.Logger
Logger.
- config :
ctypes.Structure
Configuration data. May be modified.
- telemetry :
ctypes.Structure
Telemetry data. Modified by
update_telemetry
.- command_port :
int
Command socket port.
- telemetry_port :
int
Telemetry socket port.
- host :
str
(optional) IP address of CSC server.
Notes
To start a client:
client = Client(...) await client.connect_task
To stop the client:
await client.stop()Attributes Summary
command_connected
Return True if the command socket is connected. connect_retry_interval
Interval between connection retries (sec). connected
Return True if command and telemetry sockets are connected. telemetry_connected
Return True if the telemetry socket is connected. telemetry_interval
Interval between telemetry messages (sec). Methods Summary
close
()Kill command and telemetry tasks and close the connections. command_loop
()Read and execute commands. connect
()Connect the sockets. connect_command
()Connect or reconnect to the command socket. connect_telemetry
()Connect or reconnect to the telemetry/configuration socket. run_command
(command)Run a command. telemetry_loop
()Write configuration once, then telemetry at regular intervals. update_and_get_header
(frame_id)Update the config or telemetry header and return it and the time. write_config
()Write the current configuration. Attributes Documentation
-
command_connected
¶ Return True if the command socket is connected.
-
connect_retry_interval
= 0.1¶ Interval between connection retries (sec).
-
connected
¶ Return True if command and telemetry sockets are connected.
-
telemetry_connected
¶ Return True if the telemetry socket is connected.
-
telemetry_interval
= 0.1¶ Interval between telemetry messages (sec).
Methods Documentation
-
close
()¶ Kill command and telemetry tasks and close the connections.
Always safe to call.
-
command_loop
()¶ Read and execute commands.
-
connect
()¶ Connect the sockets.
Notes
This will wait forever for a connection.
-
connect_command
()¶ Connect or reconnect to the command socket.
Notes
This will wait forever for a connection.
-
connect_telemetry
()¶ Connect or reconnect to the telemetry/configuration socket.
Notes
This will wait forever for a connection.
-
telemetry_loop
()¶ Write configuration once, then telemetry at regular intervals.
-
update_and_get_header
(frame_id)¶ Update the config or telemetry header and return it and the time.
Call this prior to writing telemetry or configuration.
Parameters: - frame_id :
int
Frame ID of header to write.
Returns: - header :
structs.Header
The header.
- curr_tai :
float
Current time in header timestamp (TAI, unix seconds).
- frame_id :
-
write_config
()¶ Write the current configuration.
- log :