Environments¶
Base Environment¶
BaseEnv
¶
PyBullet Environment¶
pybullet_env
¶
PyBulletEnv(config: RobotConfig, visualize: bool = True, viz_urdf_path: str | None = None)
¶
Bases: BaseEnv
Source code in autolife_planning/envs/pybullet_env.py
set_base_position(x: float, y: float, theta: float)
¶
Move the robot base to (x, y) with yaw=theta in the world frame.
Source code in autolife_planning/envs/pybullet_env.py
set_configuration(config: np.ndarray)
¶
Apply a full 24-DOF config (3 base + 21 joints) to the visualization.
wait_key(key: str | int, message: str = '') -> None
¶
Block until key is pressed in the PyBullet GUI.
Prints message to stdout, then polls keyboard events until the
requested key is triggered. Accepts either a single character
("n") or a raw PyBullet key code (e.g. pb.B3G_RIGHT_ARROW).
Returns early if the GUI window is closed.
Source code in autolife_planning/envs/pybullet_env.py
wait_for_close() -> None
¶
Block until the user closes the PyBullet GUI window.
Source code in autolife_planning/envs/pybullet_env.py
animate_path(path: np.ndarray, fps: float = 60.0, next_key: str | int | None = None) -> bool
¶
Interactively play back a full-DOF path, VAMP-style.
Each row of path is handed to :meth:set_configuration. The
method blocks on the PyBullet GUI with these controls:
SPACE— toggle auto-play (loops end → start)← / →— step one waypoint back / forward (while paused)next_key(opt.) — exit and returnTrue— useful when the caller wants to drive a sequence of demos
Exits when the user closes the GUI window (returns False) or
presses next_key if one is provided (returns True). The
animation starts paused so the caller can read the banner before
anything moves.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
ndarray
|
|
required |
fps
|
float
|
playback frame rate while auto-playing. |
60.0
|
next_key
|
str | int | None
|
optional single-character string or raw PyBullet key code; pressing it exits the viewer. |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
|
Source code in autolife_planning/envs/pybullet_env.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
add_mesh(mesh_file: str, position: np.ndarray = np.zeros(3), orientation: np.ndarray = np.array([0, 0, 0, 1]), scale: np.ndarray = np.ones(3), mass: float = 0.0, name: str | None = None)
¶
Add a mesh to the simulation environment directly using the raw PyBullet client, bypassing the wrapper to avoid modifying third_party code.
Source code in autolife_planning/envs/pybullet_env.py
draw_plane(center, half_sizes: tuple[float, float] = (0.35, 0.35), normal=(0.0, 0.0, 1.0), color: tuple[float, float, float, float] = (0.15, 0.55, 0.95, 0.35)) -> int
¶
Visual-only translucent plate at center.
The plate is a thin GEOM_BOX (1 mm thick along its normal),
oriented so its thin axis lines up with normal. Useful for
showing a plane manifold — e.g. z = z0 — in the scene.
Source code in autolife_planning/envs/pybullet_env.py
draw_rod(p1, p2, radius: float = 0.008, color: tuple[float, float, float, float] = (0.2, 0.9, 0.3, 1.0)) -> int | None
¶
Visual-only solid rod (GEOM_CYLINDER) from p1 to p2.
Uses a real 3D cylinder rather than addUserDebugLine so the
segment has a proper thickness, catches lighting, and shows up
correctly in screenshots. Returns None if p1 and p2
coincide.
Source code in autolife_planning/envs/pybullet_env.py
draw_sphere(center, radius: float, color: tuple[float, float, float, float] = (0.95, 0.3, 0.3, 0.55)) -> int
¶
Visual-only sphere — handy for marking obstacles or targets.
Source code in autolife_planning/envs/pybullet_env.py
draw_frame(position, rotation, size: float = 0.12, radius: float = 0.006) -> list[int]
¶
RGB coordinate axes at position with a 3x3 rotation matrix.
Red / green / blue rods along the rotation's first / second / third columns — useful for visualising an orientation-lock constraint (the frame at the start and goal look identical).