Merge pull request #1984 from borglab/fixes
commit
199b6cfcaa
|
@ -52,6 +52,8 @@ function configure()
|
||||||
-DGTSAM_POSE3_EXPMAP=${GTSAM_POSE3_EXPMAP:-ON} \
|
-DGTSAM_POSE3_EXPMAP=${GTSAM_POSE3_EXPMAP:-ON} \
|
||||||
-DGTSAM_USE_SYSTEM_EIGEN=${GTSAM_USE_SYSTEM_EIGEN:-OFF} \
|
-DGTSAM_USE_SYSTEM_EIGEN=${GTSAM_USE_SYSTEM_EIGEN:-OFF} \
|
||||||
-DGTSAM_USE_SYSTEM_METIS=${GTSAM_USE_SYSTEM_METIS:-OFF} \
|
-DGTSAM_USE_SYSTEM_METIS=${GTSAM_USE_SYSTEM_METIS:-OFF} \
|
||||||
|
-DGTSAM_USE_BOOST_FEATURES=${GTSAM_USE_BOOST_FEATURES:-ON} \
|
||||||
|
-DGTSAM_ENABLE_BOOST_SERIALIZATION=${GTSAM_ENABLE_BOOST_SERIALIZATION:-ON} \
|
||||||
-DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF \
|
-DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF \
|
||||||
-DGTSAM_SINGLE_TEST_EXE=OFF
|
-DGTSAM_SINGLE_TEST_EXE=OFF
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,11 +25,12 @@ jobs:
|
||||||
# Github Actions requires a single row to be added to the build matrix.
|
# Github Actions requires a single row to be added to the build matrix.
|
||||||
# See https://help.github.com/en/articles/workflow-syntax-for-github-actions.
|
# See https://help.github.com/en/articles/workflow-syntax-for-github-actions.
|
||||||
name: [
|
name: [
|
||||||
ubuntu-20.04-gcc-9,
|
# "Bracket" the versions from GCC [9-14] and Clang [9-16]
|
||||||
ubuntu-20.04-clang-9,
|
ubuntu-20.04-gcc-9,
|
||||||
ubuntu-22.04-gcc-12,
|
ubuntu-20.04-clang-9,
|
||||||
ubuntu-22.04-clang-14,
|
ubuntu-24.04-gcc-14,
|
||||||
]
|
ubuntu-24.04-clang-16,
|
||||||
|
]
|
||||||
|
|
||||||
build_type: [Debug, Release]
|
build_type: [Debug, Release]
|
||||||
build_unstable: [ON]
|
build_unstable: [ON]
|
||||||
|
@ -44,16 +45,16 @@ jobs:
|
||||||
compiler: clang
|
compiler: clang
|
||||||
version: "9"
|
version: "9"
|
||||||
|
|
||||||
- name: ubuntu-22.04-gcc-12
|
- name: ubuntu-24.04-gcc-14
|
||||||
os: ubuntu-22.04
|
os: ubuntu-24.04
|
||||||
compiler: gcc
|
compiler: gcc
|
||||||
version: "11"
|
|
||||||
|
|
||||||
- name: ubuntu-22.04-clang-14
|
|
||||||
os: ubuntu-22.04
|
|
||||||
compiler: clang
|
|
||||||
version: "14"
|
version: "14"
|
||||||
|
|
||||||
|
- name: ubuntu-24.04-clang-16
|
||||||
|
os: ubuntu-24.04
|
||||||
|
compiler: clang
|
||||||
|
version: "16"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
|
@ -115,19 +115,24 @@ jobs:
|
||||||
echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV
|
echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Install Boost
|
|
||||||
if: runner.os == 'Linux'
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y install libboost-all-dev
|
|
||||||
|
|
||||||
- name: Install (macOS)
|
- name: Install (macOS)
|
||||||
if: runner.os == 'macOS'
|
if: runner.os == 'macOS'
|
||||||
run: |
|
run: |
|
||||||
brew install cmake ninja boost
|
brew install cmake ninja
|
||||||
sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app
|
sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app
|
||||||
echo "CC=clang" >> $GITHUB_ENV
|
echo "CC=clang" >> $GITHUB_ENV
|
||||||
echo "CXX=clang++" >> $GITHUB_ENV
|
echo "CXX=clang++" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Install Boost
|
||||||
|
run: |
|
||||||
|
if [ ${{matrix.flag}} != 'no_boost' ]; then
|
||||||
|
if [ ${{runner.os}} == 'Linux' ]; then
|
||||||
|
sudo apt-get -y install libboost-all-dev
|
||||||
|
elif [ ${{runner.os}} == 'macOS' ]; then
|
||||||
|
brew install boost
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Set Allow Deprecated Flag
|
- name: Set Allow Deprecated Flag
|
||||||
if: matrix.flag == 'deprecated'
|
if: matrix.flag == 'deprecated'
|
||||||
run: |
|
run: |
|
||||||
|
@ -181,7 +186,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
swap-size-gb: 12
|
swap-size-gb: 12
|
||||||
|
|
||||||
|
|
||||||
- name: Build & Test
|
- name: Build & Test
|
||||||
run: |
|
run: |
|
||||||
bash .github/scripts/unix.sh -t
|
bash .github/scripts/unix.sh -t
|
||||||
|
|
|
@ -48,7 +48,8 @@
|
||||||
*/
|
*/
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#if __GNUC__ >= 7 && __cplusplus >= 201703L
|
#if __GNUC__ >= 7 && __cplusplus >= 201703L
|
||||||
namespace boost { namespace serialization { struct U; } }
|
// Based on https://github.com/borglab/gtsam/issues/1738, we define U as a complete type.
|
||||||
|
namespace boost { namespace serialization { struct U{}; } }
|
||||||
namespace std { template<> struct is_trivially_default_constructible<boost::serialization::U> : std::false_type {}; }
|
namespace std { template<> struct is_trivially_default_constructible<boost::serialization::U> : std::false_type {}; }
|
||||||
namespace std { template<> struct is_trivially_copy_constructible<boost::serialization::U> : std::false_type {}; }
|
namespace std { template<> struct is_trivially_copy_constructible<boost::serialization::U> : std::false_type {}; }
|
||||||
namespace std { template<> struct is_trivially_move_constructible<boost::serialization::U> : std::false_type {}; }
|
namespace std { template<> struct is_trivially_move_constructible<boost::serialization::U> : std::false_type {}; }
|
||||||
|
|
|
@ -60,8 +60,6 @@ public:
|
||||||
TestOptionalStruct() = default;
|
TestOptionalStruct() = default;
|
||||||
TestOptionalStruct(const int& opt)
|
TestOptionalStruct(const int& opt)
|
||||||
: opt(opt) {}
|
: opt(opt) {}
|
||||||
// A copy constructor is needed for serialization
|
|
||||||
TestOptionalStruct(const TestOptionalStruct& other) = default;
|
|
||||||
bool operator==(const TestOptionalStruct& other) const {
|
bool operator==(const TestOptionalStruct& other) const {
|
||||||
// check the values are equal
|
// check the values are equal
|
||||||
return *opt == *other.opt;
|
return *opt == *other.opt;
|
||||||
|
|
|
@ -20,12 +20,15 @@
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
/* ********************************************************************************************* */
|
/* ************************************************************************* */
|
||||||
InequalityPenaltyFunction::UnaryScalarFunc InequalityPenaltyFunction::function() const {
|
InequalityPenaltyFunction::UnaryScalarFunc InequalityPenaltyFunction::function()
|
||||||
return [=](const double& x, OptionalJacobian<1, 1> H = {}) -> double { return (*this)(x, H); };
|
const {
|
||||||
|
return [this](const double& x, OptionalJacobian<1, 1> H = {}) {
|
||||||
|
return this->operator()(x, H);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************************************************* */
|
/* ************************************************************************* */
|
||||||
double RampFunction::Ramp(const double x, OptionalJacobian<1, 1> H) {
|
double RampFunction::Ramp(const double x, OptionalJacobian<1, 1> H) {
|
||||||
if (x < 0) {
|
if (x < 0) {
|
||||||
if (H) {
|
if (H) {
|
||||||
|
@ -40,8 +43,9 @@ double RampFunction::Ramp(const double x, OptionalJacobian<1, 1> H) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************************************************* */
|
/* ************************************************************************* */
|
||||||
double SmoothRampPoly2::operator()(const double& x, OptionalJacobian<1, 1> H) const {
|
double SmoothRampPoly2::operator()(const double& x,
|
||||||
|
OptionalJacobian<1, 1> H) const {
|
||||||
if (x <= 0) {
|
if (x <= 0) {
|
||||||
if (H) {
|
if (H) {
|
||||||
H->setZero();
|
H->setZero();
|
||||||
|
@ -60,8 +64,9 @@ double SmoothRampPoly2::operator()(const double& x, OptionalJacobian<1, 1> H) co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************************************************* */
|
/* ************************************************************************* */
|
||||||
double SmoothRampPoly3::operator()(const double& x, OptionalJacobian<1, 1> H) const {
|
double SmoothRampPoly3::operator()(const double& x,
|
||||||
|
OptionalJacobian<1, 1> H) const {
|
||||||
if (x <= 0) {
|
if (x <= 0) {
|
||||||
if (H) {
|
if (H) {
|
||||||
H->setZero();
|
H->setZero();
|
||||||
|
@ -80,8 +85,9 @@ double SmoothRampPoly3::operator()(const double& x, OptionalJacobian<1, 1> H) co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************************************************* */
|
/* ************************************************************************* */
|
||||||
double SoftPlusFunction::operator()(const double& x, OptionalJacobian<1, 1> H) const {
|
double SoftPlusFunction::operator()(const double& x,
|
||||||
|
OptionalJacobian<1, 1> H) const {
|
||||||
if (H) {
|
if (H) {
|
||||||
H->setConstant(1 / (1 + std::exp(-k_ * x)));
|
H->setConstant(1 / (1 + std::exp(-k_ * x)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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