-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add unpark MTDome logic for MTCS #161
Conversation
iglesu
commented
Sep 6, 2024
f4d15cc
to
82633bf
Compare
82633bf
to
0e97a9e
Compare
0bed32e
to
276a77f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I some some questions regarding the use of azEnabled
event, why not rely on the azMotion
like we did for parking?
Also, please, make sure all methods and attributes are snake_case
.
timeout=self.fast_timeout | ||
) | ||
|
||
az_delta = 0.1 # A small move to un-park the Dome |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make this a class attribute instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we also add the
unpark_velocity = 0.0 # The Dome defaults to a crawl velocity
as an attribute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as per @tribeiro comment:
velocity will always be zero, no matter what.. you can even ignore that parameter and don't set it as the default is zero.
@@ -25,6 +25,7 @@ | |||
import copy | |||
import enum | |||
import logging | |||
import time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, don't use the time
module, you already have timing functionality with the lsst.ts.utils
module. You can user utils.current_tai()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the azEnabled check
@@ -632,6 +633,52 @@ def dome_ready(az_motion: salobj.type_hints.BaseMsgType) -> bool: | |||
f"Dome state: {MTDome.MotionState(az_motion.state).name}, inPosition: {az_motion.inPosition}" | |||
) | |||
|
|||
async def wait_for_dome_azEnabled(self, timeout: float) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method name should be snake_case
, please rename it to wait_for_dome_az_enabled
.
However, do you really need this method? won't the one you included for parking (wait_for_dome_state
) do the work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
azEnabled check removed
) | ||
|
||
# The cmd_MoveAz should issue a azEnabled event set to ENABLED | ||
await self.wait_for_dome_azEnabled(timeout=self.park_dome_timeout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you really need to look for this event? Why not rely on the wait_for_dome_state
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on the azEnabled event, I'm following the advice given by you and Wouter on the issue: https://rubinobs.atlassian.net/browse/DM-45608?focusedCommentId=523258 specifically:
Also check the azMotion, and azEnabled events to verify UNPARKED status.
but happy to do otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as per @tribeiro comment:
I think the comments was more on the lines of use one or the other..
in light of that I'm removing the azEnabled check
@@ -121,10 +121,14 @@ async def setup_types(self) -> None: | |||
) | |||
|
|||
# MTDome Motion PARKED state. State is set by the mocked park cmd. | |||
self._mtdome_evt_azMotion_state = types.SimpleNamespace( | |||
self._mtdome_evt_azMotion = types.SimpleNamespace( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, use snake_case
for attributes.
state=MTDome.MotionState.UNDETERMINED, inPosition=False | ||
) | ||
|
||
self._mtdome_evt_azEnabled = types.SimpleNamespace( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
snake_case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm removing the azEnabled check
9c00a65
to
31ad5f6
Compare
@@ -148,6 +148,9 @@ def __init__( | |||
self._dome_az_in_position: typing.Union[None, asyncio.Event] = None | |||
self._dome_el_in_positio: typing.Union[None, asyncio.Event] = None | |||
|
|||
self.az_delta = 0.1 # A small move to un-park the Dome |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, instead of relying on the comment (that is only really here) to specify what the attribute is, use a more expressive name. Something like;
# Small offset (in degrees) applied to the dome to unpark it.
self.dome_az_unpark_offset = 0.1
Would be better.
@@ -148,6 +148,9 @@ def __init__( | |||
self._dome_az_in_position: typing.Union[None, asyncio.Event] = None | |||
self._dome_el_in_positio: typing.Union[None, asyncio.Event] = None | |||
|
|||
self.az_delta = 0.1 # A small move to un-park the Dome | |||
self.dome_unpark_velocity = 0.0 # A small move to un-park the Dome |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not necessary so please, consider removing it.
message="All components need to be enabled for un-parking the Dome." | ||
) | ||
|
||
self.log.info("Checking if the dome is currently PARKED.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe debug level instead?
self.rem.mtdome.evt_azMotion.flush() | ||
|
||
# We don't specify the dome velocity as it defaults to a | ||
# `crawl` which is what we want. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correctly stated. This should read:
# We don't specify the dome velocity as it defaults to
# zero, which is what we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good!
f946283
to
a207e7c
Compare
- Implemented unpark logic in MTCS to move the dome from PARKED state. - Added mock support for dome events in MTCSAsyncMock. - Included unit tests for unpark_dome
d4f501c
to
2baec9b
Compare