-
Notifications
You must be signed in to change notification settings - Fork 13
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
Adds flags for ACU checking to hwp supervisor, along with tests #802
base: main
Are you sure you want to change the base?
Conversation
461566b
to
0498c71
Compare
for more information, see https://pre-commit.ci
08854be
to
cd0d427
Compare
d2ebe65
to
143e679
Compare
55a273f
to
bce28e8
Compare
7feffe5
to
44196c0
Compare
aa77700
to
e355b34
Compare
363ea46
to
7aa2fcc
Compare
6837f47
to
100d412
Compare
1742336
to
85db2c5
Compare
4b6f71a
to
d8adce5
Compare
bb0343d
to
0e5f9f2
Compare
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
@BrianJKoopman Ended up getting the tests to work properly! Turns out I missed a shutdown call for one of the device_emulators in the hwp emulator. Adding that makes tests clean up correctly, so I reverted the misc changes I made to test the github workflow. This contains the same update to the HWP supervisor as #805, so if you'd rather just review and merge this one we can close the other one. Thanks! |
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 great, awesome to see all the tests come together for the supervisor agent. Mostly small documentation related comments. The SIGKILL
workaround for getting the tests to run does mean code coverage doesn't get reported, which is unfortunate. It's makes it a bit challenging to understand what really gets tested.
time.sleep(1) | ||
# time.sleep(1) |
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.
Why drop this? (I kind of forget why it was there, probably to give things a second to wrap up. But if it's not needed anymore, perhaps just remove altogether?)
class GripperState: | ||
instance_id: str | ||
limit_warm_grip_state: List[bool] = field(default_factory=lambda: [False, False, False]) | ||
limit_cold_grip_state: List[bool] = field(default_factory=lambda: [False, False, False]) | ||
emg: List[bool] = field(default_factory=lambda: [False, False, False]) | ||
brake: List[bool] = field(default_factory=lambda: [False, False, False]) | ||
grip_state: Literal['cold', 'warm', 'ungripped', 'unknown'] = 'unknown' | ||
last_updated: Optional[float] = None | ||
gripper_max_time_since_update: float = 60.0 |
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 could use a docstring to describe the class and its attributes. On initial look I don't know what emg
is, for instance.
self.is_spinning = None | ||
elif now - self.pid_last_updated > self.pid_max_time_since_update: | ||
self.is_spinning = None | ||
elif self.pid_current_freq > self.pid_current_tolerance: |
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.
pid_current_tolerance
was a bit confusing to me. Perhaps pid_freq_tolerance
would be better?
@@ -1283,8 +1400,13 @@ def get_client(id): | |||
gripper=get_client(self.args.hwp_gripper_id), | |||
) | |||
|
|||
def query_hwp_state(self, session, params) -> Tuple[bool, str]: |
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.
Needs a docstring.
|
||
ops = self.hwp_state.update(test_mode=test_mode) | ||
session.data['monitored_sessions'] = ops |
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.
Related to this change, I think the documented session.data
structure might be slightly out of date. The keys now seem to be 'temperature', 'encoder', 'pmx', 'pid', and 'ups'. Can you confirm and update the docstring?
cold_limit_pos = 13.0 # mm | ||
warm_limit_pos = 10.0 # mm | ||
limit_tolerance = 1.0 # mm |
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.
Make these constants all caps, per PEP8.
@@ -45,6 +47,7 @@ def test_scpi_psu_init_psu(wait_for_crossbar, gpib_emu, run_agent, client): | |||
|
|||
@pytest.mark.integtest | |||
def test_scpi_psu_init_psu_acq_mode(wait_for_crossbar, gpib_emu, run_agent_acq, client): | |||
time.sleep(2) |
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.
Add a comment for why this is needed.
# don't send SIGINT if we've already sent SIGKILL | ||
if not runner._timedout: | ||
runner.proc.send_signal(signal.SIGKILL) |
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 SIGKILL
interrupts the ability for testing coverage to get reported. With this I get no coverage on the HWP PID agent, but if I remove it I see 95% coverage. Is this just for quicker clean up, or are the tests in CI relying on it to function properly? It runs fine on my system without it (with the kill here turned to an interrupt.) This isn't true for the supervisor test, though it has the same coverage reporting issue.
Description
Motivation and Context
This adds gripper-state monitoring to the HWP
monitor
process, and adds the following flags to the HWP state which can be checked by the ACU:gripper_state
which can be "cold", "warm", "ungripped", or "unknown"is_spinning
booleanHow Has This Been Tested?
Along with these changes, I am building out the HWP emulator into a set of integration tests that test the behavior of these flags and other operations.
This has been tested with HWP and ACU hardware on satp1.
Types of changes
Checklist: