Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: VladyslavUsenko/basalt
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: SpectacularAI/basalt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.

Commits on Aug 7, 2022

  1. Change Basalt headers to point to Spectacular AI fork w/ full Kannala…

    …-Brandt camera support
    oseiskar committed Aug 7, 2022
    Copy the full SHA
    aa76d97 View commit details

Commits on Aug 9, 2022

  1. Copy the full SHA
    ac50b25 View commit details
  2. Copy the full SHA
    f6c2490 View commit details
  3. Copy the full SHA
    73c0804 View commit details

Commits on Aug 12, 2022

  1. Copy the full SHA
    87108e9 View commit details

Commits on Aug 13, 2022

  1. Copy the full SHA
    edc4bcb View commit details

Commits on Aug 15, 2022

  1. Copy the full SHA
    e8b6742 View commit details
  2. Merge pull request #2 from SpectacularAI/fix-nan-crash

    Fixed a crash when trying to use invalid ransac result
    Bercon authored Aug 15, 2022
    Copy the full SHA
    e92f5af View commit details

Commits on Aug 16, 2022

  1. Support older TBB versions

    By setting TBB_PREVIEW_CONCURRENT_ORDERED_CONTAINERS
    oseiskar committed Aug 16, 2022
    Copy the full SHA
    cd81e84 View commit details

Commits on Mar 14, 2024

  1. Copy the full SHA
    7fda8ed View commit details

Commits on Jun 26, 2024

  1. Copy the full SHA
    3937d51 View commit details
  2. Copy the full SHA
    c791885 View commit details

Commits on Jun 27, 2024

  1. Fix assertion

    oseiskar committed Jun 27, 2024
    Copy the full SHA
    7b16f17 View commit details

Commits on Jun 28, 2024

  1. Copy the full SHA
    4af7213 View commit details

Commits on Jun 30, 2024

  1. Copy the full SHA
    5f6d218 View commit details
  2. Copy the full SHA
    95cea01 View commit details
  3. Copy the full SHA
    b72fbaf View commit details
  4. Calibration tweak: only optimize the part of the sequence with calibr…

    …ation pattern detections
    oseiskar committed Jun 30, 2024
    Copy the full SHA
    1e381cd View commit details

Commits on Jul 1, 2024

  1. Copy the full SHA
    d4cf4a1 View commit details
  2. Stereo calibration tweaks

    oseiskar committed Jul 1, 2024
    Copy the full SHA
    ee5b254 View commit details

Commits on Jul 2, 2024

  1. Copy the full SHA
    32deaa7 View commit details

Commits on Jul 3, 2024

  1. Copy the full SHA
    aa56447 View commit details
  2. Add min and max frame to IMU calibration to manually limit the the le…

    …ngth and dimension of the optimized trajectory
    oseiskar committed Jul 3, 2024
    Copy the full SHA
    6718160 View commit details

Commits on Jul 19, 2024

  1. Add max_intrinsics limiter to camera calib UI (#5)

    Usage:
     1. Click all buttons up to and including init_cam_intr
     2. Optionally, click all the way to init_cam_extr
     3. Adjust max_intrinsics (NOTE: includes fx,fy,ppx,ppy in count)
     4. Click on init_cam_intr again
     5. Continue where you left of after 1 (and 2)
    
    Limitation: if the intrinsic count is limited, will initialize
    everything except fx,fy,ppx,ppy to zero.
    oseiskar authored Jul 19, 2024
    Copy the full SHA
    63593a0 View commit details

Commits on Dec 19, 2024

  1. Copy the full SHA
    a6e830e View commit details
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
url = https://github.com/ros/console_bridge.git
[submodule "thirdparty/basalt-headers"]
path = thirdparty/basalt-headers
url = https://gitlab.com/VladyslavUsenko/basalt-headers.git
url = https://github.com/SpectacularAI/basalt-headers.git
[submodule "thirdparty/magic_enum"]
path = thirdparty/magic_enum
url = https://github.com/Neargye/magic_enum.git
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -292,8 +292,8 @@ add_library(basalt SHARED)
# To support cmake < 3.13, use absolute paths (see: https://crascit.com/2016/01/31/enhanced-source-file-handling-with-target_sources/)
target_sources(basalt
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include/basalt/calibration/aprilgrid.h
${CMAKE_CURRENT_SOURCE_DIR}/include/basalt/calibration/calibration_helper.h
${CMAKE_CURRENT_SOURCE_DIR}/include/basalt/calibration/calibration_pattern.h
${CMAKE_CURRENT_SOURCE_DIR}/include/basalt/calibration/cam_calib.h
${CMAKE_CURRENT_SOURCE_DIR}/include/basalt/calibration/cam_imu_calib.h
${CMAKE_CURRENT_SOURCE_DIR}/include/basalt/calibration/vignette.h
@@ -351,8 +351,8 @@ target_sources(basalt
${CMAKE_CURRENT_SOURCE_DIR}/include/basalt/vi_estimator/sqrt_keypoint_vo.h
${CMAKE_CURRENT_SOURCE_DIR}/include/basalt/vi_estimator/vio_estimator.h
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/calibration/aprilgrid.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/calibration/calibraiton_helper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/calibration/calibration_pattern.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/calibration/vignette.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/io/dataset_io.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/io/marg_data_io.cpp
19 changes: 10 additions & 9 deletions include/basalt/calibration/calibration_helper.h
Original file line number Diff line number Diff line change
@@ -34,12 +34,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once

#include <basalt/calibration/aprilgrid.h>
#include <basalt/calibration/calibration_pattern.h>
#include <basalt/io/dataset_io.h>
#include <basalt/utils/common_types.h>
#include <basalt/calibration/calibration.hpp>

#define TBB_PREVIEW_CONCURRENT_ORDERED_CONTAINERS 1
#include <tbb/concurrent_unordered_map.h>
#include <tbb/concurrent_map.h>

namespace basalt {

@@ -72,29 +74,28 @@ using CalibCornerMap = tbb::concurrent_unordered_map<TimeCamId, CalibCornerData,
std::hash<TimeCamId>>;

using CalibInitPoseMap =
tbb::concurrent_unordered_map<TimeCamId, CalibInitPoseData,
std::hash<TimeCamId>>;
tbb::concurrent_map<TimeCamId, CalibInitPoseData>;

class CalibHelper {
public:
static void detectCorners(const VioDatasetPtr& vio_data,
const AprilGrid& april_grid,
const CalibrationPattern& calib_pattern,
CalibCornerMap& calib_corners,
CalibCornerMap& calib_corners_rejected);

static void initCamPoses(
const Calibration<double>::Ptr& calib,
const Eigen::aligned_vector<Eigen::Vector4d>& aprilgrid_corner_pos_3d,
const Eigen::aligned_vector<Eigen::Vector4d>& corner_pos_3d,
CalibCornerMap& calib_corners, CalibInitPoseMap& calib_init_poses);

static bool initializeIntrinsics(
const Eigen::aligned_vector<Eigen::Vector2d>& corners,
const std::vector<int>& corner_ids, const AprilGrid& aprilgrid, int cols,
const std::vector<int>& corner_ids, const CalibrationPattern& calib_pattern, int cols,
int rows, Eigen::Vector4d& init_intr);

static bool initializeIntrinsicsPinhole(
const std::vector<CalibCornerData*> pinhole_corners,
const AprilGrid& aprilgrid, int cols, int rows,
const CalibrationPattern& calib_pattern, int cols, int rows,
Eigen::Vector4d& init_intr);

private:
@@ -106,14 +107,14 @@ class CalibHelper {

static void computeInitialPose(
const Calibration<double>::Ptr& calib, size_t cam_id,
const Eigen::aligned_vector<Eigen::Vector4d>& aprilgrid_corner_pos_3d,
const Eigen::aligned_vector<Eigen::Vector4d>& corner_pos_3d,
const basalt::CalibCornerData& cd, basalt::CalibInitPoseData& cp);

static size_t computeReprojectionError(
const UnifiedCamera<double>& cam_calib,
const Eigen::aligned_vector<Eigen::Vector2d>& corners,
const std::vector<int>& corner_ids,
const Eigen::aligned_vector<Eigen::Vector4d>& aprilgrid_corner_pos_3d,
const Eigen::aligned_vector<Eigen::Vector4d>& corner_pos_3d,
const Sophus::SE3d& T_target_camera, double& error);
};

Original file line number Diff line number Diff line change
@@ -35,23 +35,33 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once

#include <basalt/utils/sophus_utils.hpp>
#include <vector>
#include <memory>

namespace basalt {
struct ImageData;
struct CalibCornerData;

struct AprilGrid {
AprilGrid(const std::string &config_path);
class CalibrationPattern {
public:
CalibrationPattern(const std::string &config_path);
~CalibrationPattern();

Eigen::aligned_vector<Eigen::Vector4d> aprilgrid_corner_pos_3d;
Eigen::aligned_vector<Eigen::Vector4d> aprilgrid_vignette_pos_3d;
Eigen::aligned_vector<Eigen::Vector4d> corner_pos_3d;
Eigen::aligned_vector<Eigen::Vector4d> vignette_pos_3d;

inline int getTagCols() const { return tagCols; }
inline int getTagRows() const { return tagRows; }
void detectCorners(const ImageData &img,
CalibCornerData &goodCorners,
CalibCornerData &badCorners,
const int64_t timestamp_ns,
int camIdx) const;

// Returns a list of lines, each of which consists of a list of corner IDs
std::vector<std::vector<int>> getFocalLengthTestLines() const;

private:
int tagCols; // number of apriltags
int tagRows; // number of apriltags
double tagSize; // size of apriltag, edge to edge [m]
double tagSpacing; // ratio of space between tags to tagSize
struct Impl;
std::unique_ptr<Impl> pImpl;
};

} // namespace basalt
12 changes: 9 additions & 3 deletions include/basalt/calibration/cam_calib.h
Original file line number Diff line number Diff line change
@@ -43,12 +43,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <Eigen/Dense>

#include <functional>
#include <iostream>
#include <limits>
#include <thread>

#include <basalt/calibration/aprilgrid.h>
#include <basalt/calibration/calibration_helper.h>
#include <basalt/calibration/calibration_pattern.h>
#include <basalt/image/image.h>
#include <basalt/utils/test_utils.h>
#include <basalt/utils/sophus_utils.hpp>
@@ -60,7 +61,7 @@ class PosesOptimization;
class CamCalib {
public:
CamCalib(const std::string &dataset_path, const std::string &dataset_type,
const std::string &aprilgrid_path, const std::string &cache_path,
const std::string &calib_pattern_path, const std::string &cache_path,
const std::string &cache_dataset_name, int skip_images,
const std::vector<std::string> &cam_types, bool show_gui = true);

@@ -126,7 +127,7 @@ class CamCalib {
std::string dataset_path;
std::string dataset_type;

AprilGrid april_grid;
CalibrationPattern calib_pattern;

std::string cache_path;
std::string cache_dataset_name;
@@ -142,6 +143,7 @@ class CamCalib {
//////////////////////

pangolin::Var<int> show_frame;
pangolin::Var<std::function<void(void)>> next_frame;

pangolin::Var<bool> show_corners;
pangolin::Var<bool> show_corners_rejected;
@@ -153,6 +155,10 @@ class CamCalib {
pangolin::Var<double> huber_thresh;

pangolin::Var<bool> opt_intr;
pangolin::Var<bool> opt_extrinsic_trans;
// maximum number of instrinsic parameters to optimize (including fx,fy,ppx,ppy)
// 0 means unlimited
pangolin::Var<int> max_intrinsics;

pangolin::Var<bool> opt_until_convg;
pangolin::Var<double> stop_thresh;
14 changes: 10 additions & 4 deletions include/basalt/calibration/cam_imu_calib.h
Original file line number Diff line number Diff line change
@@ -43,12 +43,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <Eigen/Dense>

#include <functional>
#include <iostream>
#include <limits>
#include <thread>

#include <basalt/calibration/aprilgrid.h>
#include <basalt/calibration/calibration_helper.h>
#include <basalt/calibration/calibration_pattern.h>
#include <basalt/utils/test_utils.h>
#include <basalt/utils/sophus_utils.hpp>

@@ -60,14 +61,16 @@ class SplineOptimization;
class CamImuCalib {
public:
CamImuCalib(const std::string &dataset_path, const std::string &dataset_type,
const std::string &aprilgrid_path, const std::string &cache_path,
const std::string &calib_pattern_path, const std::string &cache_path,
const std::string &cache_dataset_name, int skip_images,
const std::vector<double> &imu_noise, bool show_gui = true);

~CamImuCalib();

void initGui();

void resetCalibOpt();

void setNumCameras(size_t n);

void renderingLoop();
@@ -123,7 +126,7 @@ class CamImuCalib {
std::string dataset_path;
std::string dataset_type;

AprilGrid april_grid;
CalibrationPattern calib_pattern;

std::string cache_path;
std::string cache_dataset_name;
@@ -132,13 +135,14 @@ class CamImuCalib {

bool show_gui;

const size_t MIN_CORNERS = 15;
const size_t MIN_CORNERS = 4;

std::vector<double> imu_noise;

//////////////////////

pangolin::Var<int> show_frame;
pangolin::Var<std::function<void(void)>> next_frame;

pangolin::Var<bool> show_corners;
pangolin::Var<bool> show_corners_rejected;
@@ -167,6 +171,8 @@ class CamImuCalib {
pangolin::Var<bool> opt_mocap;

pangolin::Var<double> huber_thresh;
pangolin::Var<int> min_opt_frame;
pangolin::Var<int> max_opt_frame;

pangolin::Var<bool> opt_until_convg;
pangolin::Var<double> stop_thresh;
6 changes: 3 additions & 3 deletions include/basalt/calibration/vignette.h
Original file line number Diff line number Diff line change
@@ -34,8 +34,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once

#include <basalt/calibration/aprilgrid.h>
#include <basalt/calibration/calibration_helper.h>
#include <basalt/calibration/calibration_pattern.h>

#include <basalt/spline/rd_spline.h>

@@ -53,7 +53,7 @@ class VignetteEstimator {
const Eigen::aligned_vector<Eigen::Vector2i> &resolutions,
const std::map<TimeCamId, Eigen::aligned_vector<Eigen::Vector3d>>
&reprojected_vignette,
const AprilGrid &april_grid);
const CalibrationPattern &calib_pattern);

void compute_error(std::map<TimeCamId, std::vector<double>>
*reprojected_vignette_error = nullptr);
@@ -80,7 +80,7 @@ class VignetteEstimator {
Eigen::aligned_vector<Eigen::Vector2i> resolutions;
std::map<TimeCamId, Eigen::aligned_vector<Eigen::Vector3d>>
reprojected_vignette;
const AprilGrid &april_grid;
const CalibrationPattern &calib_pattern;

size_t vign_size;
std::vector<double> irradiance;
6 changes: 5 additions & 1 deletion include/basalt/io/dataset_io.h
Original file line number Diff line number Diff line change
@@ -61,6 +61,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <basalt/image/image.h>
#include <basalt/utils/assert.h>

#include <basalt/calibration/calibration.hpp>
#include <basalt/camera/generic_camera.hpp>
#include <basalt/camera/stereographic_param.hpp>

@@ -71,6 +72,7 @@ struct ImageData {

ManagedImage<uint16_t>::Ptr img;
double exposure;
int index = -1;
};

struct Observations {
@@ -102,7 +104,7 @@ struct MocapPoseData {
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};

struct AprilgridCornersData {
struct CalibrationPatternCornersData {
int64_t timestamp_ns;
int cam_id;

@@ -126,6 +128,8 @@ class VioDataset {
virtual int64_t get_mocap_to_imu_offset_ns() const = 0;
virtual std::vector<ImageData> get_image_data(int64_t t_ns) = 0;

virtual Calibration<double> *get_calib() { return nullptr; }

EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};

12 changes: 7 additions & 5 deletions include/basalt/optimization/linearize.h
Original file line number Diff line number Diff line change
@@ -74,8 +74,8 @@ struct LinearizeBase {
typedef typename Eigen::aligned_vector<GyroData>::const_iterator GyroDataIter;
typedef
typename Eigen::aligned_vector<AccelData>::const_iterator AccelDataIter;
typedef typename Eigen::aligned_vector<AprilgridCornersData>::const_iterator
AprilgridCornersDataIter;
typedef typename Eigen::aligned_vector<CalibrationPatternCornersData>::const_iterator
CalibrationPatternCornersDataIter;

template <int INTRINSICS_SIZE>
struct PoseCalibH {
@@ -99,7 +99,7 @@ struct LinearizeBase {
struct CalibCommonData {
const Calibration<Scalar>* calibration = nullptr;
const MocapCalibration<Scalar>* mocap_calibration = nullptr;
const Eigen::aligned_vector<Eigen::Vector4d>* aprilgrid_corner_pos_3d =
const Eigen::aligned_vector<Eigen::Vector4d>* calib_corner_pos_3d =
nullptr;

// Calib data
@@ -115,6 +115,8 @@ struct LinearizeBase {
const Vector3* g = nullptr;

bool opt_intrinsics;
bool opt_extrinsic_trans;
int max_intrinsics = 0;

// Cam-IMU options
bool opt_cam_time_offset;
@@ -140,11 +142,11 @@ struct LinearizeBase {
Eigen::Matrix<double, 2, CamT::N> d_r_d_param;

BASALT_ASSERT_STREAM(
corner_id < int(common_data.aprilgrid_corner_pos_3d->size()),
corner_id < int(common_data.calib_corner_pos_3d->size()),
"corner_id " << corner_id);

Eigen::Vector4d point3d =
T_c_w * common_data.aprilgrid_corner_pos_3d->at(corner_id);
T_c_w * common_data.calib_corner_pos_3d->at(corner_id);

Eigen::Vector2d proj;
bool valid;
Loading