File size: 6,716 Bytes
81c7a5f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 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 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | # Debugging
RoboLab provides three global flags in `robolab.constants` for controlling debug output and visualization. All are `False` by default.
## Flags
### `VERBOSE`
Prints detailed operational information during environment setup and execution:
- **Environment registration** — Prints the full environment table after registration
- **Environment creation** — Logs event merging, env config saving
- **Episode recording** — Logs data export progress
- **Subtask state machine** — Prints the current subtask state and object tracker after each state change
- **Pose randomization** — Logs per-object randomization ranges, bounding radii, and before/after positions
- **Camera operations** — Logs camera pose randomization, resets, and warnings for missing sensors
- **Contact detection** — Logs which objects the gripper is in contact with, sensor mismatches
**Enable via CLI:**
```bash
python policies/pi0_family/run.py --enable-verbose
```
**Enable programmatically:**
```python
import robolab.constants
robolab.constants.VERBOSE = True
```
### `DEBUG`
Prints per-step conditional evaluation results. This is very detailed and produces output every simulation step — useful for diagnosing why a specific subtask condition is or isn't being satisfied.
Covers all conditional functions in `robolab.core.task.conditionals`:
- `object_grabbed`, `object_dropped`, `object_picked_up`
- `object_in_container`, `object_on_top`, `object_on_bottom`, `object_on_center`
- `object_left_of`, `object_right_of`, `object_in_front_of`, `object_behind`
- `object_above`, `object_below`, `object_below_top`
- `object_enclosed`, `object_inside`, `object_outside_of`
- `object_upright`, `object_at`, `object_between`, `object_next_to`
- `stacked`, `objects_in_line`, `objects_stationary`
- `wrong_object_grabbed`, `gripper_hit_table`, `gripper_fully_closed`
- Subtask state machine advancement and regression
**Enable via CLI:**
```bash
python policies/pi0_family/run.py --enable-debug
```
**Enable programmatically:**
```python
import robolab.constants
robolab.constants.DEBUG = True
```
### `VISUALIZE`
Renders bounding boxes and pose axes for all tracked objects in the viewport at every simulation step. Used inside the episode loop in `robolab/eval/episode.py`.
**Enable programmatically:**
```python
import robolab.constants
robolab.constants.VISUALIZE = True
```
When enabled, every step calls `get_world(env).visualize()`, which draws the oriented bounding box and coordinate axes for each object in the scene.
## World State Visualization
You can also call the visualization API directly at any point during execution, independently of the `VISUALIZE` flag:
```python
from robolab.core.world.world_state import get_world
world = get_world(env)
# Visualize all tracked objects
world.visualize()
# Visualize specific objects only
world.visualize(["bowl", "banana"])
```
This draws bounding boxes and coordinate axes in the viewport:

## Combining Flags
You can enable both `VERBOSE` and `DEBUG` together for maximum diagnostics:
```bash
python policies/pi0_family/run.py --enable-verbose --enable-debug
```
| Flag | Scope | Volume |
|------|-------|--------|
| `VERBOSE` | Infrastructure (registration, env creation, recording, cameras, pose randomization) | Moderate — logs key operations |
| `DEBUG` | Task logic (conditional evaluations, subtask state transitions) | High — prints every step |
| `VISUALIZE` | Rendering (bounding boxes, pose axes in viewport) | Visual only — no text output |
## World State Inspection
`WorldState` (via `get_world(env)`) exposes methods useful for interactive debugging beyond visualization:
```python
from robolab.core.world.world_state import get_world
world = get_world(env)
# Object geometry
world.get_pose("banana") # (position, quaternion)
world.get_velocity("banana") # (linear, angular)
world.get_dimensions("banana") # (x, y, z) extents
world.get_aabb("banana") # Axis-aligned bounding box
world.get_bbox("banana") # Oriented bounding box corners + centroid
world.get_centroid("banana") # Center of mass
# Contact queries
world.in_contact("gripper", "banana") # bool
world.get_objects_in_contact_with("gripper") # list of object names
world.get_contact_force("gripper", "banana") # force magnitude
world.is_supported_on_surface("banana", "table") # bool
world.get_objects_supported_on("table") # list of object names
```
## Diagnostic Scripts
### Verify environment registration
After registration, print a table of all registered environments to confirm tasks were discovered correctly:
```python
from robolab.core.environments.factory import print_env_table
print_env_table() # All environments
print_env_table(tag="pick_place") # Filter by tag
print_env_table(verbose=True) # Include full env config details
```
Or use the pytest test:
```bash
uv run pytest tests/test_registered_envs.py -v
```
### Verify tasks are valid
Check that all task files load correctly, have valid fields, and no duplicate names:
```bash
uv run pytest tests/test_tasks_valid.py -v # all tasks
uv run pytest tests/test_tasks_valid.py -v -k BananaInBowl # one task
```
### Run one full episode
Run a single empty-action episode end-to-end (useful for confirming a task launches and terminates correctly):
```bash
uv run pytest tests/test_run_empty.py -v # default: BananaInBowlTask
uv run pytest tests/test_run_empty.py -v --task RubiksCubeTask
```
### Verify IsaacLab installation
Minimal smoke test that IsaacLab and IsaacSim launch correctly:
```bash
uv run pytest tests/test_isaaclab.py -v
```
### Inspect HDF5 data
View the HDF5 file structure with `h5glance` (install separately with `pip install h5glance`):
```bash
h5glance output/2026-01-24_15-35-59/BananaInBowlTask/run_0.hdf5
```
### Read subtask status from HDF5
Print subtask completion timeline, status codes, and scores from recorded episodes:
```bash
python scripts/read_subtask_status_from_hdf5.py output/.../run_0.hdf5
python scripts/read_subtask_status_from_hdf5.py output/.../run_0.hdf5 -e 0
```
### Check results integrity
Validate that episode results match the HDF5 data (every episode has a matching demo):
```bash
python analysis/check_results.py output/2026-01-24_15-35-59
python analysis/check_results.py output/2026-01-24_15-35-59 --verbose --diagnose
```
See [Analysis and Results Parsing](analysis.md) for the full set of analysis scripts.
## Known Issues
See [Known Issues](known_issues.md).
|