Add Docstring the simulate_and_render function
Browse files
app.py
CHANGED
|
@@ -4,16 +4,33 @@ os.environ["MUJOCO_GL"] = "osmesa" # or "egl" if you switch to EGL support
|
|
| 4 |
import gradio as gr
|
| 5 |
from tray_sim import run_tray_simulation
|
| 6 |
|
| 7 |
-
def simulate_and_render(
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
gif_path, stability_flags, physics_state, llm_friendly_output, json_path = run_tray_simulation(
|
| 11 |
seed=seed,
|
| 12 |
azimuth=azimuth,
|
| 13 |
elevation=elevation,
|
| 14 |
distance=distance
|
| 15 |
)
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
print("Physics State: ", physics_state)
|
| 18 |
print("LLM Output: ", llm_friendly_output)
|
| 19 |
print("JSON Path: ", json_path)
|
|
|
|
| 4 |
import gradio as gr
|
| 5 |
from tray_sim import run_tray_simulation
|
| 6 |
|
| 7 |
+
def simulate_and_render(
|
| 8 |
+
seed: int,
|
| 9 |
+
azimuth: float = 35,
|
| 10 |
+
elevation: float = -20,
|
| 11 |
+
distance: float = 1.0
|
| 12 |
+
):
|
| 13 |
+
"""
|
| 14 |
+
Runs a TraySim simulation with the specified camera parameters and renders the result.
|
| 15 |
+
|
| 16 |
+
Parameters:
|
| 17 |
+
seed (int): Random seed for simulation initialization, affects object placement and dynamics.
|
| 18 |
+
azimuth (float, optional): Horizontal camera angle in degrees. Default is 35.
|
| 19 |
+
elevation (float, optional): Vertical camera angle in degrees. Default is -20.
|
| 20 |
+
distance (float, optional): Distance of the camera from the scene. Default is 1.0.
|
| 21 |
+
|
| 22 |
+
Returns:
|
| 23 |
+
str: Path to the rendered GIF file showing the simulation from the specified viewpoint.
|
| 24 |
+
"""
|
| 25 |
gif_path, stability_flags, physics_state, llm_friendly_output, json_path = run_tray_simulation(
|
| 26 |
seed=seed,
|
| 27 |
azimuth=azimuth,
|
| 28 |
elevation=elevation,
|
| 29 |
distance=distance
|
| 30 |
)
|
| 31 |
+
|
| 32 |
+
# Optional debug
|
| 33 |
+
print("Stability: ", stability_flags)
|
| 34 |
print("Physics State: ", physics_state)
|
| 35 |
print("LLM Output: ", llm_friendly_output)
|
| 36 |
print("JSON Path: ", json_path)
|