Skip to content

Commit

Permalink
Merge pull request #107 from lsst-ts/tickets/DM-41081
Browse files Browse the repository at this point in the history
Update ``MTCS.move_rotator`` with new ``wait_for_in_position`` option
  • Loading branch information
b1quint authored Oct 17, 2023
2 parents 2822688 + a450550 commit 86eb325
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
1 change: 1 addition & 0 deletions doc/version_history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down
20 changes: 14 additions & 6 deletions python/lsst/ts/observatory/control/maintel/mtcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1567,25 +1567,33 @@ 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.
Parameters
----------
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,
Expand Down
11 changes: 11 additions & 0 deletions tests/maintel/test_mtcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])

Expand Down

0 comments on commit 86eb325

Please sign in to comment.