def evaluate_alignment(poses_A, poses_B, config, visualize=False):
  """
  Takes aligned poses and compares position and orientation.
  Returns the RMSE of position and orientation as well as a bool vector,
  indicating which pairs are below the error thresholds specified in the
  configuration:
    ransac_orientation_error_threshold_deg
    ransac_position_error_threshold_m
  """

  assert np.array_equal(poses_A.shape, poses_B.shape), (
      "Two pose vector of different size cannot be evaluated. "
      "Size pose A: {} Size pose B: {}".format(poses_A.shape, poses_B.shape))
  assert poses_A.shape[1] == 7, "poses_A are not valid poses!"
  assert poses_B.shape[1] == 7, "poses_B are not valid poses!"
  assert isinstance(config, HandEyeConfig)

  num_poses = poses_A.shape[0]

  inlier_list = [False] * num_poses

  errors_position = np.zeros((num_poses, 1))
  errors_orientation = np.zeros((num_poses, 1))
  for i in range(0, num_poses):
    (error_position,
     error_angle_degrees) = compute_pose_error(poses_A[i, :], poses_B[i, :])

    if (error_angle_degrees < config.ransac_orientation_error_threshold_deg and
            error_position < config.ransac_position_error_threshold_m):
      inlier_list[i] = True

    errors_position[i] = error_position
    errors_orientation[i] = error_angle_degrees

  rmse_pose_accumulator = np.sum(np.square(errors_position))
  rmse_orientation_accumulator = np.sum(np.square(errors_orientation))

  # Compute RMSE.
  rmse_pose = math.sqrt(rmse_pose_accumulator / num_poses)
  rmse_orientation = math.sqrt(rmse_orientation_accumulator / num_poses)

  # Plot the error.
  if visualize:
    plot_alignment_errors(errors_position, rmse_pose, errors_orientation,
                          rmse_orientation, blocking=True)

  return (rmse_pose, rmse_orientation, inlier_list)

  Takes aligned poses and compares position and orientation.
  Returns the RMSE of position and orientation as well as a bool vector,
  indicating which pairs are below the error thresholds specified in the
  configuration:
    ransac_orientation_error_threshold_deg
    ransac_position_error_threshold_m
  
hand_eye_calibration/python/hand_eye_calibration/dual_quaternion_hand_eye_calibration.py