Cleaning up warnings and boost::none

release/4.3a0
Frank Dellaert 2023-01-22 17:23:38 -08:00
parent f10a7d9737
commit 1cf0c59a12
6 changed files with 15 additions and 11 deletions

View File

@ -824,7 +824,7 @@ TEST(triangulation, reprojectionError_cameraComparison) {
Point3(0.0, 0.0, 0.0)); // with z pointing along x axis of global frame Point3(0.0, 0.0, 0.0)); // with z pointing along x axis of global frame
Point3 landmarkL(5.0, 0.0, 0.0); // 1m in front of poseA Point3 landmarkL(5.0, 0.0, 0.0); // 1m in front of poseA
SphericalCamera sphericalCamera(poseA); SphericalCamera sphericalCamera(poseA);
Unit3 u = sphericalCamera.project(landmarkL); // TODO(dellaert): check Unit3 u = sphericalCamera.project(landmarkL);
static Cal3_S2::shared_ptr sharedK(new Cal3_S2(60, 640, 480)); static Cal3_S2::shared_ptr sharedK(new Cal3_S2(60, 640, 480));
PinholePose<Cal3_S2> pinholeCamera(poseA, sharedK); PinholePose<Cal3_S2> pinholeCamera(poseA, sharedK);

View File

@ -188,15 +188,21 @@ TEST(Values, InsertOrAssign) {
TEST(Values, basic_functions) TEST(Values, basic_functions)
{ {
Values values; Values values;
const Values& values_c = values;
Matrix23 M1 = Matrix23::Zero(), M2 = Matrix23::Zero(); Matrix23 M1 = Matrix23::Zero(), M2 = Matrix23::Zero();
values.insert(2, Vector3(0, 0, 0)); values.insert(2, Vector3(0, 0, 0));
values.insert(4, Vector3(0, 0, 0)); values.insert(4, Vector3(0, 0, 0));
values.insert(6, M1); values.insert(6, M1);
values.insert(8, M2); values.insert(8, M2);
EXPECT(!values.exists(1));
EXPECT(values.exists(2));
EXPECT(values.exists(4));
EXPECT(values.exists(6));
EXPECT(values.exists(8));
#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V42 #ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V42
// find // find
const Values& values_c = values;
EXPECT_LONGS_EQUAL(4, values.find(4)->key); EXPECT_LONGS_EQUAL(4, values.find(4)->key);
EXPECT_LONGS_EQUAL(4, values_c.find(4)->key); EXPECT_LONGS_EQUAL(4, values_c.find(4)->key);

View File

@ -206,12 +206,11 @@ Values InitializePose3::computeOrientationsGradient(
// Return correct rotations // Return correct rotations
const Rot3& Rref = inverseRot.at(initialize::kAnchorKey); // This will be set to the identity as so far we included no prior const Rot3& Rref = inverseRot.at(initialize::kAnchorKey); // This will be set to the identity as so far we included no prior
Values estimateRot; Values estimateRot;
for (const auto key_R : inverseRot) { for (const auto& key_R : inverseRot) {
const Key& key = key_R.first; const Key& key = key_R.first;
const Rot3& Ri = key_R.second;
if (key != initialize::kAnchorKey) { if (key != initialize::kAnchorKey) {
const Rot3& R = inverseRot.at(key); const Rot3& R = key_R.second;
if(setRefFrame) if (setRefFrame)
estimateRot.insert(key, Rref.compose(R.inverse())); estimateRot.insert(key, Rref.compose(R.inverse()));
else else
estimateRot.insert(key, R.inverse()); estimateRot.insert(key, R.inverse());

View File

@ -283,7 +283,7 @@ TEST( Lago, largeGraphNoisy_orientations ) {
Values::shared_ptr expected; Values::shared_ptr expected;
boost::tie(gmatlab, expected) = readG2o(matlabFile); boost::tie(gmatlab, expected) = readG2o(matlabFile);
for(const auto key_pose: expected->extract<Pose2>()){ for(const auto& key_pose: expected->extract<Pose2>()){
const Key& k = key_pose.first; const Key& k = key_pose.first;
const Pose2& pose = key_pose.second; const Pose2& pose = key_pose.second;
EXPECT(assert_equal(pose, actual.at<Pose2>(k), 1e-5)); EXPECT(assert_equal(pose, actual.at<Pose2>(k), 1e-5));
@ -310,7 +310,7 @@ TEST( Lago, largeGraphNoisy ) {
Values::shared_ptr expected; Values::shared_ptr expected;
boost::tie(gmatlab, expected) = readG2o(matlabFile); boost::tie(gmatlab, expected) = readG2o(matlabFile);
for(const auto key_pose: expected->extract<Pose2>()){ for(const auto& key_pose: expected->extract<Pose2>()){
const Key& k = key_pose.first; const Key& k = key_pose.first;
const Pose2& pose = key_pose.second; const Pose2& pose = key_pose.second;
EXPECT(assert_equal(pose, actual.at<Pose2>(k), 1e-2)); EXPECT(assert_equal(pose, actual.at<Pose2>(k), 1e-2));

View File

@ -34,7 +34,7 @@ boost::shared_ptr<Cal3_S2> fixedK(new Cal3_S2());
Point2 myProject(const Pose3& pose, const Point3& point, Point2 myProject(const Pose3& pose, const Point3& point,
OptionalJacobian<2,6> H1, OptionalJacobian<2,3> H2) { OptionalJacobian<2,6> H1, OptionalJacobian<2,3> H2) {
PinholeCamera<Cal3_S2> camera(pose, *fixedK); PinholeCamera<Cal3_S2> camera(pose, *fixedK);
return camera.project(point, H1, H2, boost::none); return camera.project(point, H1, H2, {});
} }
int main() { int main() {
@ -99,7 +99,6 @@ int main() {
// ExpressionFactor, optimized // ExpressionFactor, optimized
// Oct 3, 2014, Macbook Air // Oct 3, 2014, Macbook Air
// 9.0 musecs/call // 9.0 musecs/call
typedef PinholeCamera<Cal3_S2> Camera;
NonlinearFactor::shared_ptr g3 = NonlinearFactor::shared_ptr g3 =
boost::make_shared<ExpressionFactor<Point2> >(model, z, boost::make_shared<ExpressionFactor<Point2> >(model, z,
Point2_(myProject, x, p)); Point2_(myProject, x, p));

View File

@ -84,7 +84,7 @@ int main()
Matrix Dpose, Dpoint; Matrix Dpose, Dpoint;
long timeLog = clock(); long timeLog = clock();
for(int i = 0; i < n; i++) for(int i = 0; i < n; i++)
camera.project(point1, Dpose, Dpoint, boost::none); camera.project(point1, Dpose, Dpoint, {});
long timeLog2 = clock(); long timeLog2 = clock();
double seconds = (double)(timeLog2-timeLog)/CLOCKS_PER_SEC; double seconds = (double)(timeLog2-timeLog)/CLOCKS_PER_SEC;
cout << ((double)seconds*1e9/n) << " nanosecs/call" << endl; cout << ((double)seconds*1e9/n) << " nanosecs/call" << endl;