Skip to content

Commit

Permalink
Merge pull request #178 from lsst-ts/tickets/DM-46979
Browse files Browse the repository at this point in the history
Tickets/DM-46979: Add preliminary methods in MTCS to handle TMA park/unpark
  • Loading branch information
MarcoRocchietti authored Nov 16, 2024
2 parents 09ee0a6 + c7e4532 commit cdd00ec
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/news/DM-46979.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add methods in ``MTCS`` to park and unpark the TMA.
26 changes: 26 additions & 0 deletions python/lsst/ts/observatory/control/maintel/mtcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,32 @@ async def in_m1_cover_operational_range(self) -> bool:

return elevation.actualPosition >= self.tel_operate_mirror_covers_el

async def park_mount(self, position: MTMount.ParkPosition) -> None:
"""Park the TMA in the selected position.
Parameters
----------
position : `MTMount.ParkPosition`
The position to park the TMA.
"""

await self.assert_all_enabled(
message="All components need to be enabled for parking the TMA."
)

await self.rem.mtmount.cmd_park.start(
position=position, timeout=self.long_timeout
)

async def unpark_mount(self) -> None:
"""Un-park the TMA."""

await self.assert_all_enabled(
message="All components need to be enabled for unparking the TMA."
)

await self.rem.mtmount.cmd_unpark.start(timeout=self.long_timeout)

async def prepare_for_flatfield(self, check: typing.Any = None) -> None:
# TODO: Implement (DM-21336).
raise NotImplementedError("# TODO: Implement (DM-21336).")
Expand Down
30 changes: 30 additions & 0 deletions tests/maintel/test_mtcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,36 @@ async def test_not_in_m1_cover_operational_range(self) -> None:

assert not elevation_in_range

async def test_park_mount_zenith(self) -> None:
await self.mtcs.enable()
await self.mtcs.assert_all_enabled()

await self.mtcs.park_mount(MTMount.ParkPosition.ZENITH)

self.mtcs.rem.mtmount.cmd_park.start.assert_awaited_with(
position=MTMount.ParkPosition.ZENITH, timeout=self.mtcs.long_timeout
)

async def test_park_mount_horizon(self) -> None:
await self.mtcs.enable()
await self.mtcs.assert_all_enabled()

await self.mtcs.park_mount(MTMount.ParkPosition.HORIZON)

self.mtcs.rem.mtmount.cmd_park.start.assert_awaited_with(
position=MTMount.ParkPosition.HORIZON, timeout=self.mtcs.long_timeout
)

async def test_unpark_mount(self) -> None:
await self.mtcs.enable()
await self.mtcs.assert_all_enabled()

await self.mtcs.unpark_mount()

self.mtcs.rem.mtmount.cmd_unpark.start.assert_awaited_with(
timeout=self.mtcs.long_timeout
)

async def test_slew_to_m1_cover_operational_range(self) -> None:
self._mtmount_tel_azimuth.actualPosition = 0.0
self._mtmount_tel_elevation.actualPosition = (
Expand Down

0 comments on commit cdd00ec

Please sign in to comment.