Skip to content
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

Added staging configuration customization #136

Merged
merged 11 commits into from
May 6, 2024

Conversation

amalnanavati
Copy link
Contributor

@amalnanavati amalnanavati commented May 3, 2024

Describe this pull request. Link to relevant GitHub issues, if any.

This PR depends on ada_feeding#177.

Allow users to customize the staging configuration. The staging configuration has a few unique aspects relative to the above plate and resting configuration, which are enumerated below. Those differences motivated expansions to the CustomizeConfiguration component.

  1. It needs to not only get/set the joint states (for MoveToStagingconfiguration), but also the end-effector pose (for MoveFromMouth).
  2. It needs to have the option to "Move To Mouth" in addition to the three buttons that are already on the other screens.
  3. It needs to show the face detection image, not the raw camera stream.
  4. In order to do the above point, it need to toggle face detection on/off when mounting/unmounting.

In addition to expanding CustomizeConfiguration, this PR also makes the following changes:

  1. Centralizes toggling face detection on/off to the VideoFeed component. Also allows the parent of the VideoFeed component to trigger refreshes when desired, which not only refreshes the WebRTC stream but also re-toggles FaceDetection on.
    1. Also in VideoFeed, this PR keeps trying to resize the video until it succeeds. Because if the video is nested in many HTML elements, it may not have the parent size on the first event cycle, which is what it previously used to resize the video.
  2. Centralizes setting the moveToMouthActionGoal to the DetectingFaceSubcomponent, so the action goal is correctly set regardless of whether face detection is called from the main code or from the Settings Menu.
    1. Relatedly, this PR fixes a bug on the settings pages for BiteTransfer and Staging where they sent the empty action input to MoveToMouth.

Explain how this pull request was tested, including but not limited to the below checkmarks.

  • Pull this branch and ada_feeding#177, build, and start the code in real: python3 src/ada_feeding/start.py
  • Verify Staging Settings work:
    • Regardless of what page you go to the Staging Config settings from, verify it moves to staging when you load it and moves back when you click "Done"
      • Bite Selection
      • Bite Acquisition Check
      • Detecting Face
      • Bite Done
    • Teleop it, verify the parameters in the YAML file only update when you stop holding the button, and that the joint, EE position, and EE orientation parameters are saved.
    • Customize it to a staging configuration with a different fork orientation to the mouth.
    • Click MoveToMouth. Verify it succeeds, and after that the teleop part is disabled.
      • Verify that face detection is still enabled.
      • Verify that the fork maintains its orientation, and only executes a linear motion to the mouth.
    • Click MovetoStaging, and verify the teleop part gets re-enabled. Verify it moves to the customized staging configuration.
    • Repeat the above two with MoveAbovePlate.
    • Repeat the above two with MovetoResting.
    • Reset to default, verify that it updates the param file and immediately moves above the plate to the default configuration.
    • Refresh the page, verify the VideoFeed resizes appropriately (before it was not showing up upon page refresh).
    • Verify that parameters are set only once per update (look at logs to do so).
    • Create two presets with different staging configurations. In a new preset, reset to the first. Then reset to the second. Verify that it properly resets, and MoveToStaging is properly called (e.g., it's not an old version of the function that is frozen and called).
  • Test the AbovePlate customization, verify it still works as expected.
  • Test the Resting customization, verify it still works as expected.
  • Test Bite Transfer during regular execution of the app, verify it works, and that the correct MovetoMouth goal is passed (i.e., not an empty one).

Before creating a pull request

  • Format React code with npm run format
  • [N/A] Format Python code by running python3 -m black . in the top-level of this repository
  • Thoroughly test your code's functionality, including unintended uses.
  • Fully test the responsiveness of the feature as documented in the Responsiveness Testing Guidelines. If you deviate from those guidelines, document above why you deviated and what you did instead.
  • Consider the user flow between states that this feature introduces, consider different situations that might occur for the user, and ensure that there is no way for the user to get stuck in a loop.

Before merging a pull request

  • Squash all your commits into one (or Squash and Merge)

@amalnanavati amalnanavati merged commit b65a9ef into main May 6, 2024
4 checks passed
@amalnanavati amalnanavati deleted the amaln/staging_config_customization branch May 6, 2024 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant