-
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
Bite Selection UI revamp #44
Conversation
…lrobotics/feeding_web_interface into atharvak/biteselection-ui-revamp
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.
Overall this looks good and is nice and functional! Good work :)
Many of my in-line comments are ++ things that don't need to be addressed right now. I'd suggest you move forward with the following steps:
- Add the Router and revert main app functionality back to what it was.
- Address
eslint
andprettier
issues. Given how many have accumulated, I think it would be easier if you address them now before moving onto the other components. That way, you'll know how to write your code for those components in a way that avoids linting errors. - Implement the Name Display component.
- Add the ability to move between these "mock-ups" upon button press. As you suggested in the meeting, I would fully use the router, e.g.,
localhost:3000/bite_selection_mockups/all_foods_segmented
so you don't need to modify global state. - Add the mask display mock-up.
- Implement the ++ things I mentioned in the in-line comments.
* Callback function for when the user indicates that they want to move the | ||
* robot to locate the plate. | ||
*/ | ||
function locatePlateClicked() { |
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.
Not crucial since these are mock-ups, but FYI I have been reading more into React Hooks and I think the best practice is to use useCallback
for all functions that we don't want to re-define every re-render. So ideally this and all the below functions should be within useCallback
e.g.,
const locatePlateClicked = useCallback(() => {
console.log('doneEatingClicked')
setMealState(MEAL_STATE.R_StowingArm)
}, [setMealState])
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.
Thanks! I will read more into this! For the sake of this mockup, I will keep it as is but if any of these components get through to the next stage, I will make sure to change it to reflect this new format of React Hooks.
feedingwebapp/src/Pages/Home/MealStates/BiteSelectionButtonOverlay.jsx
Outdated
Show resolved
Hide resolved
feedingwebapp/src/Pages/Home/MealStates/BiteSelectionButtonOverlay.jsx
Outdated
Show resolved
Hide resolved
feedingwebapp/src/Pages/Home/MealStates/BiteSelectionButtonOverlay.jsx
Outdated
Show resolved
Hide resolved
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.
Functionality-wise both "Button Overlay" and "Buttons with Names" look good.
feedingwebapp/src/App.jsx
Outdated
@@ -69,6 +72,30 @@ function App() { | |||
</ROS> | |||
} | |||
/> | |||
<Route exact path='/test_bite-selection-ui' element={ |
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.
The combination of underscores and hyphens is confusing -- stick to one.
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 intentional! I assume "test" is to indicate that this route is for testing and anything that comes after is just a descriptive name for the particular case. In your case, where you already have the ros route, this issue doesn't arise because it is just a single word. But, I feel that it might be better to have the description and name separated. Let me know if you have strong thoughts against this.
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.
Hmm I get what you're saying, but we can still have "test" be the first word regardless of whether it is followed by a hyphen or underscore, and that would still indicate that this route is for testing, and anything that comes after it can still be the descriptive name (regardless of whether it has hyphens or underscores).
So I still think everything should be consistent. Either change test_ros
to test-ros
and make these routes test-bite-selection-ui...
or make these routes test_bite_selection_ui
-- I'm fine with either option.
feedingwebapp/src/Pages/Home/BiteSelectionUIStates/ImageWithButtonOverlay.jsx
Outdated
Show resolved
Hide resolved
feedingwebapp/src/Pages/Home/BiteSelectionUIStates/BiteSelectionName.jsx
Outdated
Show resolved
Hide resolved
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.
Tested it and functionality looks good! Good work :)
I am approving (all the changes I requested in the comments are small), but before merging you should do the following:
- Merge
main
in, resolve any merge conflicts. - Address PR comments. For the comments that are not for this "mock-up" PR but should be addressed before implementing the final version, please leave them unresolved so we can quickly look back at those when we are implementing the final version.
- Thoroughly test it (since the code may have changed slightly after merging
main
in). - Ensure the checks all pass. (Note that the checks have not run so far on your branch due to the merge conflict, they should run after you merge main in)
Squash and Merge
this PR intomain
.
Good work :)
feedingwebapp/src/Pages/Home/BiteSelectionUIStates/BiteSelectionButtonOverlay.jsx
Outdated
Show resolved
Hide resolved
feedingwebapp/src/Pages/Home/BiteSelectionUIStates/BiteSelectionButtonOverlay.jsx
Show resolved
Hide resolved
feedingwebapp/src/Pages/Home/BiteSelectionUIStates/BiteSelectionPointMask.jsx
Outdated
Show resolved
Hide resolved
feedingwebapp/src/Pages/Home/BiteSelectionUIStates/ImageWithButtonName.jsx
Outdated
Show resolved
Hide resolved
feedingwebapp/src/Pages/Home/BiteSelectionUIStates/ImageWithButtonName.jsx
Show resolved
Hide resolved
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.
No need to do this in this PR, but you'll see that the new main
now has a folder src/buttons
that contains all custom button Components. For whichever buttons we actually use in the app, we should move them to that folder.
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.
acknowledged! will keep this open so that we remember!
})} | ||
</Row> | ||
{foodMasksToDisplay} | ||
<Button |
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.
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.
Yes, I recommend we keep it for this one but actually here are thoughts on that regard:
I completely agree with you! it is kind of weird that the button shape changes. But, originally i wanted the color to become light reddish to indicate it was selected. But, the problem is that since there are images inside this button, the red doesn't get shown. So, we need to play with the padding/borders to be able to show the red. Something to play around for when we actually implement!
feedingwebapp/src/Pages/Home/BiteSelectionUIStates/BiteSelectionName.jsx
Outdated
Show resolved
Hide resolved
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.
Tested it and functionality looks good! Good work :)
I am approving (all the changes I requested in the comments are small), but before merging you should do the following:
- Merge
main
in, resolve any merge conflicts. - Address PR comments. For the comments that are not for this "mock-up" PR but should be addressed before implementing the final version, please leave them unresolved so we can quickly look back at those when we are implementing the final version.
- Thoroughly test it (since the code may have changed slightly after merging
main
in). - Ensure the checks all pass. (Note that the checks have not run so far on your branch due to the merge conflict, they should run after you merge main in)
Squash and Merge
this PR intomain
.
Good work :)
img | ||
})} | ||
</Row> | ||
{foodMasksToDisplay} |
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.
@atharva-kashyap this line is where the bug was introduced. I'm not sure why the bug didn't appear on Chrome, but anyway I'll be removing this line in my next push to main
Relevant GitHub Issue: #17
Please navigate to the following routes after starting the app (Each route corresponds to each mockup):
test_bite-selection-ui/button_overlay_selection
: User is allowed to click on buttons that are overlayed on top of the image/test_bite-selection-ui/point_mask_selection
: User has the ability to select a point on the image and is provided with three mask options around that point, out of which the user gets to choose one/test_bite-selection-ui/food_name_selection
: User is allowed to choose a food item based on its nameYou don't have to manually navigate to these routes. You only need to navigate to one of them and once you explore that page, you may simply press the "Next" button below and it will navigate to the next route.
Explain how this pull request was tested, including but not limited to the below checkmarks.
All possible user interactions from the pages developed have been tested. None of the navigation buttons at the top (Home/Video/etc.) have been disabled. However, the "Locate Plate" and "Done Eating" buttons have been disabled.
Before creating a pull request
npm run format
python3 -m black .
in the top-level of this repositoryBefore merging a pull request
Squash and Merge
)