ADD: multi bouncing ball
Browse files
dataset/multi_bb/multi_bb_2025-11-18_16-14-38.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8f0f89ba197dd4dbae2a1ba6dcee2dc0cfa802de07dc82fbf2ed7d219ef1bf1a
|
| 3 |
+
size 139781623
|
dataset/multi_bb/multi_bb_2025-11-18_16-14-38_metadata.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5bbb3e7303d2d380e7260990c70a93c38f9cd9c3dea2eeec987fcc9affa095de
|
| 3 |
+
size 464
|
multi_bb_collect.py
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import argparse
|
| 2 |
+
import os
|
| 3 |
+
import time
|
| 4 |
+
from dataclasses import dataclass
|
| 5 |
+
from datetime import datetime
|
| 6 |
+
from typing import List, Tuple
|
| 7 |
+
|
| 8 |
+
import mujoco
|
| 9 |
+
import numpy as np
|
| 10 |
+
from tqdm import tqdm
|
| 11 |
+
|
| 12 |
+
from dataset import TrajectoryBuffer
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
@dataclass
|
| 16 |
+
class Config:
|
| 17 |
+
"""Configuration for the multi-ball-in-bottle environment."""
|
| 18 |
+
|
| 19 |
+
bottle_length: float = 0.10 # x dimension (m)
|
| 20 |
+
bottle_width: float = 0.10 # y dimension (m)
|
| 21 |
+
bottle_height: float = 0.50 # z dimension (m)
|
| 22 |
+
wall_thickness: float = 0.005
|
| 23 |
+
ball_radius: float = 0.01
|
| 24 |
+
ball_mass: float = 0.003
|
| 25 |
+
timestep: float = 0.002
|
| 26 |
+
|
| 27 |
+
# Initialization ranges
|
| 28 |
+
min_z: float = 0.05
|
| 29 |
+
max_z: float = 0.30
|
| 30 |
+
max_xy_speed: float = 0.30 # m/s
|
| 31 |
+
|
| 32 |
+
# Rendering
|
| 33 |
+
render_width: int = 640
|
| 34 |
+
render_height: int = 480
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
class BottleMultiBallEnv:
|
| 38 |
+
"""Four free-falling balls inside an open-top square bottle."""
|
| 39 |
+
|
| 40 |
+
def __init__(self, headless: bool = True, config: Config | None = None, seed: int = 0):
|
| 41 |
+
self.config = config or Config()
|
| 42 |
+
self.headless = headless
|
| 43 |
+
self.rng = np.random.RandomState(seed)
|
| 44 |
+
self.model = mujoco.MjModel.from_xml_string(self._build_xml())
|
| 45 |
+
self.data = mujoco.MjData(self.model)
|
| 46 |
+
self.viewer = None
|
| 47 |
+
self.renderer = None
|
| 48 |
+
self.cam_id = mujoco.mj_name2id(self.model, mujoco.mjtObj.mjOBJ_CAMERA, "bottle_cam")
|
| 49 |
+
if not self.headless:
|
| 50 |
+
try:
|
| 51 |
+
import mujoco.viewer as mj_viewer # type: ignore
|
| 52 |
+
|
| 53 |
+
self.viewer = mj_viewer.launch_passive(self.model, self.data)
|
| 54 |
+
except Exception:
|
| 55 |
+
# Fallback to offscreen renderer; requires a valid GL context to show frames
|
| 56 |
+
self.renderer = mujoco.Renderer(
|
| 57 |
+
self.model, width=self.config.render_width, height=self.config.render_height
|
| 58 |
+
)
|
| 59 |
+
|
| 60 |
+
# Cache indices for qpos/qvel blocks of each ball
|
| 61 |
+
self.ball_qpos_idx = []
|
| 62 |
+
self.ball_qvel_idx = []
|
| 63 |
+
for i in range(1, 5):
|
| 64 |
+
name = f"ball{i}_free"
|
| 65 |
+
self.ball_qpos_idx.append(
|
| 66 |
+
self.model.jnt_qposadr[mujoco.mj_name2id(self.model, mujoco.mjtObj.mjOBJ_JOINT, name)]
|
| 67 |
+
)
|
| 68 |
+
self.ball_qvel_idx.append(
|
| 69 |
+
self.model.jnt_dofadr[mujoco.mj_name2id(self.model, mujoco.mjtObj.mjOBJ_JOINT, name)]
|
| 70 |
+
)
|
| 71 |
+
|
| 72 |
+
def _build_xml(self) -> str:
|
| 73 |
+
c = self.config
|
| 74 |
+
half_len = c.bottle_length / 2
|
| 75 |
+
half_wid = c.bottle_width / 2
|
| 76 |
+
t = c.wall_thickness
|
| 77 |
+
h = c.bottle_height
|
| 78 |
+
ball_rad = c.ball_radius
|
| 79 |
+
return f"""
|
| 80 |
+
<mujoco model="multi_ball_bottle">
|
| 81 |
+
<compiler angle="radian" coordinate="local"/>
|
| 82 |
+
<option timestep="{c.timestep}"/>
|
| 83 |
+
<default>
|
| 84 |
+
<geom
|
| 85 |
+
solref="0.01 0.15"
|
| 86 |
+
friction="1.5 0.001 0.001"
|
| 87 |
+
condim="6"
|
| 88 |
+
/>
|
| 89 |
+
</default>
|
| 90 |
+
<worldbody>
|
| 91 |
+
<light name="light" pos="0 0 {h}" dir="0 0 -1"/>
|
| 92 |
+
<!-- Floor -->
|
| 93 |
+
<geom name="floor" type="plane" pos="0 0 0" size="1 1 0.01" rgba="0.8 0.8 0.8 1"/>
|
| 94 |
+
<!-- Walls -->
|
| 95 |
+
<geom name="wall_xp" type="box" pos="{half_len + t/2} 0 {h/2}" size="{t/2} {half_wid} {h/2}" rgba="0.7 0.7 0.7 1"/>
|
| 96 |
+
<geom name="wall_xn" type="box" pos="-{half_len + t/2} 0 {h/2}" size="{t/2} {half_wid} {h/2}" rgba="0.7 0.7 0.7 1"/>
|
| 97 |
+
<geom name="wall_yp" type="box" pos="0 {half_wid + t/2} {h/2}" size="{half_len} {t/2} {h/2}" rgba="0.7 0.7 0.7 1"/>
|
| 98 |
+
<geom name="wall_yn" type="box" pos="0 -{half_wid + t/2} {h/2}" size="{half_len} {t/2} {h/2}" rgba="0.7 0.7 0.7 1"/>
|
| 99 |
+
<!-- Balls (each as a root body because free joints must be root-level) -->
|
| 100 |
+
{"".join([self._ball_body_xml(i, ball_rad) for i in range(1, 5)])}
|
| 101 |
+
<camera name="bottle_cam" pos="0 0 {h}" quat="0 -1 0 0" fovy="60"/>
|
| 102 |
+
</worldbody>
|
| 103 |
+
<asset>
|
| 104 |
+
<texture type="skybox" builtin="gradient" rgb1=".4 .5 .6" rgb2="0 0 0" width="64" height="64"/>
|
| 105 |
+
<material name="ball_mat" rgba="0.9 0.4 0.2 1"/>
|
| 106 |
+
</asset>
|
| 107 |
+
<visual>
|
| 108 |
+
<map force="0.1"/>
|
| 109 |
+
<quality shadowsize="2048"/>
|
| 110 |
+
</visual>
|
| 111 |
+
</mujoco>
|
| 112 |
+
"""
|
| 113 |
+
|
| 114 |
+
def _ball_body_xml(self, idx: int, radius: float) -> str:
|
| 115 |
+
return f"""
|
| 116 |
+
<body name="ball{idx}" pos="0 0 0">
|
| 117 |
+
<joint name="ball{idx}_free" type="free"/>
|
| 118 |
+
<geom name="ball{idx}_geom" type="sphere" size="{radius}" mass="{self.config.ball_mass}" material="ball_mat" friction="1.5 0.001 0.001"/>
|
| 119 |
+
</body>
|
| 120 |
+
"""
|
| 121 |
+
|
| 122 |
+
def reset(self) -> Tuple[np.ndarray, bool]:
|
| 123 |
+
mujoco.mj_resetData(self.model, self.data)
|
| 124 |
+
positions = self._sample_initial_positions()
|
| 125 |
+
velocities = self._sample_initial_velocities()
|
| 126 |
+
|
| 127 |
+
for i in range(4):
|
| 128 |
+
qpos_idx = self.ball_qpos_idx[i]
|
| 129 |
+
qvel_idx = self.ball_qvel_idx[i]
|
| 130 |
+
pos = positions[i]
|
| 131 |
+
vel = velocities[i]
|
| 132 |
+
self.data.qpos[qpos_idx : qpos_idx + 3] = pos
|
| 133 |
+
# quaternion wxyz = [1, 0, 0, 0]
|
| 134 |
+
self.data.qpos[qpos_idx + 3 : qpos_idx + 7] = np.array([1.0, 0.0, 0.0, 0.0])
|
| 135 |
+
self.data.qvel[qvel_idx : qvel_idx + 3] = vel
|
| 136 |
+
self.data.qvel[qvel_idx + 3 : qvel_idx + 6] = np.zeros(3)
|
| 137 |
+
|
| 138 |
+
mujoco.mj_forward(self.model, self.data)
|
| 139 |
+
return self.get_obs()
|
| 140 |
+
|
| 141 |
+
def _sample_initial_positions(self) -> np.ndarray:
|
| 142 |
+
c = self.config
|
| 143 |
+
positions = []
|
| 144 |
+
margin = c.ball_radius * 2.5
|
| 145 |
+
tries = 0
|
| 146 |
+
while len(positions) < 4:
|
| 147 |
+
x = self.rng.uniform(-c.bottle_length / 2 + margin, c.bottle_length / 2 - margin)
|
| 148 |
+
y = self.rng.uniform(-c.bottle_width / 2 + margin, c.bottle_width / 2 - margin)
|
| 149 |
+
z = self.rng.uniform(c.min_z, c.max_z)
|
| 150 |
+
candidate = np.array([x, y, z], dtype=np.float64)
|
| 151 |
+
if all(np.linalg.norm(candidate[:2] - p[:2]) > c.ball_radius * 2 for p in positions):
|
| 152 |
+
positions.append(candidate)
|
| 153 |
+
tries += 1
|
| 154 |
+
if tries > 1000: # fallback to avoid infinite loop
|
| 155 |
+
positions.append(candidate)
|
| 156 |
+
return np.stack(positions, axis=0)
|
| 157 |
+
|
| 158 |
+
def _sample_initial_velocities(self) -> np.ndarray:
|
| 159 |
+
c = self.config
|
| 160 |
+
speeds = self.rng.uniform(0.0, c.max_xy_speed, size=(4,))
|
| 161 |
+
angles = self.rng.uniform(0.0, 2 * np.pi, size=(4,))
|
| 162 |
+
vx = speeds * np.cos(angles)
|
| 163 |
+
vy = speeds * np.sin(angles)
|
| 164 |
+
vz = np.zeros_like(vx)
|
| 165 |
+
return np.stack([vx, vy, vz], axis=1)
|
| 166 |
+
|
| 167 |
+
def step(self):
|
| 168 |
+
mujoco.mj_step(self.model, self.data)
|
| 169 |
+
return self.get_obs()
|
| 170 |
+
|
| 171 |
+
def get_obs(self) -> Tuple[np.ndarray, bool]:
|
| 172 |
+
# Collect positions and velocities for four balls
|
| 173 |
+
pos_list: List[np.ndarray] = []
|
| 174 |
+
vel_list: List[np.ndarray] = []
|
| 175 |
+
for i in range(4):
|
| 176 |
+
qpos_idx = self.ball_qpos_idx[i]
|
| 177 |
+
qvel_idx = self.ball_qvel_idx[i]
|
| 178 |
+
pos_list.append(self.data.qpos[qpos_idx : qpos_idx + 3].copy())
|
| 179 |
+
vel_list.append(self.data.qvel[qvel_idx : qvel_idx + 3].copy())
|
| 180 |
+
positions = np.stack(pos_list, axis=0)
|
| 181 |
+
velocities = np.stack(vel_list, axis=0)
|
| 182 |
+
|
| 183 |
+
timestamp = np.array([self.data.time], dtype=np.float32)
|
| 184 |
+
obs = np.concatenate([positions.reshape(-1), velocities.reshape(-1), timestamp]).astype(np.float32)
|
| 185 |
+
|
| 186 |
+
done = self._check_done(positions)
|
| 187 |
+
return obs, done
|
| 188 |
+
|
| 189 |
+
def _check_done(self, positions: np.ndarray) -> bool:
|
| 190 |
+
return False
|
| 191 |
+
|
| 192 |
+
def render(self):
|
| 193 |
+
if self.viewer is not None:
|
| 194 |
+
self.viewer.sync()
|
| 195 |
+
return None
|
| 196 |
+
if self.renderer is not None:
|
| 197 |
+
self.renderer.update_scene(self.data, camera=self.cam_id)
|
| 198 |
+
return self.renderer.render()
|
| 199 |
+
return None
|
| 200 |
+
|
| 201 |
+
def close(self):
|
| 202 |
+
if self.viewer is not None:
|
| 203 |
+
try:
|
| 204 |
+
self.viewer.close()
|
| 205 |
+
except Exception:
|
| 206 |
+
pass
|
| 207 |
+
if self.renderer is not None:
|
| 208 |
+
self.renderer.free()
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
def collect_multi_ball_data(
|
| 212 |
+
env: BottleMultiBallEnv,
|
| 213 |
+
target_trajectories: int,
|
| 214 |
+
steps_per_traj: int,
|
| 215 |
+
render: bool = False,
|
| 216 |
+
realtime: bool = False,
|
| 217 |
+
) -> TrajectoryBuffer:
|
| 218 |
+
record_stride = 5 # record once every 5 env steps
|
| 219 |
+
buffer = TrajectoryBuffer(steps_per_traj)
|
| 220 |
+
pbar = tqdm(total=target_trajectories, desc="Collecting multi-ball data")
|
| 221 |
+
|
| 222 |
+
for _ in range(target_trajectories):
|
| 223 |
+
obs, done = env.reset()
|
| 224 |
+
recorded = 0
|
| 225 |
+
for step_idx in range(steps_per_traj * record_stride):
|
| 226 |
+
if step_idx % record_stride == 0:
|
| 227 |
+
obs_np = obs[None, :]
|
| 228 |
+
ext_obs_np = obs_np
|
| 229 |
+
action_np = np.zeros((1, 1), dtype=np.float32) # placeholder action
|
| 230 |
+
reward_np = np.zeros((1,), dtype=np.float32)
|
| 231 |
+
done_np = np.array([done], dtype=np.bool_)
|
| 232 |
+
buffer.append_step(obs_np, ext_obs_np, action_np, reward_np, done_np)
|
| 233 |
+
recorded += 1
|
| 234 |
+
if recorded >= steps_per_traj:
|
| 235 |
+
break
|
| 236 |
+
|
| 237 |
+
obs, done = env.step()
|
| 238 |
+
|
| 239 |
+
if render:
|
| 240 |
+
env.render()
|
| 241 |
+
if realtime:
|
| 242 |
+
time.sleep(env.model.opt.timestep)
|
| 243 |
+
if done:
|
| 244 |
+
break
|
| 245 |
+
|
| 246 |
+
pbar.update(1)
|
| 247 |
+
|
| 248 |
+
pbar.close()
|
| 249 |
+
return buffer
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
def parse_args():
|
| 253 |
+
parser = argparse.ArgumentParser(description="Collect multi-ball contact-rich dataset inside a bottle.")
|
| 254 |
+
parser.add_argument("--trajectories", type=int, default=1024, help="Number of trajectories to collect")
|
| 255 |
+
parser.add_argument("--steps_per_trajectory", type=int, default=8192, help="Steps per trajectory")
|
| 256 |
+
parser.add_argument("--out_dir", type=str, default="./dataset/multi_bb/", help="Output directory")
|
| 257 |
+
parser.add_argument("--seed", type=int, default=42, help="Random seed")
|
| 258 |
+
parser.add_argument("--headless", action="store_true", help="Disable on-screen rendering")
|
| 259 |
+
parser.add_argument("--realtime", action="store_true", help="Sleep to match real time")
|
| 260 |
+
parser.add_argument("--demo", action="store_true", help="Run a short demo instead of full collection")
|
| 261 |
+
return parser.parse_args()
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
def main():
|
| 265 |
+
args = parse_args()
|
| 266 |
+
np.random.seed(args.seed)
|
| 267 |
+
|
| 268 |
+
config = Config()
|
| 269 |
+
env = BottleMultiBallEnv(headless=args.headless, config=config, seed=args.seed)
|
| 270 |
+
|
| 271 |
+
try:
|
| 272 |
+
if args.demo:
|
| 273 |
+
obs, _ = env.reset()
|
| 274 |
+
print(f"Initial obs shape: {obs.shape}")
|
| 275 |
+
for _ in range(500):
|
| 276 |
+
obs, done = env.step()
|
| 277 |
+
if not args.headless:
|
| 278 |
+
env.render()
|
| 279 |
+
if args.realtime:
|
| 280 |
+
time.sleep(env.model.opt.timestep)
|
| 281 |
+
if done:
|
| 282 |
+
obs, _ = env.reset()
|
| 283 |
+
else:
|
| 284 |
+
os.makedirs(args.out_dir, exist_ok=True)
|
| 285 |
+
buffer = collect_multi_ball_data(
|
| 286 |
+
env=env,
|
| 287 |
+
target_trajectories=args.trajectories,
|
| 288 |
+
steps_per_traj=args.steps_per_trajectory,
|
| 289 |
+
render=not args.headless,
|
| 290 |
+
realtime=args.realtime,
|
| 291 |
+
)
|
| 292 |
+
timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
|
| 293 |
+
file_stem = f"multi_bb_{timestamp}"
|
| 294 |
+
dataset_path = os.path.join(args.out_dir, f"{file_stem}.npz")
|
| 295 |
+
buffer.save(dataset_path)
|
| 296 |
+
|
| 297 |
+
meta = {
|
| 298 |
+
"environment": "multi_ball_bottle",
|
| 299 |
+
"trajectories": args.trajectories,
|
| 300 |
+
"steps_per_trajectory": args.steps_per_trajectory,
|
| 301 |
+
"total_trajectories": len(buffer),
|
| 302 |
+
"total_steps": len(buffer) * args.steps_per_trajectory,
|
| 303 |
+
"seed": args.seed,
|
| 304 |
+
"config": config.__dict__,
|
| 305 |
+
"timestamp": timestamp,
|
| 306 |
+
"headless": args.headless,
|
| 307 |
+
}
|
| 308 |
+
import pickle
|
| 309 |
+
|
| 310 |
+
metadata_path = os.path.join(args.out_dir, f"{file_stem}_metadata.pkl")
|
| 311 |
+
with open(metadata_path, "wb") as f:
|
| 312 |
+
pickle.dump(meta, f)
|
| 313 |
+
|
| 314 |
+
print(f"[INFO] Dataset saved: {dataset_path}")
|
| 315 |
+
print(f"[INFO] Metadata saved: {metadata_path}")
|
| 316 |
+
print(f"[INFO] Collected {len(buffer)} trajectories")
|
| 317 |
+
finally:
|
| 318 |
+
env.close()
|
| 319 |
+
|
| 320 |
+
|
| 321 |
+
if __name__ == "__main__":
|
| 322 |
+
main()
|