-
Notifications
You must be signed in to change notification settings - Fork 789
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
Test body_P_sensor in SmartFactor #379
Changes from 6 commits
73007fe
0c199dd
b9264cf
7dfc799
f23587f
60c88f6
7259f89
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 |
---|---|---|
|
@@ -207,10 +207,17 @@ class SmartFactorBase: public NonlinearFactor { | |
Vector ue = cameras.reprojectionError(point, measured_, Fs, E); | ||
if (body_P_sensor_ && Fs) { | ||
const Pose3 sensor_P_body = body_P_sensor_->inverse(); | ||
size_t camera_dim = size_t(traits<CAMERA>::dimension); | ||
size_t pose_dim = size_t(traits<Pose3>::dimension); | ||
|
||
for (size_t i = 0; i < Fs->size(); i++) { | ||
const Pose3 w_Pose_body = cameras[i].pose() * sensor_P_body; | ||
Matrix J(6, 6); | ||
const Pose3 world_P_body = w_Pose_body.compose(*body_P_sensor_, J); | ||
const Pose3 world_P_body = cameras[i].pose() * sensor_P_body; | ||
Matrix J = Matrix::Zero(camera_dim, camera_dim); | ||
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. Why switch to dynamic? Make static, use setZero(), save a malloc 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. Gotcha. It was already dynamic for some reason so was trying not to inadvertently introduce any bugs. |
||
// Call compose to compute Jacobian for camera extrinsics | ||
Matrix H(pose_dim, pose_dim); | ||
world_P_body.compose(*body_P_sensor_, H); | ||
// Assign extrinsics | ||
J.block(0, 0, pose_dim, pose_dim) = H; | ||
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. You can just pass the block into the optionalJacobian slot. Amazing, right? 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 tried doing that but it was complaining about something (which I don't remember right now). I am guessing it will fix itself with static matrices. 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. So as per this link, casting an Quoting the specific line:
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. Is the same true for fixed matrices, though? 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. |
||
Fs->at(i) = Fs->at(i) * J; | ||
} | ||
} | ||
|
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.
Use constexpr int, no casting