Skip to content

Commit

Permalink
Park telescopes before operating the enclosure
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Jul 23, 2023
1 parent 31daa4b commit e4529f3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Prevent multiple devices reconnecting to RabbitMQ at the same time.
* Set the `OBJECT` header keyword in spectrograph exposures.
* Telescopes keep track of whether they have been homed.
* Telescopes will move to park automatically when trying to open or close the dome.

### 🔧 Fixed

Expand Down
42 changes: 38 additions & 4 deletions src/gort/devices/enclosure.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,49 @@ async def status(self):

return reply.flatten()

async def open(self):
"""Open the enclosure dome."""
async def _prepare_telescopes(self):
"""Moves telescopes to park position before opening/closing the enclosure."""

self.write_to_log(
"Moving telescopes to park before operating the dome.",
"warning",
)
await self.gort.telescopes.goto_named_position("park")

async def open(self, park_telescopes: bool = True):
"""Open the enclosure dome.
Parameters
----------
park_telescopes
Move the telescopes to the park position before opening the
enclosure to prevent dust or other debris falling on them.
"""

if park_telescopes:
await self._prepare_telescopes()

self.write_to_log("Opening the enclosure ...", level="info")
await self.actor.commands.dome.commands.open()
self.write_to_log("Enclosure is now open.", level="info")

async def close(self, force: bool = False):
"""Close the enclosure dome."""
async def close(self, park_telescopes: bool = True, force: bool = False):
"""Close the enclosure dome.
Parameters
----------
park_telescopes
Move the telescopes to the park position before closing the
enclosure to prevent dust or other debris falling on them.
force
Tries to closes the dome even if the system believes it is
already closed.
"""

if park_telescopes:
await self._prepare_telescopes()

self.write_to_log("Closing the enclosure ...", level="info")
await self.actor.commands.dome.commands.close(force=force)
Expand Down

0 comments on commit e4529f3

Please sign in to comment.