def squash_small_angles(controller_fn, min_angle=1.0):
    """
    Decorates a controller that sets actions smaller than a certain angle to 0.
    """
    # Acts like a normal controller function
    def decorated_controller(state):
        action, info = controller_fn(state)  # The actual controller
        (pitch, roll) = action

        if abs(pitch) < min_angle:
            pitch = 0
        if abs(roll) < min_angle:
            roll = 0

        action = (pitch, roll)
        return (action), info

    return decorated_controller