-
Notifications
You must be signed in to change notification settings - Fork 437
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
correctly initialize orientation #115
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,11 +183,18 @@ class PositionPoseSensorManager : public msf_core::MSF_SensorManagerROS< | |
// here we take the attitude from the pose sensor and augment it with | ||
// global yaw init. | ||
double yawinit = config_.position_yaw_init / 180 * M_PI; | ||
Eigen::Quaterniond yawq(cos(yawinit / 2), 0, 0, sin(yawinit / 2)); | ||
yawq.normalize(); | ||
Eigen::Quaterniond q_wv_yaw(cos(yawinit / 2), 0, 0, sin(yawinit / 2)); | ||
q_wv_yaw.normalize(); | ||
|
||
q = yawq; | ||
q_wv = (q * q_ic * q_vc.conjugate()).conjugate(); | ||
q_wv = q_wv_yaw.conjugate(); | ||
|
||
if (q_vc.w() == 1) { // If there is no pose measurement, only apply q_wv. | ||
q = q_wv; | ||
} else { // If there is a pose measurement, apply q_ic and q_wv to get initial attitude. | ||
q = (q_ic * q_vc.conjugate() * q_wv).conjugate(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can't really check the math now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not correct:
since the last conjugate needs to be applied to q_wv and not to the entire expr.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the notation I agree this should be the case. However, I tried many different things and and this was the only way I got this to work. I actually copied this from the initialization of pose_msf, where it is done the same way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, my mistake. The entire expression needs to be inverted again, since the state holds There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i.e. you need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See how Doesn't this translate to Here I read Could it be that the notation is off in the case of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, that is indeed a conflict between notation and usage. There are several things that need to be fixed:
it seems I overlooked these when I did the big cleanup from the old filter version... :( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok sounds good! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, you will need to adapt the measurement matrix (H matrix) as well, most likely there is yet another fishy transpose of the conjugate :( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
q.normalize(); | ||
|
||
MSF_WARN_STREAM("q " << STREAMQUAT(q)); | ||
MSF_WARN_STREAM("q_wv " << STREAMQUAT(q_wv)); | ||
|
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.
isn't there any other way to determine this? this seems unsafe
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.
probably better to track this with a separate bool.
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 I add a flag in the sensor handler to track if a measurement has arrived?
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.
yes, that is a good way of doing this.
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.
#117