Skip to content

Commit

Permalink
Merge branch 'develop' into tickets/DM-46003
Browse files Browse the repository at this point in the history
  • Loading branch information
parfa30 authored Aug 27, 2024
2 parents 7437e3e + 30d6189 commit 8055702
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 12 deletions.
1 change: 1 addition & 0 deletions doc/news/DM-45696.feature.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
In base_tcs.py, expand captured rotator limit exceptions during slew cmd.
1 change: 1 addition & 0 deletions doc/news/DM-45696.feature.2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
In atcalsys, pass group_id metadata to the electromer and fiber spectrograph when taking data.
10 changes: 10 additions & 0 deletions python/lsst/ts/observatory/control/auxtel/atcalsys.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,10 +481,12 @@ async def _take_data(
fiber_spectrum_exposure_coroutine = self.take_fiber_spectrum(
exposure_time=fiber_spectrum_exposure_time,
exposures_done=exposures_done,
group_id=exposure_metadata.get("group_id", ""),
)
electrometer_exposure_coroutine = self.take_electrometer_scan(
exposure_time=electrometer_exposure_time,
exposures_done=exposures_done,
group_id=exposure_metadata.get("group_id", ""),
)
try:
fiber_spectrum_exposure_task = asyncio.create_task(
Expand Down Expand Up @@ -514,6 +516,7 @@ async def take_electrometer_scan(
self,
exposure_time: float | None,
exposures_done: asyncio.Future,
group_id: str,
) -> list[str]:
"""Perform an electrometer scan for the specified duration.
Expand All @@ -523,6 +526,8 @@ async def take_electrometer_scan(
Exposure time for the fiber spectrum (seconds).
exposures_done : `asyncio.Future`
A future indicating when the camera exposures where complete.
group_id : `str`
Group ID for this data.
Returns
-------
Expand All @@ -538,6 +543,7 @@ async def take_electrometer_scan(
try:
await self.electrometer.cmd_startScanDt.set_start(
scanDuration=exposure_time,
groupId=group_id,
timeout=exposure_time + self.long_timeout,
)
except salobj.AckTimeoutError:
Expand All @@ -563,6 +569,7 @@ async def take_fiber_spectrum(
self,
exposure_time: float | None,
exposures_done: asyncio.Future,
group_id: str,
) -> list[str]:
"""Take exposures with the fiber spectrograph until
the exposures with the camera are complete.
Expand All @@ -576,6 +583,8 @@ async def take_fiber_spectrum(
Exposure time for the fiber spectrum (seconds).
exposures_done : `asyncio.Future`
A future indicating when the camera exposures where complete.
group_id : str
Group id for the data.
Returns
-------
Expand All @@ -591,6 +600,7 @@ async def take_fiber_spectrum(
await self.fiberspectrograph.cmd_expose.set_start(
duration=exposure_time,
numExposures=1,
groupId=group_id,
timeout=exposure_time + self.long_timeout,
)
except salobj.AckTimeoutError:
Expand Down
45 changes: 33 additions & 12 deletions python/lsst/ts/observatory/control/base_tcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,30 +648,51 @@ async def slew_icrs(
offset_y=offset_y,
)
except salobj.AckError as ack_error:
if "Target out of rotator limit" in ack_error.ackcmd.result:
if "rotator position angle out of range" in ack_error.ackcmd.result:
self.log.warning(
"Target out of rotator limit. Trying different angle."
)
continue
elif "Target out of rotator limit" in ack_error.ackcmd.result:
self.log.warning(
"Target out of rotator limit. Trying different angle."
)
continue
elif "out of slew limit margin" in ack_error.ackcmd.result:
self.log.warning(
"Target out of rotator slew limit margin. Trying different angle."
)
continue
else:
raise ack_error
except Exception as e:
slew_exception = e
break
else:
if self._overslew_az:
overslew_az = 2.0 * 3600.0 * np.cos(alt_az.alt.rad)
self.log.info(
"Overslew Azimuth feature is enabled. Slewing past target position by"
f"{(overslew_az/3600.):.1f} degrees and waiting for settle."
)
await asyncio.sleep(self.tel_settle_time)
await self.offset_azel(az=overslew_az, el=0, relative=False)
await asyncio.sleep(self.tel_settle_time)
self.log.info("Slewing back to target position.")
await self.offset_azel(az=0, el=0, relative=False)
try:
overslew_az = 2.0 * 3600.0 * np.cos(alt_az.alt.rad)
self.log.info(
"Overslew Azimuth feature is enabled. Slewing past target position by"
f"{(overslew_az/3600.):.1f} degrees and waiting for settle."
)
await asyncio.sleep(self.tel_settle_time)
await self.offset_azel(az=overslew_az, el=0, relative=False)
await asyncio.sleep(self.tel_settle_time)
self.log.info("Slewing back to target position.")
await self.offset_azel(az=0, el=0, relative=False)
except salobj.AckError as ack_error:
if (
"out of range"
or "out of slew limit" in ack_error.ackcmd.result
):
self.log.warning(
"Overslew is out of operational limits. Skipping overslew."
)
continue
else:
raise ack_error
break

if slew_exception is not None:
raise slew_exception

Expand Down

0 comments on commit 8055702

Please sign in to comment.