Skip to content

Commit 1d295fc

Browse files
authored
Allow users to customize the stow configuration (#141)
1 parent 2dc2dfe commit 1d295fc

File tree

4 files changed

+46
-10
lines changed

4 files changed

+46
-10
lines changed

feedingwebapp/src/Pages/Constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export const STAGING_PARAM_ORIENTATION = 'MoveFromMouth.tree_kwargs.staging_conf
138138
export const RESTING_PARAM_JOINTS_1 = 'AcquireFood.tree_kwargs.resting_joint_positions'
139139
// TODO: We may need to remove the orientation constraint from the below action.
140140
export const RESTING_PARAM_JOINTS_2 = 'MoveToRestingPosition.tree_kwargs.goal_configuration'
141+
export const STOW_PARAM_JOINTS = 'MoveToStowLocation.tree_kwargs.joint_positions'
141142

142143
// Parameters for modifying the force threshold
143144
export const FORCE_THRESHOLD_PARAM = 'wrench_threshold.fMag'

feedingwebapp/src/Pages/GlobalState.jsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,24 @@ export { NON_MOVING_STATES }
7676
/**
7777
* SETTINGS_STATE controls which settings page to display.
7878
* - MAIN: The main page, with options to navigate to the other pages.
79-
* - BITE_TRANSFER: The bite transfer page, where the user can configure
80-
* parameters for bite transfer.
79+
* - DISTANCE_TO_MOUTH: Allow the user to customize how close the robot gets
80+
* to their mouth.
81+
* - ABOVE_PLATE: Allow the user to customize how high the fixed above plate
82+
* arm configuration.
83+
* - RESTING_CONFIGURATION: Allow the user to customize the fixed resting
84+
* arm configuration.
85+
* - STAGING_CONFIGURATION: Allow the user to customize the fixed staging
86+
* arm configuration.
87+
* - STOW_CONFIGURATION: Allow the user to customize the fixed stow arm
88+
* configuration.
8189
*/
8290
export const SETTINGS_STATE = {
8391
MAIN: 'MAIN',
84-
BITE_TRANSFER: 'BITE_TRANSFER',
92+
DISTANCE_TO_MOUTH: 'DISTANCE_TO_MOUTH',
8593
ABOVE_PLATE: 'ABOVE_PLATE',
8694
RESTING_CONFIGURATION: 'RESTING_CONFIGURATION',
87-
STAGING_CONFIGURATION: 'STAGING_CONFIGURATION'
95+
STAGING_CONFIGURATION: 'STAGING_CONFIGURATION',
96+
STOW_CONFIGURATION: 'STOW_CONFIGURATION'
8897
}
8998

9099
// The name of the default parameter namespace

feedingwebapp/src/Pages/Settings/Main.jsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,14 @@ const Main = () => {
158158
let moveAbovePlateConfigurationImage = MOVING_STATE_ICON_DICT[MEAL_STATE.R_MovingAbovePlate]
159159
let moveToRestingConfigurationImage = MOVING_STATE_ICON_DICT[MEAL_STATE.R_MovingToRestingPosition]
160160
let moveToStagingConfigurationImage = MOVING_STATE_ICON_DICT[MEAL_STATE.R_MovingToStagingConfiguration]
161+
let moveToStowConfigurationImage = MOVING_STATE_ICON_DICT[MEAL_STATE.R_StowingArm]
161162

162163
// Configure the different options in the settings menu
163164
let settingsConfig = [
164165
{
165-
title: 'Bite Transfer',
166+
title: 'Distance to Mouth',
166167
icon: moveToMouthConfigurationImage,
167-
onClick: () => onClickSettingsPage(SETTINGS_STATE.BITE_TRANSFER)
168+
onClick: () => onClickSettingsPage(SETTINGS_STATE.DISTANCE_TO_MOUTH)
168169
},
169170
{
170171
title: 'Above Plate',
@@ -180,6 +181,11 @@ const Main = () => {
180181
title: 'Staging Position',
181182
icon: moveToStagingConfigurationImage,
182183
onClick: () => onClickSettingsPage(SETTINGS_STATE.STAGING_CONFIGURATION)
184+
},
185+
{
186+
title: 'Stow Position',
187+
icon: moveToStowConfigurationImage,
188+
onClick: () => onClickSettingsPage(SETTINGS_STATE.STOW_CONFIGURATION)
183189
}
184190
]
185191

@@ -239,7 +245,7 @@ const Main = () => {
239245
<Button
240246
variant='outline-dark'
241247
style={{
242-
fontSize: '30px',
248+
fontSize: '25px',
243249
display: 'flex',
244250
flexDirection: 'row',
245251
justifyContent: 'center',

feedingwebapp/src/Pages/Settings/Settings.jsx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import {
1919
RESTING_PARAM_JOINTS_2,
2020
STAGING_PARAM_JOINTS,
2121
STAGING_PARAM_ORIENTATION,
22-
STAGING_PARAM_POSITION
22+
STAGING_PARAM_POSITION,
23+
STOW_PARAM_JOINTS
2324
} from '../Constants'
2425

2526
/**
@@ -34,13 +35,14 @@ const Settings = (props) => {
3435
const abovePlateParamNames = useMemo(() => [ABOVE_PLATE_PARAM_JOINTS], [])
3536
const restingParamNames = useMemo(() => [RESTING_PARAM_JOINTS_1, RESTING_PARAM_JOINTS_2], [])
3637
const stagingParamNames = useMemo(() => [STAGING_PARAM_JOINTS, STAGING_PARAM_POSITION, STAGING_PARAM_ORIENTATION], [])
38+
const stowParamNames = useMemo(() => [STOW_PARAM_JOINTS], [])
3739

3840
const getComponentBySettingsState = useCallback(() => {
3941
console.log('getComponentBySettingsState', settingsState)
4042
switch (settingsState) {
4143
case SETTINGS_STATE.MAIN:
4244
return <Main />
43-
case SETTINGS_STATE.BITE_TRANSFER:
45+
case SETTINGS_STATE.DISTANCE_TO_MOUTH:
4446
return <BiteTransfer webrtcURL={props.webrtcURL} />
4547
case SETTINGS_STATE.ABOVE_PLATE:
4648
return (
@@ -118,11 +120,29 @@ const Settings = (props) => {
118120
webrtcURL={props.webrtcURL}
119121
/>
120122
)
123+
case SETTINGS_STATE.STOW_CONFIGURATION:
124+
return (
125+
<CustomizeConfiguration
126+
startingMealState={MEAL_STATE.R_StowingArm}
127+
paramNames={stowParamNames}
128+
getEndEffectorPose={false}
129+
getParamValues={[getJointPositionsFromRobotStateResponse]}
130+
configurationName='Stow Position'
131+
buttonName='Stow Arm'
132+
otherButtonConfigs={[
133+
{
134+
name: 'Move Above Plate',
135+
mealState: MEAL_STATE.R_MovingAbovePlate
136+
}
137+
]}
138+
webrtcURL={props.webrtcURL}
139+
/>
140+
)
121141
default:
122142
console.log('Invalid settings state', settingsState)
123143
return <Main />
124144
}
125-
}, [abovePlateParamNames, restingParamNames, stagingParamNames, props.webrtcURL, settingsState])
145+
}, [abovePlateParamNames, restingParamNames, stagingParamNames, stowParamNames, props.webrtcURL, settingsState])
126146

127147
// Render the component
128148
return (

0 commit comments

Comments
 (0)