Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RANSAC for hand-eye calibration #17

Merged
merged 25 commits into from
Apr 9, 2017

Conversation

mfehr
Copy link
Contributor

@mfehr mfehr commented Apr 8, 2017

TODOs:

  • Implement all the algorithm variants we want to test:
    • Simple approach currenty in master
    • RANSAC - scalar equality based inlier selection
    • RANSAC - RMSE based inlier selection
    • Exhaustive search, scalar equality based inlier selection
    • Exhaustive search, RMSE based inlier selection
  • More testing:
    • Simple approach currenty in master
    • RANSAC - scalar equality based inlier selection
    • RANSAC - RMSE based inlier selection
    • Exhaustive search, scalar equality based inlier selection
    • Exhaustive search, RMSE based inlier selection
  • Merge in @ntonci informative sample selection:
  • Cleanup:
    • move stuff into functions

@mfehr mfehr requested review from ffurrer and ntonci and removed request for ffurrer and ntonci April 8, 2017 15:10
…liers

Conflicts:
	hand_eye_calibration/bin/tf_to_csv.py
	hand_eye_calibration/python/hand_eye_calibration/dual_quaternion_hand_eye_calibration.py
Copy link
Contributor

@ffurrer ffurrer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@@ -542,6 +548,29 @@ def compute_hand_eye_calibration_RANSAC(dq_B_H_vec, dq_W_E_vec, config):
(rmse_position,
rmse_orientation,
inlier_flags) = evaluate_alignment(poses_B_H, poses_W_H, config)
assert inlier_flags[0], ("The sample idx uses for alignment should be "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: used
and: part of the inlier set (maybe) ;)

inlier_flags[i] = False

if num_inlier_removed_due_to_scalar_part_inequality > 0:
print("WARNING: An inliers selected based on the "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inliers selected, which, based on their position/orientation error, did not...

So did this actually work, with tighter boundaries?

"Inliers removed: {}".format(
num_inlier_removed_due_to_scalar_part_inequality))
# TODO(mfehr): Find a good way to tune the parameters.
assert False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove :)



def compute_hand_eye_calibration_BASELINE(dq_B_H_vec, dq_W_E_vec, config):
"""Do the actual hand eye-calibration as described in the referenced paper."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add input output param descriptions here?

def function_with_types_in_docstring(param1, param2):
    """Example function with types documented in the docstring.

    `PEP 484`_ type annotations are supported. If attribute, parameter, and
    return types are annotated acco
    Args:
        param1 (int): The first parameter.
        param2 (str): The second parameter.

    Returns:
        bool: The return value. True for success, False otherwise.

    .. _PEP 484:
        https://www.python.org/dev/peps/pep-0484/

from (http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#25

best_num_inliers, num_poses_after_filtering, runtime)


def compute_hand_eye_calibration_RANSAC(dq_B_H_vec, dq_W_E_vec, config):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docstrings

hand_eye_config.algorithm_name = "EC"

# Prefiltering is mandatory for exhaustive search,
# otherwise it takes forever.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

@@ -36,7 +36,7 @@ def __init__(self, q_rot, q_dual):
self.assert_normalization()

def __str__(self):
return np.str(self.dq)
return "[q_rot: {}, q_pos: {}]".format(np.str(self.q_rot), np.str(self.q_dual))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q_dual instead of q_pos


# 2.
# Compute SVD of T and check if only two singular values are almost equal to
# zero. Take the corresponding right-singular vectors (v_7 and v_8)
U, s, V = np.linalg.svd(t_matrix)
print("singular values: {}".format(s))
# print("singular values: {}".format(s))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we return the singular values, we don't need to do anything with them for now, but might be interesting at a later stage or to others.

s = config.ransac_sample_size
w = (1 - config.ransac_outlier_probability) # Inlier probability
w_pow_s = w ** s
required_iterations = (math.log(1 - config.ransac_success_probability_threshold) /
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. here and below

@@ -297,6 +297,8 @@ def quaternions_interpolate(q_left, t_left, q_right, t_right, times):

def angle_between_quaternions(q1, q2):
""" Returns the angle between two quaternions, q1 and q2. """
if np.allclose(q1.q, q2.q, atol=1.e-12):
return 0.0
return 2 * np.arccos((q1 * q2.inverse()).w)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hand_eye_config = HandEyeConfig()
hand_eye_config.visualize = False
hand_eye_config.ransac_max_number_iterations = 50
hand_eye_config.ransac_sample_size = 5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep the tests with 5 or reduce to 2/3? Then we could probably again turn the outlier probability up.

hand_eye_config = HandEyeConfig()
hand_eye_config.visualize = False
hand_eye_config.ransac_max_number_iterations = 50
hand_eye_config.ransac_sample_size = 5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

hand_eye_config = HandEyeConfig()
hand_eye_config.visualize = False
hand_eye_config.ransac_max_number_iterations = 50
hand_eye_config.ransac_sample_size = 5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hand_eye_config gained a lot of params, maybe it would be good to quickly run the tests again. And maybe define some of the other params.

@mfehr mfehr force-pushed the feature/ransac_for_hand_eye_calibration_inliers branch from 700d9e1 to 3a99b08 Compare April 9, 2017 20:53
@mfehr mfehr force-pushed the feature/ransac_for_hand_eye_calibration_inliers branch from 3a99b08 to 615abdc Compare April 9, 2017 20:55
@mfehr mfehr merged commit e6718f9 into master Apr 9, 2017
@mfehr mfehr deleted the feature/ransac_for_hand_eye_calibration_inliers branch April 9, 2017 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants