MockMTRotatorController#

class lsst.ts.mtrotator.MockMTRotatorController(log, port=0, initial_state=ControllerState.STANDBY)#

Bases: BaseMockController

Mock MT rotator controller that talks over TCP/IP.

Parameters:
  • log (logging.Logger) – Logger.

  • port (int (optional)) – Port for telemetry and configuration; if nonzero then the command port will be one larger. Specify 0 to choose random values for both ports; this is recommended for unit tests, to avoid collision with other tests. Do not specify 0 with host=None (see Raises section).

  • initial_state (ControllerState (optional)) – Initial state of mock controller.

Raises:

ValueError – If host=None and port=0. See CommandTelemetryServer for details.

Notes

To start the mock controller:

ctrl = MockRotatorController(…) await ctrl.connect_task

To stop the server:

await ctrl.stop()

Known Limitations

  • Constant-velocity motion is not supported.

  • The odometer resets to zero each time the mock controller is constructed.

  • The motor current and torque are scaled versions of current acceleration, with a wild guess as to scale.

  • Motor current and torque exactly match for motors A and B.

  • Many telemetry fields are not set at all.

Attributes Summary

Methods Summary

close()

Kill command and telemetry tasks and close the connections.

do_clearError(data)

do_config_accel(command)

do_config_accel_emergency(command)

do_config_jerk(command)

do_config_jerk_emergency(command)

do_config_vel(command)

do_constant_velocity(command)

do_fault(command)

do_move_point_to_point(command)

do_position_set(command)

do_set_constant_vel(command)

do_stop(command)

do_track(command)

do_track_vel_cmd(command)

end_run_command(command, cmd_method)

Called when run_command is done.

set_state(state)

Set the current state and substates.

tracking_timer()

If this times out then go into a FAULT state.

update_telemetry(curr_tai)

Update self.client.telemetry.

Attributes Documentation

current_per_acceleration = 5#
torque_per_acceleration = 0.002#

Methods Documentation

async close()#

Kill command and telemetry tasks and close the connections.

Always safe to call.

Return type:

None

async do_clearError(data)#
Parameters:

data (Command)

Return type:

None

async do_config_accel(command)#
Parameters:

command (Command)

Return type:

None

async do_config_accel_emergency(command)#
Parameters:

command (Command)

Return type:

None

async do_config_jerk(command)#
Parameters:

command (Command)

Return type:

None

async do_config_jerk_emergency(command)#
Parameters:

command (Command)

Return type:

None

async do_config_vel(command)#
Parameters:

command (Command)

Return type:

None

async do_constant_velocity(command)#
Parameters:

command (Command)

Return type:

None

async do_fault(command)#
Parameters:

command (Command)

Return type:

None

async do_move_point_to_point(command)#
Parameters:

command (Command)

Return type:

None

async do_position_set(command)#
Parameters:

command (Command)

Return type:

None

async do_set_constant_vel(command)#
Parameters:

command (Command)

Return type:

None

async do_stop(command)#
Parameters:

command (Command)

Return type:

None

async do_track(command)#
Parameters:

command (Command)

Return type:

None

async do_track_vel_cmd(command)#
Parameters:

command (Command)

Return type:

None

async end_run_command(command, cmd_method)#

Called when run_command is done.

Can be used to clear the set position.

Parameters:
Return type:

None

set_state(state)#

Set the current state and substates.

Parameters:

state (lsst.ts.xml.enums.MTHexapod.ControllerState or int) – New state.

Return type:

None

Notes

Sets the substates as follows:

  • lsst.ts.xml.enums.MTHexapod.EnabledSubstate.STATIONARY if state == lsst.ts.xml.enums.MTHexapod.ControllerState.ENABLED

async tracking_timer()#

If this times out then go into a FAULT state.

Used to make sure TRACK commands arrive often enough.

Return type:

None

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.

Return type:

None