use reference capture instead of copy capture
parent
3d116d7fdf
commit
7eb5ad67e3
|
@ -333,7 +333,7 @@ TEST(SO3, CrossB) {
|
||||||
Matrix aH1;
|
Matrix aH1;
|
||||||
for (bool nearZero : {true, false}) {
|
for (bool nearZero : {true, false}) {
|
||||||
std::function<Vector3(const Vector3&, const Vector3&)> f =
|
std::function<Vector3(const Vector3&, const Vector3&)> f =
|
||||||
[=](const Vector3& omega, const Vector3& v) {
|
[nearZero](const Vector3& omega, const Vector3& v) {
|
||||||
return so3::DexpFunctor(omega, nearZero).crossB(v);
|
return so3::DexpFunctor(omega, nearZero).crossB(v);
|
||||||
};
|
};
|
||||||
for (const Vector3& omega : test_cases::omegas(nearZero)) {
|
for (const Vector3& omega : test_cases::omegas(nearZero)) {
|
||||||
|
@ -351,7 +351,7 @@ TEST(SO3, DoubleCrossC) {
|
||||||
Matrix aH1;
|
Matrix aH1;
|
||||||
for (bool nearZero : {true, false}) {
|
for (bool nearZero : {true, false}) {
|
||||||
std::function<Vector3(const Vector3&, const Vector3&)> f =
|
std::function<Vector3(const Vector3&, const Vector3&)> f =
|
||||||
[=](const Vector3& omega, const Vector3& v) {
|
[nearZero](const Vector3& omega, const Vector3& v) {
|
||||||
return so3::DexpFunctor(omega, nearZero).doubleCrossC(v);
|
return so3::DexpFunctor(omega, nearZero).doubleCrossC(v);
|
||||||
};
|
};
|
||||||
for (const Vector3& omega : test_cases::omegas(nearZero)) {
|
for (const Vector3& omega : test_cases::omegas(nearZero)) {
|
||||||
|
@ -369,7 +369,7 @@ TEST(SO3, ApplyDexp) {
|
||||||
Matrix aH1, aH2;
|
Matrix aH1, aH2;
|
||||||
for (bool nearZero : {true, false}) {
|
for (bool nearZero : {true, false}) {
|
||||||
std::function<Vector3(const Vector3&, const Vector3&)> f =
|
std::function<Vector3(const Vector3&, const Vector3&)> f =
|
||||||
[=](const Vector3& omega, const Vector3& v) {
|
[nearZero](const Vector3& omega, const Vector3& v) {
|
||||||
return so3::DexpFunctor(omega, nearZero).applyDexp(v);
|
return so3::DexpFunctor(omega, nearZero).applyDexp(v);
|
||||||
};
|
};
|
||||||
for (const Vector3& omega : test_cases::omegas(nearZero)) {
|
for (const Vector3& omega : test_cases::omegas(nearZero)) {
|
||||||
|
@ -390,7 +390,7 @@ TEST(SO3, ApplyInvDexp) {
|
||||||
Matrix aH1, aH2;
|
Matrix aH1, aH2;
|
||||||
for (bool nearZero : {true, false}) {
|
for (bool nearZero : {true, false}) {
|
||||||
std::function<Vector3(const Vector3&, const Vector3&)> f =
|
std::function<Vector3(const Vector3&, const Vector3&)> f =
|
||||||
[=](const Vector3& omega, const Vector3& v) {
|
[nearZero](const Vector3& omega, const Vector3& v) {
|
||||||
return so3::DexpFunctor(omega, nearZero).applyInvDexp(v);
|
return so3::DexpFunctor(omega, nearZero).applyInvDexp(v);
|
||||||
};
|
};
|
||||||
for (const Vector3& omega : test_cases::omegas(nearZero)) {
|
for (const Vector3& omega : test_cases::omegas(nearZero)) {
|
||||||
|
@ -412,7 +412,7 @@ TEST(SO3, ApplyLeftJacobian) {
|
||||||
Matrix aH1, aH2;
|
Matrix aH1, aH2;
|
||||||
for (bool nearZero : {true, false}) {
|
for (bool nearZero : {true, false}) {
|
||||||
std::function<Vector3(const Vector3&, const Vector3&)> f =
|
std::function<Vector3(const Vector3&, const Vector3&)> f =
|
||||||
[=](const Vector3& omega, const Vector3& v) {
|
[nearZero](const Vector3& omega, const Vector3& v) {
|
||||||
return so3::DexpFunctor(omega, nearZero).applyLeftJacobian(v);
|
return so3::DexpFunctor(omega, nearZero).applyLeftJacobian(v);
|
||||||
};
|
};
|
||||||
for (const Vector3& omega : test_cases::omegas(nearZero)) {
|
for (const Vector3& omega : test_cases::omegas(nearZero)) {
|
||||||
|
@ -433,7 +433,7 @@ TEST(SO3, ApplyLeftJacobianInverse) {
|
||||||
Matrix aH1, aH2;
|
Matrix aH1, aH2;
|
||||||
for (bool nearZero : {true, false}) {
|
for (bool nearZero : {true, false}) {
|
||||||
std::function<Vector3(const Vector3&, const Vector3&)> f =
|
std::function<Vector3(const Vector3&, const Vector3&)> f =
|
||||||
[=](const Vector3& omega, const Vector3& v) {
|
[nearZero](const Vector3& omega, const Vector3& v) {
|
||||||
return so3::DexpFunctor(omega, nearZero).applyLeftJacobianInverse(v);
|
return so3::DexpFunctor(omega, nearZero).applyLeftJacobianInverse(v);
|
||||||
};
|
};
|
||||||
for (const Vector3& omega : test_cases::omegas(nearZero)) {
|
for (const Vector3& omega : test_cases::omegas(nearZero)) {
|
||||||
|
|
|
@ -144,7 +144,7 @@ TEST(CombinedImuFactor, FirstOrderPreIntegratedMeasurements) {
|
||||||
auto p = testing::Params();
|
auto p = testing::Params();
|
||||||
testing::SomeMeasurements measurements;
|
testing::SomeMeasurements measurements;
|
||||||
|
|
||||||
auto preintegrated = [=](const Vector3& a, const Vector3& w) {
|
auto preintegrated = [&](const Vector3& a, const Vector3& w) {
|
||||||
PreintegratedImuMeasurements pim(p, Bias(a, w));
|
PreintegratedImuMeasurements pim(p, Bias(a, w));
|
||||||
testing::integrateMeasurements(measurements, &pim);
|
testing::integrateMeasurements(measurements, &pim);
|
||||||
return pim.preintegrated();
|
return pim.preintegrated();
|
||||||
|
|
|
@ -399,7 +399,7 @@ TEST(ImuFactor, PartialDerivative_wrt_Bias) {
|
||||||
Vector3 measuredOmega(0.1, 0, 0);
|
Vector3 measuredOmega(0.1, 0, 0);
|
||||||
double deltaT = 0.5;
|
double deltaT = 0.5;
|
||||||
|
|
||||||
auto evaluateRotation = [=](const Vector3 biasOmega) {
|
auto evaluateRotation = [&measuredOmega, &deltaT](const Vector3 biasOmega) {
|
||||||
return Rot3::Expmap((measuredOmega - biasOmega) * deltaT);
|
return Rot3::Expmap((measuredOmega - biasOmega) * deltaT);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ TEST(ImuFactor, PartialDerivativeLogmap) {
|
||||||
// Measurements
|
// Measurements
|
||||||
Vector3 deltaTheta(0, 0, 0);
|
Vector3 deltaTheta(0, 0, 0);
|
||||||
|
|
||||||
auto evaluateLogRotation = [=](const Vector3 delta) {
|
auto evaluateLogRotation = [&thetaHat](const Vector3 delta) {
|
||||||
return Rot3::Logmap(
|
return Rot3::Logmap(
|
||||||
Rot3::Expmap(thetaHat).compose(Rot3::Expmap(delta)));
|
Rot3::Expmap(thetaHat).compose(Rot3::Expmap(delta)));
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,21 +43,21 @@ TEST(ManifoldPreintegration, BiasCorrectionJacobians) {
|
||||||
testing::SomeMeasurements measurements;
|
testing::SomeMeasurements measurements;
|
||||||
|
|
||||||
std::function<Rot3(const Vector3&, const Vector3&)> deltaRij =
|
std::function<Rot3(const Vector3&, const Vector3&)> deltaRij =
|
||||||
[=](const Vector3& a, const Vector3& w) {
|
[&](const Vector3& a, const Vector3& w) {
|
||||||
ManifoldPreintegration pim(testing::Params(), Bias(a, w));
|
ManifoldPreintegration pim(testing::Params(), Bias(a, w));
|
||||||
testing::integrateMeasurements(measurements, &pim);
|
testing::integrateMeasurements(measurements, &pim);
|
||||||
return pim.deltaRij();
|
return pim.deltaRij();
|
||||||
};
|
};
|
||||||
|
|
||||||
std::function<Point3(const Vector3&, const Vector3&)> deltaPij =
|
std::function<Point3(const Vector3&, const Vector3&)> deltaPij =
|
||||||
[=](const Vector3& a, const Vector3& w) {
|
[&](const Vector3& a, const Vector3& w) {
|
||||||
ManifoldPreintegration pim(testing::Params(), Bias(a, w));
|
ManifoldPreintegration pim(testing::Params(), Bias(a, w));
|
||||||
testing::integrateMeasurements(measurements, &pim);
|
testing::integrateMeasurements(measurements, &pim);
|
||||||
return pim.deltaPij();
|
return pim.deltaPij();
|
||||||
};
|
};
|
||||||
|
|
||||||
std::function<Vector3(const Vector3&, const Vector3&)> deltaVij =
|
std::function<Vector3(const Vector3&, const Vector3&)> deltaVij =
|
||||||
[=](const Vector3& a, const Vector3& w) {
|
[&](const Vector3& a, const Vector3& w) {
|
||||||
ManifoldPreintegration pim(testing::Params(), Bias(a, w));
|
ManifoldPreintegration pim(testing::Params(), Bias(a, w));
|
||||||
testing::integrateMeasurements(measurements, &pim);
|
testing::integrateMeasurements(measurements, &pim);
|
||||||
return pim.deltaVij();
|
return pim.deltaVij();
|
||||||
|
|
|
@ -78,7 +78,7 @@ TEST(ImuFactor, BiasCorrectionJacobians) {
|
||||||
testing::SomeMeasurements measurements;
|
testing::SomeMeasurements measurements;
|
||||||
|
|
||||||
std::function<Vector9(const Vector3&, const Vector3&)> preintegrated =
|
std::function<Vector9(const Vector3&, const Vector3&)> preintegrated =
|
||||||
[=](const Vector3& a, const Vector3& w) {
|
[&](const Vector3& a, const Vector3& w) {
|
||||||
TangentPreintegration pim(testing::Params(), Bias(a, w));
|
TangentPreintegration pim(testing::Params(), Bias(a, w));
|
||||||
testing::integrateMeasurements(measurements, &pim);
|
testing::integrateMeasurements(measurements, &pim);
|
||||||
return pim.preintegrated();
|
return pim.preintegrated();
|
||||||
|
@ -149,7 +149,7 @@ TEST(TangentPreintegration, Compose) {
|
||||||
TEST(TangentPreintegration, MergedBiasDerivatives) {
|
TEST(TangentPreintegration, MergedBiasDerivatives) {
|
||||||
testing::SomeMeasurements measurements;
|
testing::SomeMeasurements measurements;
|
||||||
|
|
||||||
auto f = [=](const Vector3& a, const Vector3& w) {
|
auto f = [&](const Vector3& a, const Vector3& w) {
|
||||||
TangentPreintegration pim02(testing::Params(), Bias(a, w));
|
TangentPreintegration pim02(testing::Params(), Bias(a, w));
|
||||||
testing::integrateMeasurements(measurements, &pim02);
|
testing::integrateMeasurements(measurements, &pim02);
|
||||||
testing::integrateMeasurements(measurements, &pim02);
|
testing::integrateMeasurements(measurements, &pim02);
|
||||||
|
|
Loading…
Reference in New Issue