Update app.py
Browse files
app.py
CHANGED
|
@@ -86,17 +86,24 @@ with gr.Blocks(title="Franka Arm Control with 7 DoF and Gripper Options") as dem
|
|
| 86 |
gripper_feedback = gr.Textbox(label="Gripper Status", interactive=False)
|
| 87 |
gripper_selector.change(fn=switch_gripper, inputs=gripper_selector, outputs=gripper_feedback)
|
| 88 |
|
| 89 |
-
# 7 DoF sliders
|
| 90 |
-
joint_sliders = [
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
|
|
|
| 93 |
with gr.Row():
|
| 94 |
img_output = gr.Image(type="filepath", label="Simulation View")
|
| 95 |
text_output = gr.Textbox(label="Joint States")
|
| 96 |
|
| 97 |
-
#
|
| 98 |
def live_update(*vals):
|
| 99 |
-
joints = list(vals[:-1])
|
| 100 |
grip = vals[-1]
|
| 101 |
return render_sim(joints, grip)
|
| 102 |
|
|
@@ -109,4 +116,3 @@ with gr.Blocks(title="Franka Arm Control with 7 DoF and Gripper Options") as dem
|
|
| 109 |
|
| 110 |
gr.Button("🔄 Reset Robot").click(fn=reset, inputs=[], outputs=[img_output, text_output])
|
| 111 |
|
| 112 |
-
demo.launch()
|
|
|
|
| 86 |
gripper_feedback = gr.Textbox(label="Gripper Status", interactive=False)
|
| 87 |
gripper_selector.change(fn=switch_gripper, inputs=gripper_selector, outputs=gripper_feedback)
|
| 88 |
|
| 89 |
+
# 7 DoF sliders arranged in two rows
|
| 90 |
+
joint_sliders = []
|
| 91 |
+
with gr.Row():
|
| 92 |
+
for i in range(4):
|
| 93 |
+
joint_sliders.append(gr.Slider(-3.14, 3.14, value=0, label=f"Joint {i+1}"))
|
| 94 |
+
with gr.Row():
|
| 95 |
+
for i in range(4, 7):
|
| 96 |
+
joint_sliders.append(gr.Slider(-3.14, 3.14, value=0, label=f"Joint {i+1}"))
|
| 97 |
+
gripper = gr.Slider(0.0, 0.04, value=0.02, step=0.001, label="Gripper Opening")
|
| 98 |
|
| 99 |
+
# Outputs
|
| 100 |
with gr.Row():
|
| 101 |
img_output = gr.Image(type="filepath", label="Simulation View")
|
| 102 |
text_output = gr.Textbox(label="Joint States")
|
| 103 |
|
| 104 |
+
# Live update
|
| 105 |
def live_update(*vals):
|
| 106 |
+
joints = list(vals[:-1])
|
| 107 |
grip = vals[-1]
|
| 108 |
return render_sim(joints, grip)
|
| 109 |
|
|
|
|
| 116 |
|
| 117 |
gr.Button("🔄 Reset Robot").click(fn=reset, inputs=[], outputs=[img_output, text_output])
|
| 118 |
|
|
|