hint
Browse files- gradio-web/config.py +7 -7
- gradio-web/note_content.py +168 -134
- gradio-web/ui_layout.py +2 -2
gradio-web/config.py
CHANGED
|
@@ -58,7 +58,7 @@ UI_TEXT = {
|
|
| 58 |
"select_keypoint_before_execute": "please click the keypoint selection image before execute!",
|
| 59 |
},
|
| 60 |
"actions": {
|
| 61 |
-
"keypoint_required_suffix": "
|
| 62 |
},
|
| 63 |
"errors": {
|
| 64 |
"load_missing_task": "Error loading task: missing current_task",
|
|
@@ -84,12 +84,12 @@ UI_ACTION_TEXT_OVERRIDES = {
|
|
| 84 |
"move backward-left": "move backward-left↗︎",
|
| 85 |
"move backward-right": "move backward-right↖︎",
|
| 86 |
},
|
| 87 |
-
"RouteStick": {
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
},
|
| 93 |
}
|
| 94 |
|
| 95 |
ROUTESTICK_OVERLAY_ACTION_TEXTS = [
|
|
|
|
| 58 |
"select_keypoint_before_execute": "please click the keypoint selection image before execute!",
|
| 59 |
},
|
| 60 |
"actions": {
|
| 61 |
+
"keypoint_required_suffix": "🎯",
|
| 62 |
},
|
| 63 |
"errors": {
|
| 64 |
"load_missing_task": "Error loading task: missing current_task",
|
|
|
|
| 84 |
"move backward-left": "move backward-left↗︎",
|
| 85 |
"move backward-right": "move backward-right↖︎",
|
| 86 |
},
|
| 87 |
+
# "RouteStick": {
|
| 88 |
+
# "move to the nearest left target by circling around the stick clockwise": "move left clockwise↘︎→↗︎ ◟→◞",
|
| 89 |
+
# "move to the nearest right target by circling around the stick clockwise": "move right clockwise↖︎←↙︎ ◟←◞",
|
| 90 |
+
# "move to the nearest left target by circling around the stick counterclockwise": "move left counterclockwise↗︎→↘︎ ◜→◝",
|
| 91 |
+
# "move to the nearest right target by circling around the stick counterclockwise": "move right counterclockwise↙︎←↖︎ ◜←◝",
|
| 92 |
+
# },
|
| 93 |
}
|
| 94 |
|
| 95 |
ROUTESTICK_OVERLAY_ACTION_TEXTS = [
|
gradio-web/note_content.py
CHANGED
|
@@ -2,10 +2,12 @@
|
|
| 2 |
Note content management module
|
| 3 |
Manages Coordinate Information and Task Hint content
|
| 4 |
"""
|
|
|
|
|
|
|
| 5 |
def get_coordinate_information():
|
| 6 |
"""
|
| 7 |
Get coordinate information content (Note 1)
|
| 8 |
-
|
| 9 |
Returns:
|
| 10 |
str: Coordinate information in Markdown format
|
| 11 |
"""
|
|
@@ -15,167 +17,199 @@ The coordinate system differs based on the camera perspective.
|
|
| 15 |
In the base camera view, the lateral axis is inverted relative to the robot: the right side of the camera frame corresponds to the robot's left side, and vice versa.
|
| 16 |
|
| 17 |
Conversely, the wrist camera view is fully aligned with the robot's motion frame. Directional movements are consistent, meaning 'right' in the camera view corresponds to the robot's right, and 'forward' implies forward movement
|
|
|
|
|
|
|
| 18 |
"""
|
| 19 |
|
| 20 |
|
| 21 |
def get_task_hint(env_id):
|
| 22 |
"""
|
| 23 |
Get task hint content based on environment ID (Note 2)
|
| 24 |
-
|
| 25 |
Args:
|
| 26 |
env_id (str): Environment ID, e.g., "VideoPlaceOrder", "PickXtimes", etc.
|
| 27 |
-
|
| 28 |
Returns:
|
| 29 |
str: Task hint in Markdown format
|
| 30 |
"""
|
| 31 |
# Return different hints based on env_id
|
| 32 |
# Order follows solve_3.5_parallel_multi_loop_v4.py DEFAULT_ENVS list
|
| 33 |
hints = {
|
| 34 |
-
"PickXtimes": """
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
"
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
"
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
"
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
}
|
| 161 |
-
|
| 162 |
# Normalize env_id to handle case-insensitive matching
|
| 163 |
# First try direct lookup
|
| 164 |
if env_id in hints:
|
| 165 |
return hints[env_id]
|
| 166 |
-
|
| 167 |
# Create a mapping from lowercase to standard format for case-insensitive lookup
|
| 168 |
# This handles cases where env_id might be passed as lowercase (e.g., "pickxtimes", "binfill")
|
| 169 |
env_id_lower_to_standard = {
|
| 170 |
key.lower(): key for key in hints.keys()
|
| 171 |
}
|
| 172 |
-
|
| 173 |
# Try case-insensitive lookup
|
| 174 |
if env_id:
|
| 175 |
env_id_lower = env_id.lower()
|
| 176 |
if env_id_lower in env_id_lower_to_standard:
|
| 177 |
standard_key = env_id_lower_to_standard[env_id_lower]
|
| 178 |
return hints[standard_key]
|
| 179 |
-
|
| 180 |
# Return default hint if not found
|
| 181 |
-
return """///
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
Note content management module
|
| 3 |
Manages Coordinate Information and Task Hint content
|
| 4 |
"""
|
| 5 |
+
|
| 6 |
+
|
| 7 |
def get_coordinate_information():
|
| 8 |
"""
|
| 9 |
Get coordinate information content (Note 1)
|
| 10 |
+
|
| 11 |
Returns:
|
| 12 |
str: Coordinate information in Markdown format
|
| 13 |
"""
|
|
|
|
| 17 |
In the base camera view, the lateral axis is inverted relative to the robot: the right side of the camera frame corresponds to the robot's left side, and vice versa.
|
| 18 |
|
| 19 |
Conversely, the wrist camera view is fully aligned with the robot's motion frame. Directional movements are consistent, meaning 'right' in the camera view corresponds to the robot's right, and 'forward' implies forward movement
|
| 20 |
+
|
| 21 |
+
select "Ground Truth Action" if you need help, and "Execute" it
|
| 22 |
"""
|
| 23 |
|
| 24 |
|
| 25 |
def get_task_hint(env_id):
|
| 26 |
"""
|
| 27 |
Get task hint content based on environment ID (Note 2)
|
| 28 |
+
|
| 29 |
Args:
|
| 30 |
env_id (str): Environment ID, e.g., "VideoPlaceOrder", "PickXtimes", etc.
|
| 31 |
+
|
| 32 |
Returns:
|
| 33 |
str: Task hint in Markdown format
|
| 34 |
"""
|
| 35 |
# Return different hints based on env_id
|
| 36 |
# Order follows solve_3.5_parallel_multi_loop_v4.py DEFAULT_ENVS list
|
| 37 |
hints = {
|
| 38 |
+
"PickXtimes": """\
|
| 39 |
+
Suppose the task goal is to pick up red cubes for two times, a typical action sequence could be:
|
| 40 |
+
1. Pick up the cube (use mouse click to select the cube with the correct color)
|
| 41 |
+
2. Place the cube onto the target.
|
| 42 |
+
3. Pick up the cube (use mouse click to select the cube with the correct color)
|
| 43 |
+
4. Place the cube onto the target.
|
| 44 |
+
5. Press the button to stop.
|
| 45 |
+
Select "Ground Truth Action" if you need help, and "Execute" it
|
| 46 |
+
""",
|
| 47 |
+
|
| 48 |
+
"StopCube": """\
|
| 49 |
+
Suppose the task goal is to stop the cube on the target for three times, a typical action sequence could be:
|
| 50 |
+
1. Move to the top of the button to prepare
|
| 51 |
+
2. Remain static (it will execute for a fixed time duration, you need to count the times the cube has passed the target)
|
| 52 |
+
3. Remain static
|
| 53 |
+
4. Remain static
|
| 54 |
+
5. Remain static (Suppose you feel the cube is about to reach the target for the expected number of times, you should press the button to stop the cube directly)
|
| 55 |
+
6. Press the button to stop.
|
| 56 |
+
Select "Ground Truth Action" if you need help, and "Execute" it
|
| 57 |
+
""",
|
| 58 |
+
|
| 59 |
+
"SwingXtimes": """\
|
| 60 |
+
Suppose the task goal is to swing the back and forth for two times, a typical action sequence could be:
|
| 61 |
+
1. Pick up the cube (use mouse click to select the cube with the correct color)
|
| 62 |
+
2. Move to the top of the target (use mouse click to select the right-side target)
|
| 63 |
+
3. Move to the top of the target (use mouse click to select the left-side target)
|
| 64 |
+
4. Move to the top of the target (use mouse click to select the right-side target)
|
| 65 |
+
5. Move to the top of the target (use mouse click to select the left-side target)
|
| 66 |
+
6. Put the cube onto the table
|
| 67 |
+
7. Press the button to stop.
|
| 68 |
+
Spatial directions (e.g., left, right) follow the robot base coordinate frame
|
| 69 |
+
Select "Ground Truth Action" if you need help, and "Execute" it
|
| 70 |
+
""",
|
| 71 |
+
|
| 72 |
+
"BinFill": """\
|
| 73 |
+
Suppose the task goal is to pick two red cubes in the bin, a typical action sequence could be:
|
| 74 |
+
1. Pick up the cube (use mouse click to select the cube with the correct color)
|
| 75 |
+
2. Put it into the bin.
|
| 76 |
+
3. Pick up the cube (use mouse click to select the cube with the correct color)
|
| 77 |
+
4. Put it into the bin.
|
| 78 |
+
5. Press the button to stop.
|
| 79 |
+
Select "Ground Truth Action" if you need help, and "Execute" it
|
| 80 |
+
""",
|
| 81 |
+
|
| 82 |
+
"VideoUnmaskSwap": """\
|
| 83 |
+
Watch the video carefully. Cubes will be hidden by containers, and you need to memorize the color of the cube inside each one.
|
| 84 |
+
You need to track the containers since they swap positions!
|
| 85 |
+
A typical action sequence could be:
|
| 86 |
+
1. Pick up the container (use mouse click to select the container)
|
| 87 |
+
2. Drop the container down.
|
| 88 |
+
Pick up another container if the task goal is to find two containers.
|
| 89 |
+
Select "Ground Truth Action" if you need help, and "Execute" it
|
| 90 |
+
""",
|
| 91 |
+
|
| 92 |
+
"VideoUnmask": """\
|
| 93 |
+
Watch the video carefully. Cubes will be hidden by containers, and you need to memorize the color of the cube inside each one.
|
| 94 |
+
A typical action sequence could be:
|
| 95 |
+
1. Pick up the container (use mouse click to select the container)
|
| 96 |
+
2. Drop the container down.
|
| 97 |
+
Pick up another container if the task goal is to find two containers.
|
| 98 |
+
Select "Ground Truth Action" if you need help, and "Execute" it
|
| 99 |
+
""",
|
| 100 |
+
|
| 101 |
+
"ButtonUnmaskSwap": """\
|
| 102 |
+
Press the buttons sequentially. While pressing the buttons, the cubes will be hidden inside the containers, and you need to memorize the color of the cube inside each one.
|
| 103 |
+
You need to track the containers since they swap positions!
|
| 104 |
+
A typical action sequence could be:
|
| 105 |
+
1. Press the first button.
|
| 106 |
+
2. Press the second button.
|
| 107 |
+
3. Pick up the container (use mouse click to select the container)
|
| 108 |
+
4. Drop the container down.
|
| 109 |
+
Pick up another container if the task goal is to find two containers.
|
| 110 |
+
Select "Ground Truth Action" if you need help, and "Execute" it
|
| 111 |
+
""",
|
| 112 |
+
|
| 113 |
+
"ButtonUnmask": """\
|
| 114 |
+
Press the buttons sequentially. While pressing the buttons, the cubes will be hidden inside the containers, and you need to memorize the color of the cube inside each one.
|
| 115 |
+
A typical action sequence could be:
|
| 116 |
+
1. Press the button.
|
| 117 |
+
2. Pick up the container (use mouse click to select the container)
|
| 118 |
+
3. Drop the container down.
|
| 119 |
+
Pick up another container if the task goal is to find two containers.
|
| 120 |
+
Select "Ground Truth Action" if you need help, and "Execute" it
|
| 121 |
+
""",
|
| 122 |
+
|
| 123 |
+
"VideoRepick": """\
|
| 124 |
+
Remember the cube that has been picked up before, and then pick it up again. The cubes might be swapped positions.
|
| 125 |
+
A typical action sequence could be:
|
| 126 |
+
1. Pick up the cube (use mouse click to select the correct cube with the correct color)
|
| 127 |
+
2. Put the cube down on the table.
|
| 128 |
+
(Repeat 1 and 2 for the expected number of times)
|
| 129 |
+
3. Press the button to stop.
|
| 130 |
+
Select "Ground Truth Action" if you need help, and "Execute" it
|
| 131 |
+
""",
|
| 132 |
+
|
| 133 |
+
"VideoPlaceButton": """\
|
| 134 |
+
The video shows a robot placing a cube on different targets and pressing the button in a sequence. The targets may change positions.
|
| 135 |
+
A typical action sequence could be:
|
| 136 |
+
1. Pick up the cube (use mouse click to select the correct cube with the correct color)
|
| 137 |
+
2. Put the cube down on the target (use mouse click to select the target)
|
| 138 |
+
Select "Ground Truth Action" if you need help, and "Execute" it
|
| 139 |
+
""",
|
| 140 |
+
|
| 141 |
+
"VideoPlaceOrder": """\
|
| 142 |
+
The video shows a robot placing a cube on different targets and pressing the button in a sequence. The targets may change positions.
|
| 143 |
+
A typical action sequence could be:
|
| 144 |
+
1. Pick up the cube (use mouse click to select the correct cube with the correct color)
|
| 145 |
+
2. Put the cube down on the target (use mouse click to select the target)
|
| 146 |
+
Select "Ground Truth Action" if you need help, and "Execute" it
|
| 147 |
+
""",
|
| 148 |
+
|
| 149 |
+
"PickHighlight": """\
|
| 150 |
+
While the robot is pressing the button, some cubes will be highlighted with white discs on the table. Remember them.
|
| 151 |
+
A typical action sequence could be:
|
| 152 |
+
1. Press the button.
|
| 153 |
+
2. Pick up the cube (use mouse click to select the correct cube with the correct color)
|
| 154 |
+
3. Put the cube down on the table.
|
| 155 |
+
(Repeat 2 and 3 for with the rest of highlighted cubes)
|
| 156 |
+
Select "Ground Truth Action" if you need help, and "Execute" it
|
| 157 |
+
""",
|
| 158 |
+
|
| 159 |
+
"InsertPeg": """\
|
| 160 |
+
The video shows a robot picking up and inserting a peg into a hole.
|
| 161 |
+
The peg consists of two parts with different colors; you need to pick up the correct part of the peg and insert it into the hole from the correct side.
|
| 162 |
+
A typical action sequence could be:
|
| 163 |
+
1. Pick up the peg (use mouse click to select the correct peg and the correct part of the peg)
|
| 164 |
+
2. Insert the peg into the hole on the left side
|
| 165 |
+
Spatial directions (e.g., left, right) follow the robot base coordinate frame.
|
| 166 |
+
Select "Ground Truth Action" if you need help, and "Execute" it
|
| 167 |
+
""",
|
| 168 |
+
|
| 169 |
+
"MoveCube": """\
|
| 170 |
+
The video shows a robot moving a cube to a target using different methods.
|
| 171 |
+
The robot might (1) pick up and place the cube, (2) push it with the gripper, or (3) hook it using a peg.
|
| 172 |
+
Remember the way the robot moves the cube and choose the correct action to execute.
|
| 173 |
+
Select "Ground Truth Action" if you need help, and "Execute" it
|
| 174 |
+
""",
|
| 175 |
+
|
| 176 |
+
"PatternLock": """\
|
| 177 |
+
The video shows a robot tracing a pattern with a stick.
|
| 178 |
+
Remember the movements and reproduce them by choosing correct actions.
|
| 179 |
+
Spatial directions (e.g., left, right, forward, backward) follow the robot base coordinate frame.
|
| 180 |
+
Select "Ground Truth Action" if you need help, and "Execute" it
|
| 181 |
+
""",
|
| 182 |
+
|
| 183 |
+
"RouteStick": """\
|
| 184 |
+
The video shows a robot navigating from one target to another by circling around a stick.
|
| 185 |
+
The movement can be clockwise or counter-clockwise, and the stick may be on the left or right side.
|
| 186 |
+
Remember the sequence of actions and choose the correct action to execute.
|
| 187 |
+
Spatial directions (e.g., left, right) follow the robot base coordinate frame.
|
| 188 |
+
Select "Ground Truth Action" if you need help, and "Execute" it
|
| 189 |
+
""",
|
| 190 |
+
|
| 191 |
}
|
| 192 |
+
|
| 193 |
# Normalize env_id to handle case-insensitive matching
|
| 194 |
# First try direct lookup
|
| 195 |
if env_id in hints:
|
| 196 |
return hints[env_id]
|
| 197 |
+
|
| 198 |
# Create a mapping from lowercase to standard format for case-insensitive lookup
|
| 199 |
# This handles cases where env_id might be passed as lowercase (e.g., "pickxtimes", "binfill")
|
| 200 |
env_id_lower_to_standard = {
|
| 201 |
key.lower(): key for key in hints.keys()
|
| 202 |
}
|
| 203 |
+
|
| 204 |
# Try case-insensitive lookup
|
| 205 |
if env_id:
|
| 206 |
env_id_lower = env_id.lower()
|
| 207 |
if env_id_lower in env_id_lower_to_standard:
|
| 208 |
standard_key = env_id_lower_to_standard[env_id_lower]
|
| 209 |
return hints[standard_key]
|
| 210 |
+
|
| 211 |
# Return default hint if not found
|
| 212 |
+
return """///
|
| 213 |
+
|
| 214 |
+
select "Ground Truth Action" if you need help, and "Execute" it
|
| 215 |
+
"""
|
gradio-web/ui_layout.py
CHANGED
|
@@ -449,7 +449,7 @@ def create_ui_blocks():
|
|
| 449 |
with gr.Blocks(title="Oracle Planner Interface") as demo:
|
| 450 |
demo.css = CSS
|
| 451 |
|
| 452 |
-
gr.Markdown("## RoboMME
|
| 453 |
with gr.Row():
|
| 454 |
with gr.Column(scale=1):
|
| 455 |
header_task_box = gr.Dropdown(
|
|
@@ -463,7 +463,7 @@ def create_ui_blocks():
|
|
| 463 |
with gr.Column(scale=2):
|
| 464 |
header_goal_box = gr.Textbox(
|
| 465 |
value=render_header_goal(""),
|
| 466 |
-
label="Goal 🎯",
|
| 467 |
show_label=True,
|
| 468 |
interactive=False,
|
| 469 |
lines=1,
|
|
|
|
| 449 |
with gr.Blocks(title="Oracle Planner Interface") as demo:
|
| 450 |
demo.css = CSS
|
| 451 |
|
| 452 |
+
gr.Markdown("## RoboMME Interactive Demo 🚀🚀🚀", elem_id="header_title")
|
| 453 |
with gr.Row():
|
| 454 |
with gr.Column(scale=1):
|
| 455 |
header_task_box = gr.Dropdown(
|
|
|
|
| 463 |
with gr.Column(scale=2):
|
| 464 |
header_goal_box = gr.Textbox(
|
| 465 |
value=render_header_goal(""),
|
| 466 |
+
label="Task Goal 🎯",
|
| 467 |
show_label=True,
|
| 468 |
interactive=False,
|
| 469 |
lines=1,
|