def METHOD_NAME(sensor_bridge, joint_index, expected_values, tolerances):
    # read the joint state
    if not sensor_bridge.advance():
        raise RuntimeError('Unable to read the sensors')
    _, joints_values, _ = sensor_bridge.get_joint_positions()
    # compute the offset
    delta = joints_values[joint_index] * 180 / math.pi - expected_values[joint_index]
    tolerance = tolerances[joint_index]
    if abs(delta) < tolerances[joint_index]:
        print_info("The offset is equal to " + str(delta)
                   + " deg. The absolute value is lower than the desired tolerance "
                   + str(tolerance) + " deg.")
        print_info("The offset is set to 0 deg")
        return 0.0
    else:
        return delta