Skip to content

Instantly share code, notes, and snippets.

# BSD 2-Clause License
#
# Copyright (c) 2014-2019, Nikolaus Demmel
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
// (C) Copyright 2015 - 2018 Christopher Beck
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef VISIT_STRUCT_HPP_INCLUDED
#define VISIT_STRUCT_HPP_INCLUDED
/***
* Provides a facility to declare a structure as "visitable" and apply a visitor
@NikolausDemmel
NikolausDemmel / pinhole-radtan4.hpp
Created January 2, 2022 20:59
Pinhole Radtan 4 example
template <typename Derived_>
class PinholeRadTan4CameraBase
: public AbstractCamera<
typename Eigen::internal::traits<Derived_>::Scalar> {
public:
DBATK_DEFINE_CAMERA_MODEL_BASE_CLASS_BOILERPLATE(PinholeRadTan4Camera)
DBATK_DEFINE_CAMERA_MODEL_ACCESSOR(fx, 0);
DBATK_DEFINE_CAMERA_MODEL_ACCESSOR(fy, 1);
@NikolausDemmel
NikolausDemmel / ceres-per-residual-robust-norm.cpp
Last active August 25, 2021 08:33
Per-residual robust norm with ceres AutoDiff (hacky)
///////////////////////////////////////////////////////////////////////////////
//
// This is exemplar code how one can implement per-residual robust norms in
// ceres while still grouping residual blocks into logical units > size 1.
// Having residual blocks of size > 1 may make sense to get them treated as one
// unit in Schur complement, and they may share substantial amount of
// computation. This is for example true for a photometric reprojection residual
// with all the pixels in one patch being projected with the same depth
// parameter.
//
$ /usr/bin/time -v ./bin/bundle_adjuster -use_quaternions -use_local_parameterization -num_threads 12 -num_iterations 20 -linear_solver sparse_schur -input problem-13682-4456117-pre.txt -v 3 -logtostderr -sparse_linear_algebra_library cx_sparse
I1030 18:13:42.591603 4171415 bal_problem.cc:85] Header: 13682 4456117 28987644
I1030 18:14:11.254379 4171415 bal_problem.cc:276] median: 00-1.2963 -0.297856 001.84581
I1030 18:14:11.254501 4171415 bal_problem.cc:277] median absolute deviation: 13.1983
I1030 18:14:11.254508 4171415 bal_problem.cc:278] scale: 7.57676
I1030 18:16:06.547497 4171415 wall_time.cc:84]
ComputeStableSchurOrdering
Delta Cumulative
CreateHessianGraph : 29.59815 29.59815
@NikolausDemmel
NikolausDemmel / ceres 1.14 calib example output
Last active August 29, 2020 13:37
lie spline timing ceres 1.14 vs 2.2
Running calibration with ceres_se3_old method
g_a initialized with -0.118566 9.55362 1.03586
mean error 72.997 num_points 291612
Solver Summary (v 1.14.0-eigen-(3.3.7)-lapack-suitesparse-(5.1.2)-cxsparse-(3.1.9)-eigensparse-no_openmp-no_tbb)
Original Reduced
Parameter blocks 5194 5193
Parameters 36346 36339
Effective parameters 31155 31149
@NikolausDemmel
NikolausDemmel / ceres 1.14
Created August 29, 2020 13:23
ceres 1.14 vs 2.0 bundle adjustment with photometric residuals
iter cost cost_change |gradient| |step| tr_ratio tr_radius ls_iter iter_time total_time
0 6.278079e+09 0.00e+00 2.00e+08 0.00e+00 0.00e+00 1.00e+10 0 4.22e+01 2.40e+02
1 5.390256e+09 8.88e+08 2.00e+08 6.00e+01 1.81e+00 3.00e+10 1 6.64e+01 3.44e+02
2 4.989417e+09 4.01e+08 2.00e+08 4.89e+01 1.77e+00 9.00e+10 1 5.84e+01 4.39e+02
3 4.785329e+09 2.04e+08 2.00e+08 4.36e+01 1.76e+00 2.70e+11 1 5.90e+01 5.36e+02
4 4.672209e+09 1.13e+08 2.00e+08 4.32e+01 1.76e+00 8.10e+11 1 5.86e+01 6.32e+02
5 4.604432e+09 6.78e+07 2.00e+08 6.78e+01 1.75e+00 2.43e+12 1 5.83e+01 7.28e+02
6 4.560632e+09 4.38e+07 2.00e+08 1.13e+02 1.73e+00 7.29e+12 1 5.85e+01 8.24e+02
7 4.531752e+09 2.89e+07 2.00e+08 1.81e+02 1.60e+00 2.19e+13 1 5.85e+01 9.20e+02
8 4.508471e+09 2.33e+07 2.00e+08 1.20e+0
demmeln@atcremers67:/tmp$ mkdir -p test/src
demmeln@atcremers67:/tmp$ cd test/src/
demmeln@atcremers67:/tmp/test/src$ git clone https://github.com/NikolausDemmel/aruco
Cloning into 'aruco'...
remote: Counting objects: 860, done.
remote: Compressing objects: 100% (451/451), done.
remote: Total 860 (delta 391), reused 860 (delta 391), pack-reused 0
Receiving objects: 100% (860/860), 10.27 MiB | 3.66 MiB/s, done.
Resolving deltas: 100% (391/391), done.
Checking connectivity... done.
@NikolausDemmel
NikolausDemmel / .dockerignore
Last active February 2, 2017 19:43
MARV Robotics EE docker
*
!Dockerfile
!certificates/
!marv_entrypoint.sh
!marv_env.sh
!src
src/*/.git
@NikolausDemmel
NikolausDemmel / Dockerfile
Last active January 24, 2017 22:56
Dockerfile for marv-robotics
FROM ros:indigo
MAINTAINER Nikolaus Demmel <Nikolaus.Demmel@de.bosch.com>
################################################################################
## ARGUMENTS
# optional use --build-arg or ARG for proxy variables instead, but for our case
# we want them set also in the running container for convenience
ARG DOCKER_HOST_IP=172.17.0.1
ENV no_proxy="127.0.0.1,$DOCKER_HOST_IP"