Debugging Tips¶
Common issues and how to solve them.
Submission Errors¶
"Policy function not found"¶
Your zip file must contain policy.py with a policy() function.
Check your zip structure:
Not:
Fix: Create zip from the file directly:
"Import error: No module named 'X'"¶
Only these packages are available:
numpymath- Python standard library
Wrong:
Right:
If you need custom modules, include them in the zip:
"Timeout: policy took too long"¶
Each step must complete within ~100ms.
Symptoms:
- Submission fails with timeout error
- Only a few frames in the video
Common causes:
-
Heavy computation:
-
Loading files:
-
Network calls:
Fix: Pre-compute and cache:
# Good: compute once
_cached_data = None
def policy(obs):
global _cached_data
if _cached_data is None:
_cached_data = expensive_computation()
...
"Action shape mismatch"¶
Actions must be a 7D numpy array.
Wrong:
return [0, 0, 0, 0, 0, 0, 0] # List, not array
return np.array([0, 0, 0]) # Wrong length
return np.zeros((7, 1)) # Wrong shape (7,1) vs (7,)
Right:
Runtime Issues¶
Robot doesn't move¶
Check 1: Are you returning zero actions?
Check 2: Are your action values too small?
Check 3: Logging to debug:
def policy(obs):
action = compute_action(obs)
print(f"Action: {action}") # Visible in logs
return action
Robot moves erratically¶
Cause 1: Actions too large
# Bad: instant max velocity
action[:3] = direction * 1.0
# Good: gradual movement
action[:3] = direction * 0.3
Cause 2: Sign errors
Cause 3: State not persisting
# Bad: state resets every call
def policy(obs):
state = 0 # Always 0!
...
# Good: global state
_state = 0
def policy(obs):
global _state
...
Gripper doesn't grasp¶
Check 1: Gripper command
Check 2: Robot position
The gripper must be close enough to the object:
dist = np.linalg.norm(robot_pos - object_pos)
if dist < 0.03: # Within 3cm
action[6] = -1 # Close gripper
Check 3: Approach angle
Some objects need specific approach angles.
Objects fall when grasped¶
Cause 1: Moving too fast after grasping
# Bad: immediate fast movement
if grasped:
action[:3] = target_direction * 1.0
# Good: slow, smooth movement
if grasped:
action[:3] = target_direction * 0.3
Cause 2: Gripper not fully closed
# Wait for gripper to close before moving
if gripper_closing:
action = np.zeros(7)
action[6] = -1
return action
Debugging Strategies¶
1. Watch the Video¶
The result video shows exactly what happened. Look for:
- Where does the robot go?
- Does it approach objects correctly?
- Does the gripper open/close at the right time?
2. Add Print Statements¶
def policy(obs):
print(f"Robot pos: {obs['robot_state'][:3]}")
print(f"Objects: {obs['object_positions']}")
print(f"Gripper: {obs['robot_state'][13]}")
action = compute_action(obs)
print(f"Action: {action}")
return action
3. Test Incrementally¶
- First: Can you move the robot?
- Then: Can you move toward an object?
- Then: Can you grasp an object?
- Finally: Can you place it correctly?
4. Simplify¶
If your complex policy doesn't work, try a minimal version:
def policy(obs):
# Just move toward first object
robot = obs['robot_state'][:3]
target = obs['object_positions'][0]
direction = target - robot
direction = direction / (np.linalg.norm(direction) + 1e-6)
return np.concatenate([direction * 0.3, [0, 0, 0, 1]])
Getting Help¶
- Check the FAQ: FAQ
- Review scenario docs: Scenarios
- Open an issue: GitHub Issues
When reporting issues, include:
- Submission ID
- Error message
- Minimal code to reproduce