Skip to content

Commit

Permalink
Merge pull request #119 from lsst-ts/tickets/DM-41593
Browse files Browse the repository at this point in the history
DM-41593: Update MoveP2P script to monitor state of the components and fault if any of them goes to FAULT
  • Loading branch information
tribeiro authored Dec 7, 2023
2 parents 10f3eec + 586f113 commit 9484e0e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
1 change: 1 addition & 0 deletions doc/news/DM-41593.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
In ``maintel/mtcs.py``, update ``move_p2p_radec`` to check that the mtcs is in ENABLED state while moving.
17 changes: 13 additions & 4 deletions python/lsst/ts/observatory/control/maintel/mtcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1778,11 +1778,20 @@ async def move_p2p_radec(
"""
async with self.m1m3_booster_valve():
azel = self.azel_from_radec(ra=ra, dec=dec)
await self.rem.mtmount.cmd_moveToTarget.set_start(
azimuth=azel.az.value,
elevation=azel.alt.value,
timeout=timeout,
tasks = [
asyncio.create_task(self.check_component_state(component))
for component in self.components_to_check()
]
tasks.append(
asyncio.create_task(
self.rem.mtmount.cmd_moveToTarget.set_start(
azimuth=azel.az.value,
elevation=azel.alt.value,
timeout=timeout,
)
)
)
await self.process_as_completed(tasks)

async def offset_camera_hexapod(
self,
Expand Down
24 changes: 24 additions & 0 deletions tests/maintel/test_mtcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1780,12 +1780,21 @@ async def test_move_p2p_azel_with_timeout(self) -> None:

self.assert_m1m3_booster_valve()

async def test_move_p2p_azel_fail_cscs_not_enabled(self) -> None:
with pytest.raises(
RuntimeError,
match=".* state is <State.STANDBY: 5>, expected <State.ENABLED: 2>",
):
await self.mtcs.move_p2p_azel(az=0.0, el=80.0, timeout=30.0)

async def test_move_p2p_radec(self) -> None:
az = 90.0
el = 80.0

radec = self.mtcs.radec_from_azel(az=az, el=el)

await self.mtcs.enable()

self.log.info(f"{radec=}")
await self.mtcs.move_p2p_radec(
ra=radec.ra.to(units.hourangle).value,
Expand All @@ -1800,6 +1809,21 @@ async def test_move_p2p_radec(self) -> None:

self.assert_m1m3_booster_valve()

async def test_move_p2p_radec_fail_cscs_not_enabled(self) -> None:
az = 90.0
el = 80.0

radec = self.mtcs.radec_from_azel(az=az, el=el)

with pytest.raises(
RuntimeError,
match=".* state is <State.STANDBY: 5>, expected <State.ENABLED: 2>",
):
await self.mtcs.move_p2p_radec(
ra=radec.ra.to(units.hourangle).value,
dec=radec.dec.value,
)

async def test_m1m3_booster_valve(self) -> None:
async with self.mtcs.m1m3_booster_valve():
await asyncio.sleep(0)
Expand Down

0 comments on commit 9484e0e

Please sign in to comment.