Skip to content

Commit

Permalink
In mock/mtcs_async_mock.py, add mocks for mtrotator_cmd_stop and mtro…
Browse files Browse the repository at this point in the history
…tator_evt_controllerState.
  • Loading branch information
edennihy committed Oct 17, 2023
1 parent 24dcffe commit 03ae3e3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions python/lsst/ts/observatory/control/mock/mtcs_async_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ async def setup_types(self) -> None:
actualPosition=0.0,
)
self._mtrotator_evt_in_position = types.SimpleNamespace(inPosition=True)
self._mtrotator_evt_controllerState = types.SimpleNamespace(
enabledSubstate=idl.enums.MTRotator.EnabledSubstate.STATIONARY
)

# MTDome data
self._mtdome_tel_azimuth = types.SimpleNamespace(
Expand Down Expand Up @@ -201,6 +204,9 @@ async def setup_mtrotator(self) -> None:
"evt_inPosition.next.side_effect": self.mtrotator_evt_in_position_next,
"evt_inPosition.aget.side_effect": self.mtrotator_evt_in_position_next,
"cmd_move.set_start.side_effect": self.mtrotator_cmd_move,
"cmd_stop.set_start.side_effect": self.mtrotator_cmd_stop,
"evt_controllerState.next.side_effect": self.mtrotator_evt_controllerState_next,
"evt_controllerState.aget.side_effect": self.mtrotator_evt_controllerState_next,
}
self.mtcs.rem.mtrotator.configure_mock(**mtrotator_mocks)

Expand Down Expand Up @@ -406,6 +412,17 @@ async def _mtrotator_move(self, position: float) -> None:
self._mtrotator_tel_rotation.actualPosition = position
self._mtrotator_evt_in_position.inPosition = True

async def mtrotator_cmd_stop(
self, *args: typing.Any, **kwargs: typing.Any
) -> types.SimpleNamespace:
self._mtrotator_evt_controllerState.enabledSubstate = (
idl.enums.MTRotator.EnabledSubstate.CONSTANT_VELOCITY
)
await asyncio.sleep(self.heartbeat_time)
self._mtrotator_evt_controllerState.enabledSubstate = (
idl.enums.MTRotator.EnabledSubstate.STATIONARY
)

async def mtrotator_tel_rotation_next(
self, *args: typing.Any, **kwargs: typing.Any
) -> types.SimpleNamespace:
Expand All @@ -418,6 +435,12 @@ async def mtrotator_evt_in_position_next(
await asyncio.sleep(self.heartbeat_time)
return self._mtrotator_evt_in_position

async def mtrotator_evt_controllerState_next(
self, *args: typing.Any, **kwargs: typing.Any
) -> types.SimpleNamespace:
await asyncio.sleep(self.heartbeat_time)
return self._mtrotator_evt_controllerState

async def mtdome_tel_azimuth_next(
self, *args: typing.Any, **kwargs: typing.Any
) -> types.SimpleNamespace:
Expand Down

0 comments on commit 03ae3e3

Please sign in to comment.