Skip to content

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.

# policy.py - This name is required!

def policy(observation):  # This function name is required!
    ...

Check your zip structure:

unzip -l policy.zip
# Should show:
# policy.py

Not:

# Wrong - nested in folder
# my_project/policy.py

Fix: Create zip from the file directly:

zip policy.zip policy.py

"Import error: No module named 'X'"

Only these packages are available:

  • numpy
  • math
  • Python standard library

Wrong:

import torch  # Not available
import tensorflow  # Not available

Right:

import numpy as np
import math
from collections import defaultdict

If you need custom modules, include them in the zip:

policy.zip
├── policy.py
├── utils.py
└── my_module.py
# policy.py
from utils import helper_function
from my_module import MyClass

"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:

  1. Heavy computation:

    # Bad: O(n^3) algorithm
    for i in objects:
        for j in objects:
            for k in objects:
                ...
    

  2. Loading files:

    # Bad: loading model every step
    def policy(obs):
        model = load_model("weights.pkl")  # Slow!
    

  3. Network calls:

    # Bad: API calls in policy
    def policy(obs):
        response = requests.get(...)  # Not allowed anyway
    

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:

return np.array([0, 0, 0, 0, 0, 0, 0])
return np.zeros(7)


Runtime Issues

Robot doesn't move

Check 1: Are you returning zero actions?

def policy(obs):
    action = np.zeros(7)
    # Forgot to modify action!
    return action

Check 2: Are your action values too small?

# Too small to cause movement
action[:3] = direction * 0.001

# Better
action[:3] = direction * 0.5

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

# Check your coordinate system
# +X is forward, +Y is left, +Z is up

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

# Close gripper: -1
action[6] = -1

# Open gripper: +1
action[6] = +1

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

  1. First: Can you move the robot?
  2. Then: Can you move toward an object?
  3. Then: Can you grasp an object?
  4. 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

  1. Check the FAQ: FAQ
  2. Review scenario docs: Scenarios
  3. Open an issue: GitHub Issues

When reporting issues, include:

  • Submission ID
  • Error message
  • Minimal code to reproduce