diff --git a/doc/news/DM-41593.feature.rst b/doc/news/DM-41593.feature.rst new file mode 100644 index 00000000..8b107f92 --- /dev/null +++ b/doc/news/DM-41593.feature.rst @@ -0,0 +1 @@ +In ``maintel/mtcs.py``, update ``move_p2p_radec`` to check that the mtcs is in ENABLED state while moving. diff --git a/python/lsst/ts/observatory/control/maintel/mtcs.py b/python/lsst/ts/observatory/control/maintel/mtcs.py index 3b176211..9f027c59 100644 --- a/python/lsst/ts/observatory/control/maintel/mtcs.py +++ b/python/lsst/ts/observatory/control/maintel/mtcs.py @@ -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, diff --git a/tests/maintel/test_mtcs.py b/tests/maintel/test_mtcs.py index c734e8f9..0fc30de0 100644 --- a/tests/maintel/test_mtcs.py +++ b/tests/maintel/test_mtcs.py @@ -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 , expected ", + ): + 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, @@ -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 , expected ", + ): + 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)