diff --git a/doc/version_history.rst b/doc/version_history.rst index 1532ae0a..165dbadd 100644 --- a/doc/version_history.rst +++ b/doc/version_history.rst @@ -11,6 +11,7 @@ v0.31.0 * Add ``LSSTCam`` class to interface with the LSSTCam CSC using the ``BaseCamera`` interface. * In ``constants/latiss_constants.py``, update blue300lppm_qn1, holo4_003, and holo4_001 sweet spots. +* Add new option to ``MTCS.move_rotator`` to allow the function to return before the rotator is in position. v0.30.5 ------- diff --git a/python/lsst/ts/observatory/control/maintel/mtcs.py b/python/lsst/ts/observatory/control/maintel/mtcs.py index 1c816f07..010d1264 100644 --- a/python/lsst/ts/observatory/control/maintel/mtcs.py +++ b/python/lsst/ts/observatory/control/maintel/mtcs.py @@ -1567,7 +1567,9 @@ async def move_camera_hexapod( component_name="Camera Hexapod", ) - async def move_rotator(self, position: float) -> None: + async def move_rotator( + self, position: float, wait_for_in_position: bool = True + ) -> None: """Move rotator to specified position and wait for movement to complete. @@ -1575,17 +1577,23 @@ async def move_rotator(self, position: float) -> None: ---------- position : `float` Desired rotator position (deg). + wait_for_in_position : `bool`, optional + Wait for rotator to reach desired position before returning the + function? Default True. """ await self.rem.mtrotator.cmd_move.set_start( position=position, timeout=self.long_timeout ) - await self._handle_in_position( - in_position_event=self.rem.mtrotator.evt_inPosition, - timeout=self.long_long_timeout, - component_name="MTRotator", - ) + if wait_for_in_position: + await self._handle_in_position( + in_position_event=self.rem.mtrotator.evt_inPosition, + timeout=self.long_long_timeout, + component_name="MTRotator", + ) + else: + self.log.warning("Not waiting for rotator to reach desired position.") async def move_m2_hexapod( self, diff --git a/tests/maintel/test_mtcs.py b/tests/maintel/test_mtcs.py index e5c6a7bf..120a1688 100644 --- a/tests/maintel/test_mtcs.py +++ b/tests/maintel/test_mtcs.py @@ -1538,6 +1538,17 @@ async def test_move_rotator(self) -> None: timeout=self.mtcs.long_long_timeout, flush=False ) + async def test_move_rotator_without_wait(self) -> None: + position = 10.0 + + await self.mtcs.move_rotator(position=position, wait_for_in_position=False) + + self.mtcs.rem.mtrotator.cmd_move.set_start.assert_awaited_with( + position=position, timeout=self.mtcs.long_timeout + ) + self.mtcs.rem.mtrotator.evt_inPosition.aget.assert_not_awaited() + self.mtcs.rem.mtrotator.evt_inPosition.next.assert_not_awaited() + async def test_move_camera_hexapod(self) -> None: hexapod_positions = dict([(axis, np.random.rand()) for axis in "xyzuv"])