diff --git a/.github/workflows/build-python.yml b/.github/workflows/build-python.yml index 57b4435aff..f581a5974f 100644 --- a/.github/workflows/build-python.yml +++ b/.github/workflows/build-python.yml @@ -138,7 +138,12 @@ jobs: # Use the prebuilt binary for Windows $Url = "https://sourceforge.net/projects/boost/files/boost-binaries/$env:BOOST_VERSION/$env:BOOST_EXE-${{matrix.platform}}.exe" - (New-Object System.Net.WebClient).DownloadFile($Url, "$env:TEMP\boost.exe") + + # Create WebClient with appropriate settings and download Boost exe + $wc = New-Object System.Net.Webclient + $wc.Headers.Add("User-Agent: Other"); + $wc.DownloadFile($Url, "$env:TEMP\boost.exe") + Start-Process -Wait -FilePath "$env:TEMP\boost.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=$BOOST_PATH" # Set the BOOST_ROOT variable diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 1bda7e40ac..20b4a846f9 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -70,9 +70,6 @@ jobs: } if ("${{ matrix.compiler }}" -eq "gcc") { - # Chocolatey GCC is broken on the windows-2019 image. - # See: https://github.com/DaanDeMeyer/doctest/runs/231595515 - # See: https://github.community/t5/GitHub-Actions/Something-is-wrong-with-the-chocolatey-installed-version-of-gcc/td-p/32413 scoop install gcc --global echo "CC=gcc" >> $GITHUB_ENV echo "CXX=g++" >> $GITHUB_ENV @@ -98,7 +95,12 @@ jobs: # Use the prebuilt binary for Windows $Url = "https://sourceforge.net/projects/boost/files/boost-binaries/$env:BOOST_VERSION/$env:BOOST_EXE-${{matrix.platform}}.exe" - (New-Object System.Net.WebClient).DownloadFile($Url, "$env:TEMP\boost.exe") + + # Create WebClient with appropriate settings and download Boost exe + $wc = New-Object System.Net.Webclient + $wc.Headers.Add("User-Agent: Other"); + $wc.DownloadFile($Url, "$env:TEMP\boost.exe") + Start-Process -Wait -FilePath "$env:TEMP\boost.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=$BOOST_PATH" # Set the BOOST_ROOT variable diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in index 36906d090d..338ff85004 100644 --- a/cmake/Config.cmake.in +++ b/cmake/Config.cmake.in @@ -15,10 +15,12 @@ endif() # Find dependencies, required by cmake exported targets: include(CMakeFindDependencyMacro) # Allow using cmake < 3.8 -if(${CMAKE_VERSION} VERSION_LESS "3.8.0") -find_package(Boost @BOOST_FIND_MINIMUM_VERSION@ COMPONENTS @BOOST_FIND_MINIMUM_COMPONENTS@) -else() -find_dependency(Boost @BOOST_FIND_MINIMUM_VERSION@ COMPONENTS @BOOST_FIND_MINIMUM_COMPONENTS@) +if (@GTSAM_ENABLE_BOOST_SERIALIZATION@ OR @GTSAM_USE_BOOST_FEATURES@) + if(${CMAKE_VERSION} VERSION_LESS "3.8.0") + find_package(Boost @BOOST_FIND_MINIMUM_VERSION@ COMPONENTS @BOOST_FIND_MINIMUM_COMPONENTS@) + else() + find_dependency(Boost @BOOST_FIND_MINIMUM_VERSION@ COMPONENTS @BOOST_FIND_MINIMUM_COMPONENTS@) + endif() endif() if(@GTSAM_USE_TBB@) diff --git a/gtsam/inference/Factor.h b/gtsam/inference/Factor.h index f073c4975b..074151e166 100644 --- a/gtsam/inference/Factor.h +++ b/gtsam/inference/Factor.h @@ -24,13 +24,13 @@ #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION #include #endif -#include -#include - -#include #include +#include #include +#include +#include + namespace gtsam { /// Define collection types: diff --git a/gtsam/slam/TriangulationFactor.h b/gtsam/slam/TriangulationFactor.h index 32aa590a65..3b8486a594 100644 --- a/gtsam/slam/TriangulationFactor.h +++ b/gtsam/slam/TriangulationFactor.h @@ -34,6 +34,8 @@ class TriangulationFactor: public NoiseModelFactorN { /// CAMERA type using Camera = CAMERA; + /// shorthand for measurement type, e.g. Point2 or StereoPoint2 + using Measurement = typename CAMERA::Measurement; protected: @@ -43,9 +45,6 @@ class TriangulationFactor: public NoiseModelFactorN { /// shorthand for this class using This = TriangulationFactor; - /// shorthand for measurement type, e.g. Point2 or StereoPoint2 - using Measurement = typename CAMERA::Measurement; - // Keep a copy of measurement and calibration for I/O const CAMERA camera_; ///< CAMERA in which this landmark was seen const Measurement measured_; ///< 2D measurement diff --git a/gtsam/slam/slam.i b/gtsam/slam/slam.i index f054aaab42..97dcfcae7b 100644 --- a/gtsam/slam/slam.i +++ b/gtsam/slam/slam.i @@ -347,11 +347,50 @@ virtual class FrobeniusBetweenFactor : gtsam::NoiseModelFactor { gtsam::Vector evaluateError(const T& R1, const T& R2); }; - + +#include +template +virtual class TriangulationFactor : gtsam::NoiseModelFactor { + TriangulationFactor(); + TriangulationFactor(const CAMERA& camera, const gtsam::This::Measurement& measured, + const gtsam::noiseModel::Base* model, gtsam::Key pointKey, + bool throwCheirality = false, + bool verboseCheirality = false); + + void print(const string& s = "", const gtsam::KeyFormatter& keyFormatter = + gtsam::DefaultKeyFormatter) const; + bool equals(const This& p, double tol = 1e-9) const; + + gtsam::Vector evaluateError(const gtsam::Point3& point) const; + + const gtsam::This::Measurement& measured() const; +}; +typedef gtsam::TriangulationFactor> + TriangulationFactorCal3_S2; +typedef gtsam::TriangulationFactor> + TriangulationFactorCal3DS2; +typedef gtsam::TriangulationFactor> + TriangulationFactorCal3Bundler; +typedef gtsam::TriangulationFactor> + TriangulationFactorCal3Fisheye; +typedef gtsam::TriangulationFactor> + TriangulationFactorCal3Unified; + +typedef gtsam::TriangulationFactor> + TriangulationFactorPoseCal3_S2; +typedef gtsam::TriangulationFactor> + TriangulationFactorPoseCal3DS2; +typedef gtsam::TriangulationFactor> + TriangulationFactorPoseCal3Bundler; +typedef gtsam::TriangulationFactor> + TriangulationFactorPoseCal3Fisheye; +typedef gtsam::TriangulationFactor> + TriangulationFactorPoseCal3Unified; + #include namespace lago { gtsam::Values initialize(const gtsam::NonlinearFactorGraph& graph, bool useOdometricPath = true); gtsam::Values initialize(const gtsam::NonlinearFactorGraph& graph, const gtsam::Values& initialGuess); } - + } // namespace gtsam diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 674f17d3fd..5012189249 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -257,7 +257,7 @@ if(GTSAM_UNSTABLE_BUILD_PYTHON) COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=${GTSAM_PYTHON_BUILD_DIRECTORY}/$ENV{PYTHONPATH}" - pybind11-stubgen -o . --enum-class-locations \"KernelFunctionType|NoiseFormat:gtsam.gtsam\" --enum-class-locations \"OrderingType:gtsam.gtsam.Ordering\" --numpy-array-use-type-var gtsam_unstable + pybind11-stubgen -o . --enum-class-locations \"KernelFunctionType|NoiseFormat:gtsam.gtsam\" --enum-class-locations \"OrderingType:gtsam.gtsam.Ordering\" --numpy-array-use-type-var --ignore-all-errors gtsam_unstable DEPENDS ${GTSAM_PYTHON_DEPENDENCIES} ${GTSAM_PYTHON_TEST_FILES} ${GTSAM_PYTHON_UNSTABLE_TARGET} WORKING_DIRECTORY "${GTSAM_PYTHON_BUILD_DIRECTORY}/" ) @@ -284,7 +284,7 @@ add_custom_target( COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=${GTSAM_PYTHON_BUILD_DIRECTORY}/$ENV{PYTHONPATH}" - pybind11-stubgen -o . --enum-class-locations \"KernelFunctionType|NoiseFormat:gtsam.gtsam\" --enum-class-locations \"OrderingType:gtsam.gtsam.Ordering\" --numpy-array-use-type-var gtsam + pybind11-stubgen -o . --enum-class-locations \"KernelFunctionType|NoiseFormat:gtsam.gtsam\" --enum-class-locations \"OrderingType:gtsam.gtsam.Ordering\" --numpy-array-use-type-var --ignore-all-errors gtsam DEPENDS ${GTSAM_PYTHON_DEPENDENCIES} ${GTSAM_PYTHON_TEST_FILES} ${GTSAM_PYTHON_TARGET} WORKING_DIRECTORY "${GTSAM_PYTHON_BUILD_DIRECTORY}/" )