MockMTHexapodController¶
-
class
lsst.ts.mthexapod.
MockMTHexapodController
(index, log, host='127.0.0.1', command_port=None, telemetry_port=None, initial_state=<ControllerState.OFFLINE: 3>)¶ Bases:
lsst.ts.hexrotcomm.base_mock_controller.BaseMockController
Mock MTHexapod controller that talks over TCP/IP.
- Parameters
- index
SalIndex
orint
SAL index; see
SalIndex
for the allowed values.- log
logging.Logger
Logger.
- host
str
(optional) IP address of CSC server.
- command_port
int
orNone
(optional) Command socket port. If
None
then use the default port for this device.- telemetry_port
int
orNone
(optional) Telemetry socket port. If
None
then use the default port for this device.- initial_state
lsst.ts.idl.enums.MTHexapod.ControllerState
(optional) Initial state of mock controller.
- index
Notes
To start the mock controller:
ctrl = MockHexapodController(…) await ctrl.connect_task
To stop the server:
await ctrl.stop()
Known Limitations
The synchronized move parameter is ignored. Supporting this would be fairly easy.
No lookup table support. Thus MOVE_LUT is the same as MOVE_POINT_TO_POINT.
Acceleration is treated as instantanous.
Attributes Summary
Return True if the command socket is connected.
Interval between connection retries (sec).
Return True if command and telemetry sockets are connected.
Return True if the telemetry socket is connected.
Interval between telemetry messages (sec).
Methods Summary
assert_state
(state[, offline_substate, …])close
()Kill command and telemetry tasks and close the connections.
Read and execute commands.
connect
()Connect the sockets.
Connect or reconnect to the command socket.
Connect or reconnect to the telemetry/configuration socket.
do_clear_error
(command)do_config_accel
(command)do_config_limits
(command)do_config_vel
(command)do_disable
(command)do_enable
(command)do_enter_control
(command)do_exit
(command)do_move_point_to_point
(command)do_offset
(command)do_position_set
(command)do_set_pivotpoint
(command)do_standby
(command)do_start
(command)do_stop
(command)end_run_command
(command, cmd_method)Called when run_command is done.
get_command_key
(command)Return the key to command_table.
run_command
(command)Run a command.
set_state
(state)Set the current state and substates.
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.
update_telemetry
(curr_tai)Update self.client.telemetry.
Write the current configuration.
Attributes Documentation
-
actuator_base_positions
= [(-227647, 653753, 0), (227647, 653753, 0), (679990, -129728, 0), (452343, -524025, 0), (-452343, -524025, 0), (-679990, -129728, 0)]¶
-
actuator_encoder_resolution
= 10¶
-
actuator_max_length
= 14100¶
-
actuator_min_length
= -14100¶
-
actuator_mirror_positions
= [(-472917, 512146, 403918), (472917, 512146, 403918), (679990, 153485, 403918), (207073, -665631, 403918), (-207073, -665631, 403918), (-679990, 153485, 403918)]¶
-
actuator_speed
= 500¶
-
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.
-
enabled_substate
¶
-
offline_substate
¶
-
pivot
= (0, 0, 500000)¶
-
state
¶
-
telemetry_connected
¶ Return True if the telemetry socket is connected.
-
telemetry_interval
= 0.1¶ Interval between telemetry messages (sec).
Methods Documentation
-
assert_state
(state, offline_substate=None, enabled_substate=None)¶
-
assert_stationary
()¶
-
async
close
()¶ Kill command and telemetry tasks and close the connections.
Always safe to call.
-
async
command_loop
()¶ Read and execute commands.
-
async
connect
()¶ Connect the sockets.
Notes
This will wait forever for a connection.
-
async
connect_command
()¶ Connect or reconnect to the command socket.
Notes
This will wait forever for a connection.
-
async
connect_telemetry
()¶ Connect or reconnect to the telemetry/configuration socket.
Notes
This will wait forever for a connection.
-
async
do_clear_error
(command)¶
-
async
do_config_accel
(command)¶
-
async
do_config_limits
(command)¶
-
async
do_config_vel
(command)¶
-
async
do_disable
(command)¶
-
async
do_enable
(command)¶
-
async
do_enter_control
(command)¶
-
async
do_exit
(command)¶
-
async
do_move_point_to_point
(command)¶
-
async
do_offset
(command)¶
-
async
do_position_set
(command)¶
-
async
do_set_pivotpoint
(command)¶
-
async
do_standby
(command)¶
-
async
do_start
(command)¶
-
async
do_stop
(command)¶
-
async
end_run_command
(command, cmd_method)¶ Called when run_command is done.
Can be used to clear the set position.
-
get_command_key
(command)¶ Return the key to command_table.
-
async
run_command
(command)¶ Run a command.
- Parameters
- command
Command
Command to run.
- command
-
set_state
(state)¶ Set the current state and substates.
- Parameters
- state
lsst.ts.idl.enums.ControllerState
orint
New state.
- state
Notes
Sets the substates as follows:
lsst.ts.idl.enums.OfflineSubstate.AVAILABLE
if state ==lsst.ts.idl.enums.ControllerState.OFFLINE
lsst.ts.idl.enums.EnabledSubstate.STATIONARY
if state ==lsst.ts.idl.enums.ControllerState.ENABLED
The real controller goes to substate
lsst.ts.idl.enums.OfflineSubstate.PUBLISH_ONLY
when going offline, but requires the engineering user interface (EUI) to get out of that state, and we don’t have an EUI for the mock controller!
-
async
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.
-
async
update_telemetry
(curr_tai)¶ Update self.client.telemetry.
- Parameters
- curr_tai
float
Time at which to compute telemetry (TAI, unix seconds). This is the time in the header, which is (approximately) the current time.
- curr_tai
-
async
write_config
()¶ Write the current configuration.