Skip to content

Commit

Permalink
added window for FoF in in-front of face
Browse files Browse the repository at this point in the history
  • Loading branch information
atharva-kashyap committed Sep 25, 2023
1 parent 3efbd45 commit 213f8f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion feedingwebapp/src/Pages/GlobalState.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export const useGlobalState = create(
setFoodOnFork: (foodOnFork) =>
set(() => ({
foodOnFork: foodOnFork
})),
}))
}),
{ name: 'ada_web_app_global_state' }
)
Expand Down
8 changes: 4 additions & 4 deletions feedingwebapp/src/Pages/Home/MealStates/BiteDone.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const BiteDone = () => {
const ros = useRef(useROS().ros)
let window = []
const food_on_fork_callback = useCallback((message) => {

Check warning on line 42 in feedingwebapp/src/Pages/Home/MealStates/BiteDone.jsx

View workflow job for this annotation

GitHub Actions / React.js Format & Compilation Test (16.x)

React Hook useCallback does nothing when called with only one argument. Did you forget to pass an array of dependencies?

Check warning on line 42 in feedingwebapp/src/Pages/Home/MealStates/BiteDone.jsx

View workflow job for this annotation

GitHub Actions / React.js Format & Compilation Test (18.x)

React Hook useCallback does nothing when called with only one argument. Did you forget to pass an array of dependencies?

Check warning on line 42 in feedingwebapp/src/Pages/Home/MealStates/BiteDone.jsx

View workflow job for this annotation

GitHub Actions / React.js Format & Compilation Test (19.x)

React Hook useCallback does nothing when called with only one argument. Did you forget to pass an array of dependencies?

Check warning on line 42 in feedingwebapp/src/Pages/Home/MealStates/BiteDone.jsx

View workflow job for this annotation

GitHub Actions / React.js Format & Compilation Test (20.x)

React Hook useCallback does nothing when called with only one argument. Did you forget to pass an array of dependencies?
if (window.size == FOOD_ON_FORK_WINDOW_SIZE) {
if (window.size === FOOD_ON_FORK_WINDOW_SIZE) {
window.shift()
}
window.push(Number(message.data))
Expand All @@ -50,23 +50,23 @@ const BiteDone = () => {
countLessThanRange++
}
}
if (window.size == FOOD_ON_FORK_WINDOW_SIZE && countLessThanRange >= 0.75 * FOOD_ON_FORK_WINDOW_SIZE) {
if (window.size === FOOD_ON_FORK_WINDOW_SIZE && countLessThanRange >= 0.75 * FOOD_ON_FORK_WINDOW_SIZE) {
console.log('moving above plate')
moveAbovePlate()
return
}
})

useEffect(() => {
if (foodOnFork == "Yes") {
if (foodOnFork === 'Yes') {
const food_on_fork_topic = subscribeToROSTopic(ros.current, FOOD_ON_FORK_TOPIC.name, FOOD_ON_FORK_TOPIC.type, food_on_fork_callback)

return () => {
console.log('unscubscribed from FoF')
unsubscribeFromROSTopic(food_on_fork_topic)
}
}
}, [setMealState, food_on_fork_callback])
}, [setMealState, food_on_fork_callback, foodOnFork])

/**
* Callback function for when the user wants to move above plate.
Expand Down

0 comments on commit 213f8f3

Please sign in to comment.