-
Notifications
You must be signed in to change notification settings - Fork 114
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
RANSAC for hand-eye calibration #17
Conversation
…liers Conflicts: hand_eye_calibration/bin/tf_to_csv.py hand_eye_calibration/python/hand_eye_calibration/dual_quaternion_hand_eye_calibration.py
There was a problem hiding this 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 " |
There was a problem hiding this comment.
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 " |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.""" |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
best_num_inliers, num_poses_after_filtering, runtime) | ||
|
||
|
||
def compute_hand_eye_calibration_RANSAC(dq_B_H_vec, dq_W_E_vec, config): |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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) / |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
700d9e1
to
3a99b08
Compare
3a99b08
to
615abdc
Compare
TODOs: