diff --git a/.clang-format b/.clang-format
new file mode 100644
index 000000000..88156faef
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,76 @@
+---
+# This was copied over from the moveit_studio repository.
+BasedOnStyle: Google
+ColumnLimit: 120
+MaxEmptyLinesToKeep: 1
+SortIncludes: false
+
+Standard: Auto
+IndentWidth: 2
+TabWidth: 2
+UseTab: Never
+AccessModifierOffset: -2
+ConstructorInitializerIndentWidth: 2
+NamespaceIndentation: None
+ContinuationIndentWidth: 4
+IndentCaseLabels: true
+IndentFunctionDeclarationAfterType: false
+
+AlignEscapedNewlinesLeft: false
+AlignTrailingComments: true
+
+AllowAllParametersOfDeclarationOnNextLine: false
+ExperimentalAutoDetectBinPacking: false
+ObjCSpaceBeforeProtocolList: true
+Cpp11BracedListStyle: false
+
+AllowShortBlocksOnASingleLine: true
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: None
+AllowShortCaseLabelsOnASingleLine: false
+
+AlwaysBreakTemplateDeclarations: true
+AlwaysBreakBeforeMultilineStrings: false
+BreakBeforeBinaryOperators: false
+BreakBeforeTernaryOperators: false
+BreakConstructorInitializersBeforeComma: true
+
+BinPackParameters: true
+ConstructorInitializerAllOnOneLineOrOnePerLine: true
+DerivePointerBinding: false
+PointerBindsToType: true
+
+PenaltyExcessCharacter: 50
+PenaltyBreakBeforeFirstCallParameter: 30
+PenaltyBreakComment: 1000
+PenaltyBreakFirstLessLess: 10
+PenaltyBreakString: 100
+PenaltyReturnTypeOnItsOwnLine: 50
+
+SpacesBeforeTrailingComments: 2
+SpacesInParentheses: false
+SpacesInAngles: false
+SpaceInEmptyParentheses: false
+SpacesInCStyleCastParentheses: false
+SpaceAfterCStyleCast: false
+SpaceAfterControlStatementKeyword: true
+SpaceBeforeAssignmentOperators: true
+
+# Configure each individual brace in BraceWrapping
+BreakBeforeBraces: Custom
+
+# Control of individual brace wrapping cases
+BraceWrapping:
+ AfterCaseLabel: true
+ AfterClass: true
+ AfterControlStatement: true
+ AfterEnum: true
+ AfterFunction: true
+ AfterNamespace: true
+ AfterStruct: true
+ AfterUnion: true
+ BeforeCatch: true
+ BeforeElse: true
+ IndentBraces: false
+...
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 000000000..693d15f05
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,57 @@
+---
+# This was copied over from the moveit_studio repository.
+#
+# TODO(henningkayser): Re-enable performance-unnecessary-value-param once #214 is resolved
+Checks: '-*,
+ performance-*,
+ -performance-unnecessary-value-param,
+ llvm-namespace-comment,
+ modernize-redundant-void-arg,
+ modernize-use-nullptr,
+ modernize-use-default,
+ modernize-use-override,
+ modernize-loop-convert,
+ readability-braces-around-statements,
+ readability-named-parameter,
+ readability-redundant-smartptr-get,
+ readability-redundant-string-cstr,
+ readability-simplify-boolean-expr,
+ readability-container-size-empty,
+ readability-identifier-naming,
+ '
+HeaderFilterRegex: ''
+AnalyzeTemporaryDtors: false
+CheckOptions:
+ - key: llvm-namespace-comment.ShortNamespaceLines
+ value: '10'
+ - key: llvm-namespace-comment.SpacesBeforeComments
+ value: '2'
+ - key: readability-braces-around-statements.ShortStatementLines
+ value: '2'
+ # type names
+ - key: readability-identifier-naming.ClassCase
+ value: CamelCase
+ - key: readability-identifier-naming.EnumCase
+ value: CamelCase
+ - key: readability-identifier-naming.EnumConstantCase
+ value: CamelCase
+ - key: readability-identifier-naming.UnionCase
+ value: CamelCase
+ # method names
+ - key: readability-identifier-naming.MethodCase
+ value: camelBack
+ # variable names
+ - key: readability-identifier-naming.VariableCase
+ value: lower_case
+ - key: readability-identifier-naming.ClassMemberSuffix
+ value: '_'
+ # const static, constexpr or global variables are camelBack (we write them as kMyConstant)
+ - key: readability-identifier-naming.ConstexprVariableCase
+ value: camelBack
+ - key: readability-identifier-naming.StaticConstantCase
+ value: camelBack
+ - key: readability-identifier-naming.ClassConstantCase
+ value: camelBack
+ - key: readability-identifier-naming.GlobalVariableCase
+ value: camelBack
+...
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
new file mode 100644
index 000000000..03bdea8c8
--- /dev/null
+++ b/.github/workflows/ci.yaml
@@ -0,0 +1,72 @@
+name: CI
+
+on:
+ # Run if someone manually presses the button in the GitHub Actions UI
+ workflow_dispatch:
+ # Run when a PR is opened or updated
+ pull_request:
+ # Run when a commit is pushed to main
+ push:
+ branches:
+ - main
+
+permissions:
+ # Allow reading the source code
+ contents: read
+ # Allow writing built containers to GitHub Package Registry
+ packages: write
+
+jobs:
+ build-ws:
+ name: Build colcon workspace
+ runs-on: ubuntu-24.04
+ steps:
+ - name: Checkout source
+ uses: actions/checkout@v4
+
+ - name: Setup Docker Buildx
+ uses: docker/setup-buildx-action@v2
+
+ # Log into GitHub Container Registry so we can push an image
+ - name: Log in to GHCR
+ uses: docker/login-action@v2
+ with:
+ registry: ghcr.io
+ username: ${{ github.repository_owner }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ # Build the Dockerfile and push the image to the private GitHub Container Registry on this repo
+ - name: Build workspace
+ uses: docker/build-push-action@v4
+ with:
+ context: .
+ # run_id is unique to a particular run of this workflow so shouldn't clobber
+ tags: ghcr.io/picknikrobotics/fuse:${{ github.run_id }}
+ push: true
+ # This project is small enough that caching to GitHub Actions should be fine (it has a 10GB cache limit)
+ cache-to: type=gha,mode=max
+ cache-from: type=gha
+
+ test-ws:
+ name: Test colcon workspace
+ needs:
+ # Ensure the test job runs after the build job finishes instead of attempting to run in parallel
+ - build-ws
+ runs-on: ubuntu-24.04
+ container:
+ # Run on the Docker image we tagged and pushed to a private repo in the job above
+ image: ghcr.io/picknikrobotics/fuse:${{ github.run_id }}
+ steps:
+ - name: Unit test workspace
+ run: |
+ . /opt/ros/rolling/setup.sh
+ . /colcon_ws/install/local_setup.sh
+ colcon test --event-handlers console_direct+ --retest-until-pass 3
+ working-directory: /colcon_ws
+
+ # `colcon test` does not actually error on failure - run `colcon test-result` to generate a summary and an error code.
+ - name: Display colcon test results
+ # Run this step even if a previous step failed
+ if: always()
+ run: colcon test-result --verbose
+ working-directory: /colcon_ws
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
new file mode 100644
index 000000000..416508d7a
--- /dev/null
+++ b/.github/workflows/pre-commit.yml
@@ -0,0 +1,29 @@
+# see https://github.com/pre-commit/action
+
+name: pre-commit
+
+on:
+ workflow_dispatch:
+ pull_request:
+ push:
+ branches:
+ - main
+
+jobs:
+ pre-commit:
+ name: Format
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-python@v5
+ with:
+ python-version: '3.10'
+ - name: Install clang-format-18
+ run: sudo apt-get install clang-format-18
+ - uses: pre-commit/action@v3.0.1
+ id: precommit
+ - name: Upload pre-commit changes
+ if: failure() && steps.precommit.outcome == 'failure'
+ uses: rhaschke/upload-git-patch-action@main
+ with:
+ name: pre-commit
diff --git a/.github/workflows/ros2.yml b/.github/workflows/ros2.yml
new file mode 100644
index 000000000..02f231083
--- /dev/null
+++ b/.github/workflows/ros2.yml
@@ -0,0 +1,15 @@
+name: ros2
+
+on: [push, pull_request]
+
+jobs:
+ industrial_ci:
+ strategy:
+ matrix:
+ env:
+ - {ROS_DISTRO: rolling, ROS_REPO: main}
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v1
+ - uses: 'ros-industrial/industrial_ci@master'
+ env: ${{matrix.env}}
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 000000000..1b5c22bcb
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,83 @@
+# To use:
+#
+# pre-commit run -a
+#
+# Or:
+#
+# pre-commit install # (runs every time you commit in git)
+#
+# To update this file:
+#
+# pre-commit autoupdate
+#
+# See https://github.com/pre-commit/pre-commit
+repos:
+ # Standard hooks
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v3.4.0
+ hooks:
+ - id: check-ast
+ - id: check-case-conflict
+ - id: check-docstring-first
+ - id: check-merge-conflict
+ - id: check-symlinks
+ - id: check-yaml
+ args: ["--unsafe"] # Fixes errors parsing custom YAML constructors like ur_description's !degrees
+ - id: debug-statements
+ - id: end-of-file-fixer
+ - id: mixed-line-ending
+ - id: fix-byte-order-marker
+
+ - repo: https://github.com/astral-sh/ruff-pre-commit
+ rev: v0.3.0
+ hooks:
+ - id: ruff-format
+
+ - repo: https://github.com/pre-commit/mirrors-clang-format
+ rev: v14.0.6
+ hooks:
+ - id: clang-format
+ files: \.(c|cc|cxx|cpp|frag|glsl|h|hpp|hxx|ih|ispc|ipp|java|m|proto|vert)$
+ # -i arg is included by default by the hook
+ args: ["-fallback-style=none"]
+
+ - repo: https://github.com/adrienverge/yamllint
+ rev: v1.27.1
+ hooks:
+ - id: yamllint
+ args:
+ [
+ "--no-warnings",
+ "--config-data",
+ "{extends: default, rules: {line-length: disable, braces: {max-spaces-inside: 1}}}",
+ ]
+ types: [text]
+ files: \.(yml|yaml)$
+
+ - repo: https://github.com/tcort/markdown-link-check
+ rev: v3.12.2
+ hooks:
+ - id: markdown-link-check
+ args:
+ - "-c"
+ - "markdown-link-check-config.json"
+
+ - repo: https://github.com/cheshirekow/cmake-format-precommit
+ rev: v0.6.10
+ hooks:
+ - id: cmake-format
+ - id: cmake-lint
+ args:
+ - "--disabled-codes=C0301" # Disable Line too long lint
+ - "--suppress-decorations"
+
+ - repo: https://github.com/pre-commit/mirrors-prettier
+ rev: "v3.1.0"
+ hooks:
+ # Use Prettier to lint XML files because, well.. its rules are prettier than most linters, as the name implies.
+ # Also we use it in the UI, so it's familiar.
+ - id: prettier
+ additional_dependencies:
+ - "prettier@3.1.0"
+ - "@prettier/plugin-xml@3.3.1"
+ files: \.(xml|xacro)$
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000..d82059ae6
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,38 @@
+# Docker setup that's used for CI.
+
+FROM osrf/ros:rolling-desktop-full
+
+# Install external packages.
+# hadolint ignore=DL3008
+RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
+ --mount=type=cache,target=/var/lib/apt,sharing=locked \
+ apt-get update && apt-get upgrade -y && \
+ apt-get install -y --no-install-recommends \
+ clang-tidy \
+ # use cyclonedds instead of fastdds
+ ros-rolling-rmw-cyclonedds-cpp
+
+# Create the colcon ws. For now, copy the source files into the workspace
+# so that we don't have to deal with cloning this repo, which is private.
+WORKDIR /colcon_ws/src/fuse
+COPY . .
+WORKDIR /colcon_ws
+# hadolint ignore=SC1091
+RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
+ --mount=type=cache,target=/var/lib/apt,sharing=locked \
+ apt-get update && apt-get upgrade -y && \
+ . /opt/ros/rolling/setup.sh && \
+ rosdep install --from-paths src -y --ignore-src && \
+ colcon build --mixin compile-commands coverage-gcc coverage-pytest
+
+# Set up final environment and entrypoint.
+ENV RMW_IMPLEMENTATION rmw_cyclonedds_cpp
+ENV CYCLONEDDS_URI /root/.ros/cyclonedds.xml
+COPY dds/cyclonedds_local.xml $CYCLONEDDS_URI
+COPY .clang-tidy /colcon_ws
+COPY entrypoint.sh /
+ENTRYPOINT [ "/entrypoint.sh" ]
+RUN echo "source /entrypoint.sh" >> ~/.bashrc
+
+ENV SHELL /bin/bash
+CMD ["/bin/bash"]
diff --git a/Jenkinsfile b/Jenkinsfile
index 8080c5a0c..06c18cd4a 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -17,4 +17,4 @@ tailorTestPipeline(
source_branch: 'rolling',
// Docker registry where test image is stored
docker_registry: 'https://084758475884.dkr.ecr.us-east-1.amazonaws.com/locus-tailor'
-)
\ No newline at end of file
+)
diff --git a/dds/cyclonedds_local.xml b/dds/cyclonedds_local.xml
new file mode 100644
index 000000000..a46ad402c
--- /dev/null
+++ b/dds/cyclonedds_local.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+ false
+
+
+ auto
+
+
+
+ 120
+
+
+
diff --git a/doc/Variables.md b/doc/Variables.md
index 4e41fcbf1..d6c067b88 100644
--- a/doc/Variables.md
+++ b/doc/Variables.md
@@ -47,8 +47,6 @@ places where most of the dimensions are unused. However, including too few physi
also leads to inefficient and cumbersome usage when even the simplest of observation models involve many variables.
This is one of those "Goldilocks principle" situations.
-![Goldilocks principle](http://home.netcom.com/~swansont_2/goldilocks.jpg)
-
Understanding how Variable interact with the rest of the system will help in the design of "good" Variable.
* The fuse stack is designed to combine observations _of the same variable identity_ from multiple sources. As
diff --git a/entrypoint.sh b/entrypoint.sh
new file mode 100755
index 000000000..992ad8540
--- /dev/null
+++ b/entrypoint.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+source /opt/ros/rolling/setup.bash
+
+if [ -f /colcon_ws/install/local_setup.bash ]
+then
+ source /colcon_ws/install/local_setup.bash
+fi
+
+exec "$@"
diff --git a/fuse/README.md b/fuse/README.md
index b3c5d812d..0f1c6263b 100644
--- a/fuse/README.md
+++ b/fuse/README.md
@@ -1,2 +1,2 @@
# fuse
-This is the metapackage for the entire fuse stack.
\ No newline at end of file
+This is the metapackage for the entire fuse stack.
diff --git a/fuse_constraints/CHANGELOG.rst b/fuse_constraints/CHANGELOG.rst
index 849586087..2e20464de 100644
--- a/fuse_constraints/CHANGELOG.rst
+++ b/fuse_constraints/CHANGELOG.rst
@@ -7,7 +7,7 @@ Changelog for package fuse_constraints
1.1.1 (2024-05-02)
------------------
-* Required formatting changes for the lastest version of ROS 2 Rolling (`#368 `_)
+* Required formatting changes for the latest version of ROS 2 Rolling (`#368 `_)
* Contributors: Stephen Williams
1.1.0 (2024-04-20)
diff --git a/fuse_constraints/CMakeLists.txt b/fuse_constraints/CMakeLists.txt
index 8640fe075..06091a383 100644
--- a/fuse_constraints/CMakeLists.txt
+++ b/fuse_constraints/CMakeLists.txt
@@ -26,53 +26,104 @@ find_package(glog REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
include(suitesparse-extras.cmake)
-###########
-## Build ##
-###########
-# lint_cmake: -linelength
-# Disable warnings about array bounds with -Wno-array-bounds until gcc 12 fixes this bug:
+# ##############################################################################
+# Build ##
+# ##############################################################################
+# lint_cmake: -linelength Disable warnings about array bounds with
+# -Wno-array-bounds until gcc 12 fixes this bug:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106247
#
# Also reported in Eigen, and confirmed to be due to gcc 12:
# https://gitlab.com/libeigen/eigen/-/issues/2506
#
-# In file included from include/immintrin.h:43,
-# from include/eigen3/Eigen/src/Core/util/ConfigureVectorization.h:361,
-# from include/eigen3/Eigen/Core:22,
-# from include/fuse_core/fuse_macros.h:63,
-# from include/fuse_core/loss.h:37,
-# from include/fuse_core/constraint.h:37,
-# from src/fuse/fuse_constraints/include/fuse_constraints/relative_orientation_3d_stamped_constraint.h:37,
-# from src/fuse/fuse_constraints/src/relative_orientation_3d_stamped_constraint.cpp:34:
-# In function ‘__m256d _mm256_loadu_pd(const double*)’,
-# inlined from ‘Packet Eigen::internal::ploadu(const typename unpacket_traits::type*) [with Packet = __vector(4) double]’ at include/eigen3/Eigen/src/Core/arch/AVX/PacketMath.h:582:129,
-# inlined from ‘Packet Eigen::internal::ploadt(const typename unpacket_traits::type*) [with Packet = __vector(4) double; int Alignment = 0]’ at include/eigen3/Eigen/src/Core/GenericPacketMath.h:969:26,
-# inlined from ‘PacketType Eigen::internal::evaluator >::packet(Eigen::Index) const [with int LoadMode = 0; PacketType = __vector(4) double; Derived = Eigen::Matrix]’ at include/eigen3/Eigen/src/Core/CoreEvaluators.h:245:40,
-# inlined from ‘void Eigen::internal::generic_dense_assignment_kernel::assignPacket(Eigen::Index) [with int StoreMode = 32; int LoadMode = 0; PacketType = __vector(4) double; DstEvaluatorTypeT = Eigen::internal::evaluator > >; SrcEvaluatorTypeT = Eigen::internal::evaluator >; Functor = Eigen::internal::assign_op; int Version = 0]’ at include/eigen3/Eigen/src/Core/AssignEvaluator.h:681:114,
-# inlined from ‘static void Eigen::internal::dense_assignment_loop::run(Kernel&) [with Kernel = Eigen::internal::generic_dense_assignment_kernel > >, Eigen::internal::evaluator >, Eigen::internal::assign_op, 0>]’ at include/eigen3/Eigen/src/Core/AssignEvaluator.h:437:75,
-# inlined from ‘void Eigen::internal::call_dense_assignment_loop(DstXprType&, const SrcXprType&, const Functor&) [with DstXprType = Eigen::Map >; SrcXprType = Eigen::Matrix; Functor = assign_op]’ at include/eigen3/Eigen/src/Core/AssignEvaluator.h:785:37,
-# inlined from ‘static void Eigen::internal::Assignment::run(DstXprType&, const SrcXprType&, const Functor&) [with DstXprType = Eigen::Map >; SrcXprType = Eigen::Matrix; Functor = Eigen::internal::assign_op; Weak = void]’ at include/eigen3/Eigen/src/Core/AssignEvaluator.h:954:31,
-# inlined from ‘void Eigen::internal::call_assignment_no_alias(Dst&, const Src&, const Func&) [with Dst = Eigen::Map >; Src = Eigen::Matrix; Func = assign_op]’ at include/eigen3/Eigen/src/Core/AssignEvaluator.h:890:49,
-# inlined from ‘void Eigen::internal::call_assignment(Dst&, const Src&, const Func&, typename enable_if::value, void*>::type) [with Dst = Eigen::Map >; Src = Eigen::Product, Eigen::Map >, 0>; Func = assign_op]’ at include/eigen3/Eigen/src/Core/AssignEvaluator.h:851:27,
-# inlined from ‘void Eigen::internal::call_assignment(Dst&, const Src&) [with Dst = Eigen::Map >; Src = Eigen::Product, Eigen::Map >, 0>]’ at include/eigen3/Eigen/src/Core/AssignEvaluator.h:836:18,
-# inlined from ‘Derived& Eigen::MatrixBase::operator=(const Eigen::DenseBase&) [with OtherDerived = Eigen::Product, Eigen::Map >, 0>; Derived = Eigen::Map >]’ at include/eigen3/Eigen/src/Core/Assign.h:66:28,
-# inlined from ‘void Eigen::EigenBase::applyThisOnTheLeft(Dest&) const [with Dest = Eigen::Map >; Derived = Eigen::Matrix]’ at include/eigen3/Eigen/src/Core/EigenBase.h:114:9:
-# include/avxintrin.h:893:24: error: array subscript ‘__m256d_u[0]’ is partly outside array bounds of ‘Eigen::internal::plain_matrix_type, Eigen::Map >, 0>, Eigen::Dense>::type [1]’ {aka ‘Eigen::Matrix [1]’} [-Werror=array-bounds]
-# 893 | return *(__m256d_u *)__P;
-# | ^~~
-# In file included from include/eigen3/Eigen/Core:278:
-# include/eigen3/Eigen/src/Core/AssignEvaluator.h: In member function ‘void Eigen::EigenBase::applyThisOnTheLeft(Dest&) const [with Dest = Eigen::Map >; Derived = Eigen::Matrix]’:
-# include/eigen3/Eigen/src/Core/AssignEvaluator.h:850:41: note: at offset [0, 16] into object ‘tmp’ of size 24
-# 850 | typename plain_matrix_type::type tmp(src);
-# | ^~~
-if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0)
+# In file included from include/immintrin.h:43, from
+# include/eigen3/Eigen/src/Core/util/ConfigureVectorization.h:361, from
+# include/eigen3/Eigen/Core:22, from include/fuse_core/fuse_macros.h:63, from
+# include/fuse_core/loss.h:37, from include/fuse_core/constraint.h:37, from
+# src/fuse/fuse_constraints/include/fuse_constraints/relative_orientation_3d_stamped_constraint.h:37,
+# from
+# src/fuse/fuse_constraints/src/relative_orientation_3d_stamped_constraint.cpp:34:
+# In function ‘__m256d _mm256_loadu_pd(const double*)’, inlined from ‘Packet
+# Eigen::internal::ploadu(const typename unpacket_traits::type*) [with Packet
+# = __vector(4) double]’ at
+# include/eigen3/Eigen/src/Core/arch/AVX/PacketMath.h:582:129, inlined from
+# ‘Packet Eigen::internal::ploadt(const typename unpacket_traits::type*)
+# [with Packet = __vector(4) double; int Alignment = 0]’ at
+# include/eigen3/Eigen/src/Core/GenericPacketMath.h:969:26, inlined from
+# ‘PacketType Eigen::internal::evaluator
+# >::packet(Eigen::Index) const [with int LoadMode = 0; PacketType = __vector(4)
+# double; Derived = Eigen::Matrix]’ at
+# include/eigen3/Eigen/src/Core/CoreEvaluators.h:245:40, inlined from ‘void
+# Eigen::internal::generic_dense_assignment_kernel::assignPacket(Eigen::Index) [with int
+# StoreMode = 32; int LoadMode = 0; PacketType = __vector(4) double;
+# DstEvaluatorTypeT =
+# Eigen::internal::evaluator > >;
+# SrcEvaluatorTypeT = Eigen::internal::evaluator >;
+# Functor = Eigen::internal::assign_op; int Version = 0]’ at
+# include/eigen3/Eigen/src/Core/AssignEvaluator.h:681:114, inlined from ‘static
+# void Eigen::internal::dense_assignment_loop::run(Kernel&) [with
+# Kernel =
+# Eigen::internal::generic_dense_assignment_kernel > >, Eigen::internal::evaluator >,
+# Eigen::internal::assign_op, 0>]’ at
+# include/eigen3/Eigen/src/Core/AssignEvaluator.h:437:75, inlined from ‘void
+# Eigen::internal::call_dense_assignment_loop(DstXprType&, const SrcXprType&,
+# const Functor&) [with DstXprType = Eigen::Map >;
+# SrcXprType = Eigen::Matrix; Functor = assign_op]’ at include/eigen3/Eigen/src/Core/AssignEvaluator.h:785:37, inlined
+# from ‘static void Eigen::internal::Assignment::run(DstXprType&, const SrcXprType&, const
+# Functor&) [with DstXprType = Eigen::Map >;
+# SrcXprType = Eigen::Matrix; Functor =
+# Eigen::internal::assign_op; Weak = void]’ at
+# include/eigen3/Eigen/src/Core/AssignEvaluator.h:954:31, inlined from ‘void
+# Eigen::internal::call_assignment_no_alias(Dst&, const Src&, const Func&) [with
+# Dst = Eigen::Map >; Src = Eigen::Matrix; Func = assign_op]’ at
+# include/eigen3/Eigen/src/Core/AssignEvaluator.h:890:49, inlined from ‘void
+# Eigen::internal::call_assignment(Dst&, const Src&, const Func&, typename
+# enable_if::value, void*>::type) [with Dst =
+# Eigen::Map >; Src =
+# Eigen::Product,
+# Eigen::Map >, 0>; Func = assign_op]’ at include/eigen3/Eigen/src/Core/AssignEvaluator.h:851:27, inlined
+# from ‘void Eigen::internal::call_assignment(Dst&, const Src&) [with Dst =
+# Eigen::Map >; Src =
+# Eigen::Product,
+# Eigen::Map >, 0>]’ at
+# include/eigen3/Eigen/src/Core/AssignEvaluator.h:836:18, inlined from ‘Derived&
+# Eigen::MatrixBase::operator=(const Eigen::DenseBase&)
+# [with OtherDerived = Eigen::Product,
+# Eigen::Map >, 0>; Derived =
+# Eigen::Map >]’ at
+# include/eigen3/Eigen/src/Core/Assign.h:66:28, inlined from ‘void
+# Eigen::EigenBase::applyThisOnTheLeft(Dest&) const [with Dest =
+# Eigen::Map >; Derived = Eigen::Matrix]’ at include/eigen3/Eigen/src/Core/EigenBase.h:114:9:
+# include/avxintrin.h:893:24: error: array subscript ‘__m256d_u[0]’ is partly
+# outside array bounds of
+# ‘Eigen::internal::plain_matrix_type, Eigen::Map >, 0>, Eigen::Dense>::type [1]’
+# {aka ‘Eigen::Matrix [1]’} [-Werror=array-bounds] 893 | return
+# *(__m256d_u *)__P; | ^~~ In file included from
+# include/eigen3/Eigen/Core:278:
+# include/eigen3/Eigen/src/Core/AssignEvaluator.h: In member function ‘void
+# Eigen::EigenBase::applyThisOnTheLeft(Dest&) const [with Dest =
+# Eigen::Map >; Derived = Eigen::Matrix]’: include/eigen3/Eigen/src/Core/AssignEvaluator.h:850:41: note: at
+# offset [0, 16] into object ‘tmp’ of size 24 850 | typename
+# plain_matrix_type::type tmp(src); | ^~~
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION
+ VERSION_GREATER_EQUAL 12.0)
add_compile_options(-Wall -Werror -Wno-array-bounds)
else()
add_compile_options(-Wall -Werror)
endif()
# fuse_constraints library
-add_library(${PROJECT_NAME}
+add_library(
+ ${PROJECT_NAME}
src/absolute_constraint.cpp
src/absolute_orientation_3d_stamped_constraint.cpp
src/absolute_orientation_3d_stamped_euler_constraint.cpp
@@ -91,60 +142,48 @@ add_library(${PROJECT_NAME}
src/relative_pose_2d_stamped_constraint.cpp
src/relative_pose_3d_stamped_constraint.cpp
src/uuid_ordering.cpp
- src/variable_constraints.cpp
-)
-target_include_directories(${PROJECT_NAME} PUBLIC
- "$"
- "$"
-)
-target_link_libraries(${PROJECT_NAME} PUBLIC
- Boost::serialization
- Ceres::ceres
- Eigen3::Eigen
- fuse_core::fuse_core
- fuse_graphs::fuse_graphs
- fuse_variables::fuse_variables
- ${geometry_msgs_TARGETS}
- pluginlib::pluginlib
- rclcpp::rclcpp
-)
-target_link_libraries(${PROJECT_NAME} PRIVATE
- ${SUITESPARSE_LIBRARIES}
-)
-target_include_directories(${PROJECT_NAME} PRIVATE
- ${SUITESPARSE_INCLUDE_DIRS}
-)
-
-#############
-## Testing ##
-#############
+ src/variable_constraints.cpp)
+target_include_directories(
+ ${PROJECT_NAME}
+ PUBLIC "$"
+ "$")
+target_link_libraries(
+ ${PROJECT_NAME}
+ PUBLIC Boost::serialization
+ Ceres::ceres
+ Eigen3::Eigen
+ fuse_core::fuse_core
+ fuse_graphs::fuse_graphs
+ fuse_variables::fuse_variables
+ ${geometry_msgs_TARGETS}
+ pluginlib::pluginlib
+ rclcpp::rclcpp)
+target_link_libraries(${PROJECT_NAME} PRIVATE ${SUITESPARSE_LIBRARIES})
+target_include_directories(${PROJECT_NAME} PRIVATE ${SUITESPARSE_INCLUDE_DIRS})
+
+# ##############################################################################
+# Testing ##
+# ##############################################################################
if(BUILD_TESTING)
- find_package(ament_lint_auto REQUIRED)
- ament_lint_auto_find_test_dependencies()
-
add_subdirectory(test)
add_subdirectory(benchmark)
endif()
-#############
-## Install ##
-#############
+# ##############################################################################
+# Install ##
+# ##############################################################################
-install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-export
+install(
+ TARGETS ${PROJECT_NAME}
+ EXPORT ${PROJECT_NAME}-export
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
- RUNTIME DESTINATION bin
-)
+ RUNTIME DESTINATION bin)
-install(DIRECTORY include/
- DESTINATION include/${PROJECT_NAME}
-)
+install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME})
-install(
- DIRECTORY cmake
- DESTINATION share/${PROJECT_NAME}
-)
+install(DIRECTORY cmake DESTINATION share/${PROJECT_NAME})
pluginlib_export_plugin_description_file(fuse_core fuse_plugins.xml)
@@ -159,7 +198,6 @@ ament_export_dependencies(
rclcpp
Ceres
Eigen3
- glog
-)
+ glog)
ament_package(CONFIG_EXTRAS suitesparse-extras.cmake)
diff --git a/fuse_constraints/benchmark/CMakeLists.txt b/fuse_constraints/benchmark/CMakeLists.txt
index f7aa03cdd..9a4cd8661 100644
--- a/fuse_constraints/benchmark/CMakeLists.txt
+++ b/fuse_constraints/benchmark/CMakeLists.txt
@@ -2,20 +2,18 @@
find_package(benchmark QUIET)
if(benchmark_FOUND)
# Normal Delta Pose 2D benchmark
- add_executable(benchmark_normal_delta_pose_2d benchmark_normal_delta_pose_2d.cpp)
+ add_executable(benchmark_normal_delta_pose_2d
+ benchmark_normal_delta_pose_2d.cpp)
if(TARGET benchmark_normal_delta_pose_2d)
- target_link_libraries(benchmark_normal_delta_pose_2d
- benchmark::benchmark
- ${PROJECT_NAME}
- )
+ target_link_libraries(benchmark_normal_delta_pose_2d benchmark::benchmark
+ ${PROJECT_NAME})
endif()
# Normal Prior Pose 2D benchmark
- add_executable(benchmark_normal_prior_pose_2d benchmark_normal_prior_pose_2d.cpp)
+ add_executable(benchmark_normal_prior_pose_2d
+ benchmark_normal_prior_pose_2d.cpp)
if(TARGET benchmark_normal_prior_pose_2d)
- target_link_libraries(benchmark_normal_prior_pose_2d
- benchmark::benchmark
- ${PROJECT_NAME}
- )
+ target_link_libraries(benchmark_normal_prior_pose_2d benchmark::benchmark
+ ${PROJECT_NAME})
endif()
endif()
diff --git a/fuse_constraints/benchmark/benchmark_normal_delta_pose_2d.cpp b/fuse_constraints/benchmark/benchmark_normal_delta_pose_2d.cpp
index 14c1b7d2d..7e489ef1b 100644
--- a/fuse_constraints/benchmark/benchmark_normal_delta_pose_2d.cpp
+++ b/fuse_constraints/benchmark/benchmark_normal_delta_pose_2d.cpp
@@ -43,11 +43,10 @@
class NormalDeltaPose2DBenchmarkFixture : public benchmark::Fixture
{
public:
- NormalDeltaPose2DBenchmarkFixture()
- : jacobians(num_parameter_blocks)
- , J(num_parameter_blocks)
+ NormalDeltaPose2DBenchmarkFixture() : jacobians(num_parameter_blocks), J(num_parameter_blocks)
{
- for (size_t i = 0; i < num_parameter_blocks; ++i) {
+ for (size_t i = 0; i < num_parameter_blocks; ++i)
+ {
J[i].resize(num_residuals, block_sizes[i]);
jacobians[i] = J[i].data();
}
@@ -58,18 +57,18 @@ class NormalDeltaPose2DBenchmarkFixture : public benchmark::Fixture
static const fuse_core::Matrix3d sqrt_information;
// Parameters
- static const double * parameters[];
+ static const double* parameters[];
// Residuals
fuse_core::Vector3d residuals;
- static const std::vector & block_sizes;
+ static const std::vector& block_sizes;
static const size_t num_parameter_blocks;
static const size_t num_residuals;
// Jacobians
- std::vector jacobians;
+ std::vector jacobians;
private:
// Cost function covariance
@@ -88,69 +87,56 @@ class NormalDeltaPose2DBenchmarkFixture : public benchmark::Fixture
};
// Cost function covariance
-const double NormalDeltaPose2DBenchmarkFixture::covariance_diagonal[] = {2e-3, 1e-3, 1e-2};
+const double NormalDeltaPose2DBenchmarkFixture::covariance_diagonal[] = { 2e-3, 1e-3, 1e-2 };
const fuse_core::Matrix3d NormalDeltaPose2DBenchmarkFixture::covariance =
- fuse_core::Vector3d(covariance_diagonal).asDiagonal();
+ fuse_core::Vector3d(covariance_diagonal).asDiagonal();
// Parameter blocks
-const double NormalDeltaPose2DBenchmarkFixture::position1[] = {0.0, 1.0};
-const double NormalDeltaPose2DBenchmarkFixture::orientation1[] = {0.5};
-const double NormalDeltaPose2DBenchmarkFixture::position2[] = {2.0, 3.0};
-const double NormalDeltaPose2DBenchmarkFixture::orientation2[] = {1.5};
+const double NormalDeltaPose2DBenchmarkFixture::position1[] = { 0.0, 1.0 };
+const double NormalDeltaPose2DBenchmarkFixture::orientation1[] = { 0.5 };
+const double NormalDeltaPose2DBenchmarkFixture::position2[] = { 2.0, 3.0 };
+const double NormalDeltaPose2DBenchmarkFixture::orientation2[] = { 1.5 };
// Delta and sqrt information matrix
-const fuse_core::Vector3d NormalDeltaPose2DBenchmarkFixture::delta{1.0, 2.0, 3.0};
-const fuse_core::Matrix3d NormalDeltaPose2DBenchmarkFixture::sqrt_information(covariance.inverse().
- llt().matrixU());
+const fuse_core::Vector3d NormalDeltaPose2DBenchmarkFixture::delta{ 1.0, 2.0, 3.0 };
+const fuse_core::Matrix3d NormalDeltaPose2DBenchmarkFixture::sqrt_information(covariance.inverse().llt().matrixU());
// Parameters
-const double * NormalDeltaPose2DBenchmarkFixture::parameters[] =
-{position1, orientation1, position2, orientation2};
+const double* NormalDeltaPose2DBenchmarkFixture::parameters[] = { position1, orientation1, position2, orientation2 };
-const std::vector & NormalDeltaPose2DBenchmarkFixture::block_sizes = {2, 1, 2, 1};
+const std::vector& NormalDeltaPose2DBenchmarkFixture::block_sizes = { 2, 1, 2, 1 };
const size_t NormalDeltaPose2DBenchmarkFixture::num_parameter_blocks = block_sizes.size();
const size_t NormalDeltaPose2DBenchmarkFixture::num_residuals = 3;
-BENCHMARK_DEFINE_F(
- NormalDeltaPose2DBenchmarkFixture,
- AnalyticNormalDeltaPose2D)(benchmark::State & state)
+BENCHMARK_DEFINE_F(NormalDeltaPose2DBenchmarkFixture, AnalyticNormalDeltaPose2D)(benchmark::State& state)
{
// Create analytic cost function
- const fuse_constraints::NormalDeltaPose2D cost_function{sqrt_information.topRows(state.range(0)),
- delta};
+ const fuse_constraints::NormalDeltaPose2D cost_function{ sqrt_information.topRows(state.range(0)), delta };
- for (auto _ : state) {
+ for (auto _ : state)
+ {
cost_function.Evaluate(parameters, residuals.data(), jacobians.data());
}
}
-BENCHMARK_REGISTER_F(NormalDeltaPose2DBenchmarkFixture, AnalyticNormalDeltaPose2D)->DenseRange(
- 1, 3);
+BENCHMARK_REGISTER_F(NormalDeltaPose2DBenchmarkFixture, AnalyticNormalDeltaPose2D)->DenseRange(1, 3);
-BENCHMARK_DEFINE_F(
- NormalDeltaPose2DBenchmarkFixture,
- AutoDiffNormalDeltaPose2D)(benchmark::State & state)
+BENCHMARK_DEFINE_F(NormalDeltaPose2DBenchmarkFixture, AutoDiffNormalDeltaPose2D)(benchmark::State& state)
{
// Create cost function using automatic differentiation on the cost functor
const auto partial_sqrt_information = sqrt_information.topRows(state.range(0));
- const ceres::AutoDiffCostFunction<
- fuse_constraints::NormalDeltaPose2DCostFunctor,
- ceres::DYNAMIC,
- 2, 1, 2, 1
- >
- cost_function_autodiff(new fuse_constraints::NormalDeltaPose2DCostFunctor(
- partial_sqrt_information,
- delta),
- partial_sqrt_information.rows());
-
- for (auto _ : state) {
+ const ceres::AutoDiffCostFunction
+ cost_function_autodiff(new fuse_constraints::NormalDeltaPose2DCostFunctor(partial_sqrt_information, delta),
+ partial_sqrt_information.rows());
+
+ for (auto _ : state)
+ {
cost_function_autodiff.Evaluate(parameters, residuals.data(), jacobians.data());
}
}
-BENCHMARK_REGISTER_F(NormalDeltaPose2DBenchmarkFixture, AutoDiffNormalDeltaPose2D)->DenseRange(
- 1, 3);
+BENCHMARK_REGISTER_F(NormalDeltaPose2DBenchmarkFixture, AutoDiffNormalDeltaPose2D)->DenseRange(1, 3);
BENCHMARK_MAIN();
diff --git a/fuse_constraints/benchmark/benchmark_normal_prior_pose_2d.cpp b/fuse_constraints/benchmark/benchmark_normal_prior_pose_2d.cpp
index f1808f942..c550a82cf 100644
--- a/fuse_constraints/benchmark/benchmark_normal_prior_pose_2d.cpp
+++ b/fuse_constraints/benchmark/benchmark_normal_prior_pose_2d.cpp
@@ -43,11 +43,10 @@
class NormalPriorPose2DBenchmarkFixture : public benchmark::Fixture
{
public:
- NormalPriorPose2DBenchmarkFixture()
- : jacobians(num_parameter_blocks)
- , J(num_parameter_blocks)
+ NormalPriorPose2DBenchmarkFixture() : jacobians(num_parameter_blocks), J(num_parameter_blocks)
{
- for (size_t i = 0; i < num_parameter_blocks; ++i) {
+ for (size_t i = 0; i < num_parameter_blocks; ++i)
+ {
J[i].resize(num_residuals, block_sizes[i]);
jacobians[i] = J[i].data();
}
@@ -58,18 +57,18 @@ class NormalPriorPose2DBenchmarkFixture : public benchmark::Fixture
static const fuse_core::Matrix3d sqrt_information;
// Parameters
- static const double * parameters[];
+ static const double* parameters[];
// Residuals
fuse_core::Vector3d residuals;
- static const std::vector & block_sizes;
+ static const std::vector& block_sizes;
static const size_t num_parameter_blocks;
static const size_t num_residuals;
// Jacobians
- std::vector jacobians;
+ std::vector jacobians;
private:
// Cost function covariance
@@ -86,66 +85,54 @@ class NormalPriorPose2DBenchmarkFixture : public benchmark::Fixture
};
// Cost function covariance
-const double NormalPriorPose2DBenchmarkFixture::covariance_diagonal[] = {2e-3, 1e-3, 1e-2};
+const double NormalPriorPose2DBenchmarkFixture::covariance_diagonal[] = { 2e-3, 1e-3, 1e-2 };
const fuse_core::Matrix3d NormalPriorPose2DBenchmarkFixture::covariance =
- fuse_core::Vector3d(covariance_diagonal).asDiagonal();
+ fuse_core::Vector3d(covariance_diagonal).asDiagonal();
// Parameter blocks
-const double NormalPriorPose2DBenchmarkFixture::position[] = {0.0, 0.0};
-const double NormalPriorPose2DBenchmarkFixture::orientation[] = {0.0};
+const double NormalPriorPose2DBenchmarkFixture::position[] = { 0.0, 0.0 };
+const double NormalPriorPose2DBenchmarkFixture::orientation[] = { 0.0 };
// Mean and sqrt information matrix
-const fuse_core::Vector3d NormalPriorPose2DBenchmarkFixture::mean{1.0, 2.0, 3.0};
-const fuse_core::Matrix3d NormalPriorPose2DBenchmarkFixture::sqrt_information(covariance.inverse().
- llt().matrixU());
+const fuse_core::Vector3d NormalPriorPose2DBenchmarkFixture::mean{ 1.0, 2.0, 3.0 };
+const fuse_core::Matrix3d NormalPriorPose2DBenchmarkFixture::sqrt_information(covariance.inverse().llt().matrixU());
// Parameters
-const double * NormalPriorPose2DBenchmarkFixture::parameters[] = {position, orientation};
+const double* NormalPriorPose2DBenchmarkFixture::parameters[] = { position, orientation };
-const std::vector & NormalPriorPose2DBenchmarkFixture::block_sizes = {2, 1};
+const std::vector& NormalPriorPose2DBenchmarkFixture::block_sizes = { 2, 1 };
const size_t NormalPriorPose2DBenchmarkFixture::num_parameter_blocks = block_sizes.size();
const size_t NormalPriorPose2DBenchmarkFixture::num_residuals = 3;
-BENCHMARK_DEFINE_F(
- NormalPriorPose2DBenchmarkFixture,
- AnalyticNormalPriorPose2D)(benchmark::State & state)
+BENCHMARK_DEFINE_F(NormalPriorPose2DBenchmarkFixture, AnalyticNormalPriorPose2D)(benchmark::State& state)
{
// Create analytic cost function
- const fuse_constraints::NormalPriorPose2D cost_function{sqrt_information.topRows(state.range(0)),
- mean};
+ const fuse_constraints::NormalPriorPose2D cost_function{ sqrt_information.topRows(state.range(0)), mean };
- for (auto _ : state) {
+ for (auto _ : state)
+ {
cost_function.Evaluate(parameters, residuals.data(), jacobians.data());
}
}
-BENCHMARK_REGISTER_F(NormalPriorPose2DBenchmarkFixture, AnalyticNormalPriorPose2D)->DenseRange(
- 1, 3);
+BENCHMARK_REGISTER_F(NormalPriorPose2DBenchmarkFixture, AnalyticNormalPriorPose2D)->DenseRange(1, 3);
-BENCHMARK_DEFINE_F(
- NormalPriorPose2DBenchmarkFixture,
- AutoDiffNormalPriorPose2D)(benchmark::State & state)
+BENCHMARK_DEFINE_F(NormalPriorPose2DBenchmarkFixture, AutoDiffNormalPriorPose2D)(benchmark::State& state)
{
// Create cost function using automatic differentiation on the cost functor
const auto partial_sqrt_information = sqrt_information.topRows(state.range(0));
- const ceres::AutoDiffCostFunction<
- fuse_constraints::NormalPriorPose2DCostFunctor,
- ceres::DYNAMIC,
- 2, 1
- >
- cost_function_autodiff(new fuse_constraints::NormalPriorPose2DCostFunctor(
- partial_sqrt_information,
- mean),
- partial_sqrt_information.rows());
-
- for (auto _ : state) {
+ const ceres::AutoDiffCostFunction
+ cost_function_autodiff(new fuse_constraints::NormalPriorPose2DCostFunctor(partial_sqrt_information, mean),
+ partial_sqrt_information.rows());
+
+ for (auto _ : state)
+ {
cost_function_autodiff.Evaluate(parameters, residuals.data(), jacobians.data());
}
}
-BENCHMARK_REGISTER_F(NormalPriorPose2DBenchmarkFixture, AutoDiffNormalPriorPose2D)->DenseRange(
- 1, 3);
+BENCHMARK_REGISTER_F(NormalPriorPose2DBenchmarkFixture, AutoDiffNormalPriorPose2D)->DenseRange(1, 3);
BENCHMARK_MAIN();
diff --git a/fuse_constraints/cmake/FindSUITESPARSE.cmake b/fuse_constraints/cmake/FindSUITESPARSE.cmake
index d6d8ae456..db71d1431 100644
--- a/fuse_constraints/cmake/FindSUITESPARSE.cmake
+++ b/fuse_constraints/cmake/FindSUITESPARSE.cmake
@@ -1,30 +1,28 @@
-# Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2015 Google Inc. All rights reserved.
-# http://ceres-solver.org/
+# Ceres Solver - A fast non-linear least squares minimizer Copyright 2015 Google
+# Inc. All rights reserved. http://ceres-solver.org/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of the copyright holder nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
+# * Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# * Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Author: alexs.mac@gmail.com (Alex Stewart)
#
@@ -36,78 +34,60 @@
# SUITESPARSE_FOUND: TRUE iff SuiteSparse and all dependencies have been found.
# SUITESPARSE_INCLUDE_DIRS: Include directories for all SuiteSparse components.
# SUITESPARSE_LIBRARIES: Libraries for all SuiteSparse component libraries and
-# dependencies.
-# SUITESPARSE_VERSION: Extracted from UFconfig.h (<= v3) or
-# SuiteSparse_config.h (>= v4).
-# SUITESPARSE_MAIN_VERSION: Equal to 4 if SUITESPARSE_VERSION = 4.2.1
-# SUITESPARSE_SUB_VERSION: Equal to 2 if SUITESPARSE_VERSION = 4.2.1
-# SUITESPARSE_SUBSUB_VERSION: Equal to 1 if SUITESPARSE_VERSION = 4.2.1
+# dependencies. SUITESPARSE_VERSION: Extracted from UFconfig.h (<= v3) or
+# SuiteSparse_config.h (>= v4). SUITESPARSE_MAIN_VERSION: Equal to 4 if
+# SUITESPARSE_VERSION = 4.2.1 SUITESPARSE_SUB_VERSION: Equal to 2 if
+# SUITESPARSE_VERSION = 4.2.1 SUITESPARSE_SUBSUB_VERSION: Equal to 1 if
+# SUITESPARSE_VERSION = 4.2.1
#
# SUITESPARSE_IS_BROKEN_SHARED_LINKING_UBUNTU_SYSTEM_VERSION: TRUE iff running
-# on Ubuntu, SUITESPARSE_VERSION is 3.4.0 and found SuiteSparse is a system
-# install, in which case found version of SuiteSparse cannot be used to link
-# a shared library due to a bug (static linking is unaffected).
+# on Ubuntu, SUITESPARSE_VERSION is 3.4.0 and found SuiteSparse is a system
+# install, in which case found version of SuiteSparse cannot be used to link a
+# shared library due to a bug (static linking is unaffected).
#
# The following variables control the behaviour of this module:
#
# SUITESPARSE_INCLUDE_DIR_HINTS: List of additional directories in which to
-# search for SuiteSparse includes,
-# e.g: /timbuktu/include.
+# search for SuiteSparse includes, e.g: /timbuktu/include.
# SUITESPARSE_LIBRARY_DIR_HINTS: List of additional directories in which to
-# search for SuiteSparse libraries,
-# e.g: /timbuktu/lib.
+# search for SuiteSparse libraries, e.g: /timbuktu/lib.
#
# The following variables define the presence / includes & libraries for the
# SuiteSparse components searched for, the SUITESPARSE_XX variables are the
# union of the variables for all components.
#
-# == Symmetric Approximate Minimum Degree (AMD)
-# AMD_FOUND
-# AMD_INCLUDE_DIR
+# == Symmetric Approximate Minimum Degree (AMD) AMD_FOUND AMD_INCLUDE_DIR
# AMD_LIBRARY
#
-# == Constrained Approximate Minimum Degree (CAMD)
-# CAMD_FOUND
-# CAMD_INCLUDE_DIR
+# == Constrained Approximate Minimum Degree (CAMD) CAMD_FOUND CAMD_INCLUDE_DIR
# CAMD_LIBRARY
#
-# == Column Approximate Minimum Degree (COLAMD)
-# COLAMD_FOUND
-# COLAMD_INCLUDE_DIR
+# == Column Approximate Minimum Degree (COLAMD) COLAMD_FOUND COLAMD_INCLUDE_DIR
# COLAMD_LIBRARY
#
-# Constrained Column Approximate Minimum Degree (CCOLAMD)
-# CCOLAMD_FOUND
-# CCOLAMD_INCLUDE_DIR
-# CCOLAMD_LIBRARY
+# Constrained Column Approximate Minimum Degree (CCOLAMD) CCOLAMD_FOUND
+# CCOLAMD_INCLUDE_DIR CCOLAMD_LIBRARY
#
# == Sparse Supernodal Cholesky Factorization and Update/Downdate (CHOLMOD)
-# CHOLMOD_FOUND
-# CHOLMOD_INCLUDE_DIR
-# CHOLMOD_LIBRARY
+# CHOLMOD_FOUND CHOLMOD_INCLUDE_DIR CHOLMOD_LIBRARY
#
-# == Multifrontal Sparse QR (SuiteSparseQR)
-# SUITESPARSEQR_FOUND
-# SUITESPARSEQR_INCLUDE_DIR
-# SUITESPARSEQR_LIBRARY
+# == Multifrontal Sparse QR (SuiteSparseQR) SUITESPARSEQR_FOUND
+# SUITESPARSEQR_INCLUDE_DIR SUITESPARSEQR_LIBRARY
#
# == Common configuration for all but CSparse (SuiteSparse version >= 4).
-# SUITESPARSE_CONFIG_FOUND
-# SUITESPARSE_CONFIG_INCLUDE_DIR
+# SUITESPARSE_CONFIG_FOUND SUITESPARSE_CONFIG_INCLUDE_DIR
# SUITESPARSE_CONFIG_LIBRARY
#
# == Common configuration for all but CSparse (SuiteSparse version < 4).
-# UFCONFIG_FOUND
-# UFCONFIG_INCLUDE_DIR
+# UFCONFIG_FOUND UFCONFIG_INCLUDE_DIR
#
# Optional SuiteSparse Dependencies:
#
# == Serial Graph Partitioning and Fill-reducing Matrix Ordering (METIS)
-# METIS_FOUND
-# METIS_LIBRARY
+# METIS_FOUND METIS_LIBRARY
-# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when
-# FindSuiteSparse was invoked.
+# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when FindSuiteSparse
+# was invoked.
macro(SUITESPARSE_RESET_FIND_LIBRARY_PREFIX)
if(MSVC)
set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
@@ -115,9 +95,9 @@ macro(SUITESPARSE_RESET_FIND_LIBRARY_PREFIX)
endmacro()
# Called if we failed to find SuiteSparse or any of it's required dependencies,
-# unsets all public (designed to be used externally) variables and reports
-# error message at priority depending upon [REQUIRED/QUIET/] argument.
-macro(SUITESPARSE_REPORT_NOT_FOUND REASON_MSG)
+# unsets all public (designed to be used externally) variables and reports error
+# message at priority depending upon [REQUIRED/QUIET/] argument.
+macro(SUITESPARSE_REPORT_NOT_FOUND reason_msg)
unset(SUITESPARSE_FOUND)
unset(SUITESPARSE_INCLUDE_DIRS)
unset(SUITESPARSE_LIBRARIES)
@@ -134,18 +114,18 @@ macro(SUITESPARSE_REPORT_NOT_FOUND REASON_MSG)
# Note _FIND_[REQUIRED/QUIETLY] variables defined by FindPackage()
# use the camelcase library name, not uppercase.
if(SuiteSparse_FIND_QUIETLY)
- message(STATUS "Failed to find SuiteSparse - " ${REASON_MSG} ${ARGN})
+ message(STATUS "Failed to find SuiteSparse - " ${reason_msg} ${ARGN})
elseif(SuiteSparse_FIND_REQUIRED)
- message(FATAL_ERROR "Failed to find SuiteSparse - " ${REASON_MSG} ${ARGN})
+ message(FATAL_ERROR "Failed to find SuiteSparse - " ${reason_msg} ${ARGN})
else()
- # Neither QUIETLY nor REQUIRED, use no priority which emits a message
- # but continues configuration and allows generation.
- message("-- Failed to find SuiteSparse - " ${REASON_MSG} ${ARGN})
+ # Neither QUIETLY nor REQUIRED, use no priority which emits a message but
+ # continues configuration and allows generation.
+ message("-- Failed to find SuiteSparse - " ${reason_msg} ${ARGN})
endif()
- # Do not call return(), s/t we keep processing if not called with REQUIRED
- # and report all missing components, rather than bailing after failing to find
- # the first.
+ # Do not call return(), s/t we keep processing if not called with REQUIRED and
+ # report all missing components, rather than bailing after failing to find the
+ # first.
endmacro()
# Protect against any alternative find_package scripts for this library having
@@ -154,108 +134,115 @@ endmacro()
# logic here to fail.
unset(SUITESPARSE_FOUND)
-# Handle possible presence of lib prefix for libraries on MSVC, see
-# also SUITESPARSE_RESET_FIND_LIBRARY_PREFIX().
+# Handle possible presence of lib prefix for libraries on MSVC, see also
+# SUITESPARSE_RESET_FIND_LIBRARY_PREFIX().
if(MSVC)
- # Preserve the caller's original values for CMAKE_FIND_LIBRARY_PREFIXES
- # s/t we can set it back before returning.
+ # Preserve the caller's original values for CMAKE_FIND_LIBRARY_PREFIXES s/t we
+ # can set it back before returning.
set(CALLERS_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
- # The empty string in this list is important, it represents the case when
- # the libraries have no prefix (shared libraries / DLLs).
+ # The empty string in this list is important, it represents the case when the
+ # libraries have no prefix (shared libraries / DLLs).
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "" "${CMAKE_FIND_LIBRARY_PREFIXES}")
endif()
# Specify search directories for include files and libraries (this is the union
# of the search directories for all OSs). Search user-specified hint
-# directories first if supplied, and search user-installed locations first
-# so that we prefer user installs to system installs where both exist.
-list(APPEND SUITESPARSE_CHECK_INCLUDE_DIRS
+# directories first if supplied, and search user-installed locations first so
+# that we prefer user installs to system installs where both exist.
+list(
+ APPEND
+ SUITESPARSE_CHECK_INCLUDE_DIRS
/opt/local/include
/opt/local/include/ufsparse # Mac OS X
/usr/local/homebrew/include # Mac OS X
/usr/local/include
/usr/include)
-list(APPEND SUITESPARSE_CHECK_LIBRARY_DIRS
+list(
+ APPEND
+ SUITESPARSE_CHECK_LIBRARY_DIRS
/opt/local/lib
/opt/local/lib/ufsparse # Mac OS X
/usr/local/homebrew/lib # Mac OS X
/usr/local/lib
/usr/lib)
# Additional suffixes to try appending to each search path.
-list(APPEND SUITESPARSE_CHECK_PATH_SUFFIXES
- suitesparse) # Windows/Ubuntu
+list(APPEND SUITESPARSE_CHECK_PATH_SUFFIXES suitesparse) # Windows/Ubuntu
# Wrappers to find_path/library that pass the SuiteSparse search hints/paths.
#
-# suitesparse_find_component( [FILES name1 [name2 ...]]
-# [LIBRARIES name1 [name2 ...]]
-# [REQUIRED])
-macro(suitesparse_find_component COMPONENT)
+# SUITESPARSE_FIND_COMPONENT( [FILES name1 [name2 ...]] [LIBRARIES
+# name1 [name2 ...]] [REQUIRED])
+
+# cmake-lint: disable=C0103
+macro(SUITESPARSE_FIND_COMPONENT component)
include(CMakeParseArguments)
set(OPTIONS REQUIRED)
set(MULTI_VALUE_ARGS FILES LIBRARIES)
- cmake_parse_arguments(SUITESPARSE_FIND_${COMPONENT}
- "${OPTIONS}" "" "${MULTI_VALUE_ARGS}" ${ARGN})
+ cmake_parse_arguments(SUITESPARSE_FIND_${component} "${OPTIONS}" ""
+ "${MULTI_VALUE_ARGS}" ${ARGN})
- if(SUITESPARSE_FIND_${COMPONENT}_REQUIRED)
- list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS ${COMPONENT}_FOUND)
+ if(SUITESPARSE_FIND_${component}_REQUIRED)
+ list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS ${component}_FOUND)
endif()
- set(${COMPONENT}_FOUND TRUE)
- if(SUITESPARSE_FIND_${COMPONENT}_FILES)
- find_path(${COMPONENT}_INCLUDE_DIR
- NAMES ${SUITESPARSE_FIND_${COMPONENT}_FILES}
+ set(${component}_FOUND TRUE)
+ if(SUITESPARSE_FIND_${component}_FILES)
+ find_path(
+ ${component}_INCLUDE_DIR
+ NAMES ${SUITESPARSE_FIND_${component}_FILES}
HINTS ${SUITESPARSE_INCLUDE_DIR_HINTS}
PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
- if(${COMPONENT}_INCLUDE_DIR)
- message(STATUS "Found ${COMPONENT} headers in: "
- "${${COMPONENT}_INCLUDE_DIR}")
- mark_as_advanced(${COMPONENT}_INCLUDE_DIR)
+ if(${component}_INCLUDE_DIR)
+ message(STATUS "Found ${component} headers in: "
+ "${${component}_INCLUDE_DIR}")
+ mark_as_advanced(${component}_INCLUDE_DIR)
else()
# Specified headers not found.
- set(${COMPONENT}_FOUND FALSE)
- if(SUITESPARSE_FIND_${COMPONENT}_REQUIRED)
+ set(${component}_FOUND FALSE)
+ if(SUITESPARSE_FIND_${component}_REQUIRED)
suitesparse_report_not_found(
- "Did not find ${COMPONENT} header (required SuiteSparse component).")
+ "Did not find ${component} header (required SuiteSparse component).")
else()
- message(STATUS "Did not find ${COMPONENT} header (optional "
- "SuiteSparse component).")
+ message(STATUS "Did not find ${component} header (optional "
+ "SuiteSparse component).")
# Hide optional vars from CMake GUI even if not found.
- mark_as_advanced(${COMPONENT}_INCLUDE_DIR)
+ mark_as_advanced(${component}_INCLUDE_DIR)
endif()
endif()
endif()
- if(SUITESPARSE_FIND_${COMPONENT}_LIBRARIES)
- find_library(${COMPONENT}_LIBRARY
- NAMES ${SUITESPARSE_FIND_${COMPONENT}_LIBRARIES}
+ if(SUITESPARSE_FIND_${component}_LIBRARIES)
+ find_library(
+ ${component}_LIBRARY
+ NAMES ${SUITESPARSE_FIND_${component}_LIBRARIES}
HINTS ${SUITESPARSE_LIBRARY_DIR_HINTS}
PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
- if(${COMPONENT}_LIBRARY)
- message(STATUS "Found ${COMPONENT} library: ${${COMPONENT}_LIBRARY}")
- mark_as_advanced(${COMPONENT}_LIBRARY)
+ if(${component}_LIBRARY)
+ message(STATUS "Found ${component} library: ${${component}_LIBRARY}")
+ mark_as_advanced(${component}_LIBRARY)
else()
# Specified libraries not found.
- set(${COMPONENT}_FOUND FALSE)
- if(SUITESPARSE_FIND_${COMPONENT}_REQUIRED)
+ set(${component}_FOUND FALSE)
+ if(SUITESPARSE_FIND_${component}_REQUIRED)
suitesparse_report_not_found(
- "Did not find ${COMPONENT} library (required SuiteSparse component).")
+ "Did not find ${component} library (required SuiteSparse component).")
else()
- message(STATUS "Did not find ${COMPONENT} library (optional SuiteSparse "
- "dependency)")
+ message(
+ STATUS "Did not find ${component} library (optional SuiteSparse "
+ "dependency)")
# Hide optional vars from CMake GUI even if not found.
- mark_as_advanced(${COMPONENT}_LIBRARY)
+ mark_as_advanced(${component}_LIBRARY)
endif()
endif()
endif()
endmacro()
# Given the number of components of SuiteSparse, and to ensure that the
-# automatic failure message generated by FindPackageHandleStandardArgs()
-# when not all required components are found is helpful, we maintain a list
-# of all variables that must be defined for SuiteSparse to be considered found.
+# automatic failure message generated by FindPackageHandleStandardArgs() when
+# not all required components are found is helpful, we maintain a list of all
+# variables that must be defined for SuiteSparse to be considered found.
unset(SUITESPARSE_FOUND_REQUIRED_VARS)
# BLAS.
@@ -279,47 +266,51 @@ suitesparse_find_component(CAMD REQUIRED FILES camd.h LIBRARIES camd)
suitesparse_find_component(COLAMD REQUIRED FILES colamd.h LIBRARIES colamd)
suitesparse_find_component(CCOLAMD REQUIRED FILES ccolamd.h LIBRARIES ccolamd)
suitesparse_find_component(CHOLMOD REQUIRED FILES cholmod.h LIBRARIES cholmod)
-suitesparse_find_component(
- SUITESPARSEQR REQUIRED FILES SuiteSparseQR.hpp LIBRARIES spqr)
+suitesparse_find_component(SUITESPARSEQR REQUIRED FILES SuiteSparseQR.hpp
+ LIBRARIES spqr)
if(SUITESPARSEQR_FOUND)
- # SuiteSparseQR may be compiled with Intel Threading Building Blocks,
- # we assume that if TBB is installed, SuiteSparseQR was compiled with
- # support for it, this will do no harm if it wasn't.
+ # SuiteSparseQR may be compiled with Intel Threading Building Blocks, we
+ # assume that if TBB is installed, SuiteSparseQR was compiled with support for
+ # it, this will do no harm if it wasn't.
find_package(TBB QUIET)
if(TBB_FOUND)
message(STATUS "Found Intel Thread Building Blocks (TBB) library "
- "(${TBB_VERSION}) assuming SuiteSparseQR was compiled "
- "with TBB.")
- # Add the TBB libraries to the SuiteSparseQR libraries (the only
- # libraries to optionally depend on TBB).
+ "(${TBB_VERSION}) assuming SuiteSparseQR was compiled "
+ "with TBB.")
+ # Add the TBB libraries to the SuiteSparseQR libraries (the only libraries
+ # to optionally depend on TBB).
list(APPEND SUITESPARSEQR_LIBRARY ${TBB_LIBRARIES})
else()
message(STATUS "Did not find Intel TBB library, assuming SuiteSparseQR was "
- "not compiled with TBB.")
+ "not compiled with TBB.")
endif()
endif()
# UFconfig / SuiteSparse_config.
#
-# If SuiteSparse version is >= 4 then SuiteSparse_config is required.
-# For SuiteSparse 3, UFconfig.h is required.
-suitesparse_find_component(
- SUITESPARSE_CONFIG FILES SuiteSparse_config.h LIBRARIES suitesparseconfig)
+# If SuiteSparse version is >= 4 then SuiteSparse_config is required. For
+# SuiteSparse 3, UFconfig.h is required.
+suitesparse_find_component(SUITESPARSE_CONFIG FILES SuiteSparse_config.h
+ LIBRARIES suitesparseconfig)
if(SUITESPARSE_CONFIG_FOUND)
# SuiteSparse_config (SuiteSparse version >= 4) requires librt library for
- # timing by default when compiled on Linux or Unix, but not on OSX (which
- # does not have librt).
- if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR UNIX AND NOT APPLE)
+ # timing by default when compiled on Linux or Unix, but not on OSX (which does
+ # not have librt).
+ if(CMAKE_SYSTEM_NAME MATCHES "Linux"
+ OR UNIX
+ AND NOT APPLE)
suitesparse_find_component(LIBRT LIBRARIES rt)
if(LIBRT_FOUND)
- message(STATUS "Adding librt: ${LIBRT_LIBRARY} to "
- "SuiteSparse_config libraries (required on Linux & Unix [not OSX] if "
- "SuiteSparse is compiled with timing).")
+ message(
+ STATUS
+ "Adding librt: ${LIBRT_LIBRARY} to "
+ "SuiteSparse_config libraries (required on Linux & Unix [not OSX] if "
+ "SuiteSparse is compiled with timing).")
list(APPEND SUITESPARSE_CONFIG_LIBRARY ${LIBRT_LIBRARY})
else()
message(STATUS "Could not find librt, but found SuiteSparse_config, "
- "assuming that SuiteSparse was compiled without timing.")
+ "assuming that SuiteSparse was compiled without timing.")
endif()
endif()
else()
@@ -328,16 +319,15 @@ else()
suitesparse_find_component(UFCONFIG FILES UFconfig.h)
endif()
-if(NOT SUITESPARSE_CONFIG_FOUND AND
- NOT UFCONFIG_FOUND)
+if(NOT SUITESPARSE_CONFIG_FOUND AND NOT UFCONFIG_FOUND)
suitesparse_report_not_found(
"Failed to find either: SuiteSparse_config header & library (should be "
"present in all SuiteSparse >= v4 installs), or UFconfig header (should "
"be present in all SuiteSparse < v4 installs).")
endif()
-# Extract the SuiteSparse version from the appropriate header (UFconfig.h for
-# <= v3, SuiteSparse_config.h for >= v4).
+# Extract the SuiteSparse version from the appropriate header (UFconfig.h for <=
+# v3, SuiteSparse_config.h for >= v4).
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS SUITESPARSE_VERSION)
if(UFCONFIG_FOUND)
@@ -352,31 +342,33 @@ if(UFCONFIG_FOUND)
file(READ ${SUITESPARSE_VERSION_FILE} UFCONFIG_CONTENTS)
string(REGEX MATCH "#define SUITESPARSE_MAIN_VERSION [0-9]+"
- SUITESPARSE_MAIN_VERSION "${UFCONFIG_CONTENTS}")
+ SUITESPARSE_MAIN_VERSION "${UFCONFIG_CONTENTS}")
string(REGEX REPLACE "#define SUITESPARSE_MAIN_VERSION ([0-9]+)" "\\1"
- SUITESPARSE_MAIN_VERSION "${SUITESPARSE_MAIN_VERSION}")
+ SUITESPARSE_MAIN_VERSION "${SUITESPARSE_MAIN_VERSION}")
string(REGEX MATCH "#define SUITESPARSE_SUB_VERSION [0-9]+"
- SUITESPARSE_SUB_VERSION "${UFCONFIG_CONTENTS}")
+ SUITESPARSE_SUB_VERSION "${UFCONFIG_CONTENTS}")
string(REGEX REPLACE "#define SUITESPARSE_SUB_VERSION ([0-9]+)" "\\1"
- SUITESPARSE_SUB_VERSION "${SUITESPARSE_SUB_VERSION}")
+ SUITESPARSE_SUB_VERSION "${SUITESPARSE_SUB_VERSION}")
string(REGEX MATCH "#define SUITESPARSE_SUBSUB_VERSION [0-9]+"
- SUITESPARSE_SUBSUB_VERSION "${UFCONFIG_CONTENTS}")
- string(REGEX REPLACE "#define SUITESPARSE_SUBSUB_VERSION ([0-9]+)" "\\1"
- SUITESPARSE_SUBSUB_VERSION "${SUITESPARSE_SUBSUB_VERSION}")
+ SUITESPARSE_SUBSUB_VERSION "${UFCONFIG_CONTENTS}")
+ string(REGEX
+ REPLACE "#define SUITESPARSE_SUBSUB_VERSION ([0-9]+)" "\\1"
+ SUITESPARSE_SUBSUB_VERSION "${SUITESPARSE_SUBSUB_VERSION}")
# This is on a single line s/t CMake does not interpret it as a list of
# elements and insert ';' separators which would result in 4.;2.;1 nonsense.
set(SUITESPARSE_VERSION
- "${SUITESPARSE_MAIN_VERSION}.${SUITESPARSE_SUB_VERSION}.${SUITESPARSE_SUBSUB_VERSION}")
+ "${SUITESPARSE_MAIN_VERSION}.${SUITESPARSE_SUB_VERSION}.${SUITESPARSE_SUBSUB_VERSION}"
+ )
endif()
endif()
if(SUITESPARSE_CONFIG_FOUND)
# SuiteSparse version >= 4.
set(SUITESPARSE_VERSION_FILE
- ${SUITESPARSE_CONFIG_INCLUDE_DIR}/SuiteSparse_config.h)
+ ${SUITESPARSE_CONFIG_INCLUDE_DIR}/SuiteSparse_config.h)
if(NOT EXISTS ${SUITESPARSE_VERSION_FILE})
suitesparse_report_not_found(
"Could not find file: ${SUITESPARSE_VERSION_FILE} containing version "
@@ -386,24 +378,26 @@ if(SUITESPARSE_CONFIG_FOUND)
file(READ ${SUITESPARSE_VERSION_FILE} SUITESPARSE_CONFIG_CONTENTS)
string(REGEX MATCH "#define SUITESPARSE_MAIN_VERSION [0-9]+"
- SUITESPARSE_MAIN_VERSION "${SUITESPARSE_CONFIG_CONTENTS}")
+ SUITESPARSE_MAIN_VERSION "${SUITESPARSE_CONFIG_CONTENTS}")
string(REGEX REPLACE "#define SUITESPARSE_MAIN_VERSION ([0-9]+)" "\\1"
- SUITESPARSE_MAIN_VERSION "${SUITESPARSE_MAIN_VERSION}")
+ SUITESPARSE_MAIN_VERSION "${SUITESPARSE_MAIN_VERSION}")
string(REGEX MATCH "#define SUITESPARSE_SUB_VERSION [0-9]+"
- SUITESPARSE_SUB_VERSION "${SUITESPARSE_CONFIG_CONTENTS}")
+ SUITESPARSE_SUB_VERSION "${SUITESPARSE_CONFIG_CONTENTS}")
string(REGEX REPLACE "#define SUITESPARSE_SUB_VERSION ([0-9]+)" "\\1"
- SUITESPARSE_SUB_VERSION "${SUITESPARSE_SUB_VERSION}")
+ SUITESPARSE_SUB_VERSION "${SUITESPARSE_SUB_VERSION}")
string(REGEX MATCH "#define SUITESPARSE_SUBSUB_VERSION [0-9]+"
- SUITESPARSE_SUBSUB_VERSION "${SUITESPARSE_CONFIG_CONTENTS}")
- string(REGEX REPLACE "#define SUITESPARSE_SUBSUB_VERSION ([0-9]+)" "\\1"
- SUITESPARSE_SUBSUB_VERSION "${SUITESPARSE_SUBSUB_VERSION}")
+ SUITESPARSE_SUBSUB_VERSION "${SUITESPARSE_CONFIG_CONTENTS}")
+ string(REGEX
+ REPLACE "#define SUITESPARSE_SUBSUB_VERSION ([0-9]+)" "\\1"
+ SUITESPARSE_SUBSUB_VERSION "${SUITESPARSE_SUBSUB_VERSION}")
# This is on a single line s/t CMake does not interpret it as a list of
# elements and insert ';' separators which would result in 4.;2.;1 nonsense.
set(SUITESPARSE_VERSION
- "${SUITESPARSE_MAIN_VERSION}.${SUITESPARSE_SUB_VERSION}.${SUITESPARSE_SUBSUB_VERSION}")
+ "${SUITESPARSE_MAIN_VERSION}.${SUITESPARSE_SUB_VERSION}.${SUITESPARSE_SUBSUB_VERSION}"
+ )
endif()
endif()
@@ -413,29 +407,29 @@ suitesparse_find_component(METIS LIBRARIES metis)
# Only mark SuiteSparse as found if all required components and dependencies
# have been found.
set(SUITESPARSE_FOUND TRUE)
-foreach(REQUIRED_VAR ${SUITESPARSE_FOUND_REQUIRED_VARS})
- if(NOT ${REQUIRED_VAR})
+foreach(required_var ${SUITESPARSE_FOUND_REQUIRED_VARS})
+ if(NOT ${required_var})
set(SUITESPARSE_FOUND FALSE)
endif()
endforeach()
if(SUITESPARSE_FOUND)
- list(APPEND SUITESPARSE_INCLUDE_DIRS
+ list(
+ APPEND
+ SUITESPARSE_INCLUDE_DIRS
${AMD_INCLUDE_DIR}
${CAMD_INCLUDE_DIR}
${COLAMD_INCLUDE_DIR}
${CCOLAMD_INCLUDE_DIR}
${CHOLMOD_INCLUDE_DIR}
${SUITESPARSEQR_INCLUDE_DIR})
- # Handle config separately, as otherwise at least one of them will be set
- # to NOTFOUND which would cause any check on SUITESPARSE_INCLUDE_DIRS to fail.
+ # Handle config separately, as otherwise at least one of them will be set to
+ # NOTFOUND which would cause any check on SUITESPARSE_INCLUDE_DIRS to fail.
if(SUITESPARSE_CONFIG_FOUND)
- list(APPEND SUITESPARSE_INCLUDE_DIRS
- ${SUITESPARSE_CONFIG_INCLUDE_DIR})
+ list(APPEND SUITESPARSE_INCLUDE_DIRS ${SUITESPARSE_CONFIG_INCLUDE_DIR})
endif()
if(UFCONFIG_FOUND)
- list(APPEND SUITESPARSE_INCLUDE_DIRS
- ${UFCONFIG_INCLUDE_DIR})
+ list(APPEND SUITESPARSE_INCLUDE_DIRS ${UFCONFIG_INCLUDE_DIR})
endif()
# As SuiteSparse includes are often all in the same directory, remove any
# repetitions.
@@ -443,7 +437,9 @@ if(SUITESPARSE_FOUND)
# Important: The ordering of these libraries is *NOT* arbitrary, as these
# could potentially be static libraries their link ordering is important.
- list(APPEND SUITESPARSE_LIBRARIES
+ list(
+ APPEND
+ SUITESPARSE_LIBRARIES
${SUITESPARSEQR_LIBRARY}
${CHOLMOD_LIBRARY}
${CCOLAMD_LIBRARY}
@@ -453,36 +449,38 @@ if(SUITESPARSE_FOUND)
${LAPACK_LIBRARIES}
${BLAS_LIBRARIES})
if(SUITESPARSE_CONFIG_FOUND)
- list(APPEND SUITESPARSE_LIBRARIES
- ${SUITESPARSE_CONFIG_LIBRARY})
+ list(APPEND SUITESPARSE_LIBRARIES ${SUITESPARSE_CONFIG_LIBRARY})
endif()
if(METIS_FOUND)
- list(APPEND SUITESPARSE_LIBRARIES
- ${METIS_LIBRARY})
+ list(APPEND SUITESPARSE_LIBRARIES ${METIS_LIBRARY})
endif()
endif()
# Determine if we are running on Ubuntu with the package install of SuiteSparse
# which is broken and does not support linking a shared library.
set(SUITESPARSE_IS_BROKEN_SHARED_LINKING_UBUNTU_SYSTEM_VERSION FALSE)
-if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND SUITESPARSE_VERSION VERSION_EQUAL 3.4.0)
+if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND SUITESPARSE_VERSION VERSION_EQUAL
+ 3.4.0)
find_program(LSB_RELEASE_EXECUTABLE lsb_release)
if(LSB_RELEASE_EXECUTABLE)
- # Any even moderately recent Ubuntu release (likely to be affected by
- # this bug) should have lsb_release, if it isn't present we are likely
- # on a different Linux distribution (should be fine).
- execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -si
+ # Any even moderately recent Ubuntu release (likely to be affected by this
+ # bug) should have lsb_release, if it isn't present we are likely on a
+ # different Linux distribution (should be fine).
+ execute_process(
+ COMMAND ${LSB_RELEASE_EXECUTABLE} -si
OUTPUT_VARIABLE LSB_DISTRIBUTOR_ID
OUTPUT_STRIP_TRAILING_WHITESPACE)
- if(LSB_DISTRIBUTOR_ID MATCHES "Ubuntu" AND
- SUITESPARSE_LIBRARIES MATCHES "/usr/lib/libamd")
- # We are on Ubuntu, and the SuiteSparse version matches the broken
- # system install version and is a system install.
+ if(LSB_DISTRIBUTOR_ID MATCHES "Ubuntu" AND SUITESPARSE_LIBRARIES MATCHES
+ "/usr/lib/libamd")
+ # We are on Ubuntu, and the SuiteSparse version matches the broken system
+ # install version and is a system install.
set(SUITESPARSE_IS_BROKEN_SHARED_LINKING_UBUNTU_SYSTEM_VERSION TRUE)
- message(STATUS "Found system install of SuiteSparse "
- "${SUITESPARSE_VERSION} running on Ubuntu, which has a known bug "
- "preventing linking of shared libraries (static linking unaffected).")
+ message(
+ STATUS
+ "Found system install of SuiteSparse "
+ "${SUITESPARSE_VERSION} running on Ubuntu, which has a known bug "
+ "preventing linking of shared libraries (static linking unaffected).")
endif()
endif()
endif()
@@ -492,15 +490,17 @@ suitesparse_reset_find_library_prefix()
# Handle REQUIRED and QUIET arguments to FIND_PACKAGE
include(FindPackageHandleStandardArgs)
if(SUITESPARSE_FOUND)
- find_package_handle_standard_args(SUITESPARSE
+ find_package_handle_standard_args(
+ SUITESPARSE
REQUIRED_VARS ${SUITESPARSE_FOUND_REQUIRED_VARS}
VERSION_VAR SUITESPARSE_VERSION
FAIL_MESSAGE "Failed to find some/all required components of SuiteSparse.")
else()
# Do not pass VERSION_VAR to FindPackageHandleStandardArgs() if we failed to
- # find SuiteSparse to avoid a confusing autogenerated failure message
- # that states 'not found (missing: FOO) (found version: x.y.z)'.
- find_package_handle_standard_args(SUITESPARSE
+ # find SuiteSparse to avoid a confusing autogenerated failure message that
+ # states 'not found (missing: FOO) (found version: x.y.z)'.
+ find_package_handle_standard_args(
+ SUITESPARSE
REQUIRED_VARS ${SUITESPARSE_FOUND_REQUIRED_VARS}
FAIL_MESSAGE "Failed to find some/all required components of SuiteSparse.")
endif()
diff --git a/fuse_constraints/include/fuse_constraints/absolute_constraint.hpp b/fuse_constraints/include/fuse_constraints/absolute_constraint.hpp
index 8bb4ac4c7..0e02561bd 100644
--- a/fuse_constraints/include/fuse_constraints/absolute_constraint.hpp
+++ b/fuse_constraints/include/fuse_constraints/absolute_constraint.hpp
@@ -57,7 +57,6 @@
#include
#include
-
namespace fuse_constraints
{
@@ -71,7 +70,7 @@ namespace fuse_constraints
* prior map (scan-to-map measurements). This constraint holds the measured variable value and the
* measurement uncertainty/covariance.
*/
-template
+template
class AbsoluteConstraint : public fuse_core::Constraint
{
public:
@@ -90,11 +89,8 @@ class AbsoluteConstraint : public fuse_core::Constraint
* @param[in] mean The measured/prior value of all variable dimensions
* @param[in] covariance The measurement/prior uncertainty of all variable dimensions
*/
- AbsoluteConstraint(
- const std::string & source,
- const Variable & variable,
- const fuse_core::VectorXd & mean,
- const fuse_core::MatrixXd & covariance);
+ AbsoluteConstraint(const std::string& source, const Variable& variable, const fuse_core::VectorXd& mean,
+ const fuse_core::MatrixXd& covariance);
/**
* @brief Create a constraint using a measurement/prior of only a partial set of dimensions of the
@@ -109,12 +105,8 @@ class AbsoluteConstraint : public fuse_core::Constraint
* by \p indices.
* @param[in] indices The set of indices corresponding to the measured dimensions
*/
- AbsoluteConstraint(
- const std::string & source,
- const Variable & variable,
- const fuse_core::VectorXd & partial_mean,
- const fuse_core::MatrixXd & partial_covariance,
- const std::vector & indices);
+ AbsoluteConstraint(const std::string& source, const Variable& variable, const fuse_core::VectorXd& partial_mean,
+ const fuse_core::MatrixXd& partial_covariance, const std::vector& indices);
/**
* @brief Destructor
@@ -128,7 +120,10 @@ class AbsoluteConstraint : public fuse_core::Constraint
* are in the order defined by the variable, not the order defined by the \p indices parameter.
* All unmeasured variable dimensions are set to zero.
*/
- const fuse_core::VectorXd & mean() const {return mean_;}
+ const fuse_core::VectorXd& mean() const
+ {
+ return mean_;
+ }
/**
* @brief Read-only access to the square root information matrix.
@@ -138,7 +133,10 @@ class AbsoluteConstraint : public fuse_core::Constraint
* variable_dimensions. If only a partial set of dimensions are measured, then this matrix will
* not be square.
*/
- const fuse_core::MatrixXd & sqrtInformation() const {return sqrt_information_;}
+ const fuse_core::MatrixXd& sqrtInformation() const
+ {
+ return sqrt_information_;
+ }
/**
* @brief Compute the measurement covariance matrix.
@@ -155,7 +153,7 @@ class AbsoluteConstraint : public fuse_core::Constraint
*
* @param[out] stream The stream to write to. Defaults to stdout.
*/
- void print(std::ostream & stream = std::cout) const override;
+ void print(std::ostream& stream = std::cout) const override;
/**
* @brief Construct an instance of this constraint's cost function
@@ -167,10 +165,10 @@ class AbsoluteConstraint : public fuse_core::Constraint
*
* @return A base pointer to an instance of a derived CostFunction.
*/
- ceres::CostFunction * costFunction() const override;
+ ceres::CostFunction* costFunction() const override;
protected:
- fuse_core::VectorXd mean_; //!< The measured/prior mean vector for this variable
+ fuse_core::VectorXd mean_; //!< The measured/prior mean vector for this variable
fuse_core::MatrixXd sqrt_information_; //!< The square root information matrix
private:
@@ -184,28 +182,23 @@ class AbsoluteConstraint : public fuse_core::Constraint
* @param[in/out] archive - The archive object that holds the serialized class members
* @param[in] version - The version of the archive being read/written. Generally unused.
*/
- template
- void serialize(Archive & archive, const unsigned int /* version */)
+ template
+ void serialize(Archive& archive, const unsigned int /* version */)
{
- archive & boost::serialization::base_object(*this);
- archive & mean_;
- archive & sqrt_information_;
+ archive& boost::serialization::base_object(*this);
+ archive& mean_;
+ archive& sqrt_information_;
}
};
// Define unique names for the different variations of the absolute constraint
-using AbsoluteAccelerationAngular2DStampedConstraint =
- AbsoluteConstraint;
-using AbsoluteAccelerationLinear2DStampedConstraint =
- AbsoluteConstraint;
-using AbsoluteOrientation2DStampedConstraint =
- AbsoluteConstraint;
+using AbsoluteAccelerationAngular2DStampedConstraint = AbsoluteConstraint;
+using AbsoluteAccelerationLinear2DStampedConstraint = AbsoluteConstraint;
+using AbsoluteOrientation2DStampedConstraint = AbsoluteConstraint;
using AbsolutePosition2DStampedConstraint = AbsoluteConstraint;
using AbsolutePosition3DStampedConstraint = AbsoluteConstraint;
-using AbsoluteVelocityAngular2DStampedConstraint =
- AbsoluteConstraint;
-using AbsoluteVelocityLinear2DStampedConstraint =
- AbsoluteConstraint;
+using AbsoluteVelocityAngular2DStampedConstraint = AbsoluteConstraint;
+using AbsoluteVelocityLinear2DStampedConstraint = AbsoluteConstraint;
} // namespace fuse_constraints
// Include the template implementation
diff --git a/fuse_constraints/include/fuse_constraints/absolute_constraint_impl.hpp b/fuse_constraints/include/fuse_constraints/absolute_constraint_impl.hpp
index cbb689b54..f28ceb3bf 100644
--- a/fuse_constraints/include/fuse_constraints/absolute_constraint_impl.hpp
+++ b/fuse_constraints/include/fuse_constraints/absolute_constraint_impl.hpp
@@ -42,33 +42,28 @@
#include
-
namespace fuse_constraints
{
-template
-AbsoluteConstraint::AbsoluteConstraint(
- const std::string & source,
- const Variable & variable,
- const fuse_core::VectorXd & mean,
- const fuse_core::MatrixXd & covariance)
-: fuse_core::Constraint(source, {variable.uuid()}), // NOLINT(whitespace/braces)
- mean_(mean),
- sqrt_information_(covariance.inverse().llt().matrixU())
+template
+AbsoluteConstraint::AbsoluteConstraint(const std::string& source, const Variable& variable,
+ const fuse_core::VectorXd& mean, const fuse_core::MatrixXd& covariance)
+ : fuse_core::Constraint(source, { variable.uuid() })
+ , // NOLINT(whitespace/braces)
+ mean_(mean)
+ , sqrt_information_(covariance.inverse().llt().matrixU())
{
assert(mean.rows() == static_cast(variable.size()));
assert(covariance.rows() == static_cast(variable.size()));
assert(covariance.cols() == static_cast(variable.size()));
}
-template
-AbsoluteConstraint::AbsoluteConstraint(
- const std::string & source,
- const Variable & variable,
- const fuse_core::VectorXd & partial_mean,
- const fuse_core::MatrixXd & partial_covariance,
- const std::vector & indices)
-: fuse_core::Constraint(source, {variable.uuid()}) // NOLINT(whitespace/braces)
+template
+AbsoluteConstraint::AbsoluteConstraint(const std::string& source, const Variable& variable,
+ const fuse_core::VectorXd& partial_mean,
+ const fuse_core::MatrixXd& partial_covariance,
+ const std::vector& indices)
+ : fuse_core::Constraint(source, { variable.uuid() }) // NOLINT(whitespace/braces)
{
assert(partial_mean.rows() == static_cast(indices.size()));
assert(partial_covariance.rows() == static_cast(indices.size()));
@@ -86,13 +81,14 @@ AbsoluteConstraint::AbsoluteConstraint(
// and the columns are in the order defined by the variable.
mean_ = fuse_core::VectorXd::Zero(variable.size());
sqrt_information_ = fuse_core::MatrixXd::Zero(indices.size(), variable.size());
- for (size_t i = 0; i < indices.size(); ++i) {
+ for (size_t i = 0; i < indices.size(); ++i)
+ {
mean_(indices[i]) = partial_mean(i);
sqrt_information_.col(indices[i]) = partial_sqrt_information.col(i);
}
}
-template
+template
fuse_core::MatrixXd AbsoluteConstraint::covariance() const
{
// We want to compute:
@@ -107,8 +103,8 @@ fuse_core::MatrixXd AbsoluteConstraint::covariance() const
return pinv * pinv.transpose();
}
-template
-void AbsoluteConstraint::print(std::ostream & stream) const
+template
+void AbsoluteConstraint::print(std::ostream& stream) const
{
stream << type() << "\n"
<< " source: " << source() << "\n"
@@ -117,14 +113,15 @@ void AbsoluteConstraint::print(std::ostream & stream) const
<< " mean: " << mean().transpose() << "\n"
<< " sqrt_info: " << sqrtInformation() << "\n";
- if (loss()) {
+ if (loss())
+ {
stream << " loss: ";
loss()->print(stream);
}
}
-template
-ceres::CostFunction * AbsoluteConstraint::costFunction() const
+template
+ceres::CostFunction* AbsoluteConstraint::costFunction() const
{
// Ceres ships with a "prior" cost function. Just use that here.
return new ceres::NormalPrior(sqrt_information_, mean_);
@@ -133,53 +130,50 @@ ceres::CostFunction * AbsoluteConstraint::costFunction() const
// Specialization for Orientation2D
// We need to handle the 2*pi rollover for 2D orientations, so simple subtraction does not produce
// the correct cost
-template<>
-inline ceres::CostFunction * AbsoluteConstraint<
- fuse_variables::Orientation2DStamped
->::costFunction()
-const
+template <>
+inline ceres::CostFunction* AbsoluteConstraint::costFunction() const
{
return new NormalPriorOrientation2D(sqrt_information_(0, 0), mean_(0));
}
// Specialize the type() method to return the name that is registered with the plugins
-template<>
+template <>
inline std::string AbsoluteConstraint::type() const
{
return "fuse_constraints::AbsoluteAccelerationAngular2DStampedConstraint";
}
-template<>
+template <>
inline std::string AbsoluteConstraint::type() const
{
return "fuse_constraints::AbsoluteAccelerationLinear2DStampedConstraint";
}
-template<>
+template <>
inline std::string AbsoluteConstraint::type() const
{
return "fuse_constraints::AbsoluteOrientation2DStampedConstraint";
}
-template<>
+template <>
inline std::string AbsoluteConstraint::type() const
{
return "fuse_constraints::AbsolutePosition2DStampedConstraint";
}
-template<>
+template <>
inline std::string AbsoluteConstraint::type() const
{
return "fuse_constraints::AbsolutePosition3DStampedConstraint";
}
-template<>
+template <>
inline std::string AbsoluteConstraint::type() const
{
return "fuse_constraints::AbsoluteVelocityAngular2DStampedConstraint";
}
-template<>
+template <>
inline std::string AbsoluteConstraint::type() const
{
return "fuse_constraints::AbsoluteVelocityLinear2DStampedConstraint";
diff --git a/fuse_constraints/include/fuse_constraints/absolute_orientation_3d_stamped_constraint.h b/fuse_constraints/include/fuse_constraints/absolute_orientation_3d_stamped_constraint.h
index e02d054f3..92eb503a2 100644
--- a/fuse_constraints/include/fuse_constraints/absolute_orientation_3d_stamped_constraint.h
+++ b/fuse_constraints/include/fuse_constraints/absolute_orientation_3d_stamped_constraint.h
@@ -35,9 +35,7 @@
#ifndef FUSE_CONSTRAINTS__ABSOLUTE_ORIENTATION_3D_STAMPED_CONSTRAINT_H_
#define FUSE_CONSTRAINTS__ABSOLUTE_ORIENTATION_3D_STAMPED_CONSTRAINT_H_
-#warning \
- This header is obsolete, please include \
- fuse_constraints/absolute_orientation_3d_stamped_constraint.hpp instead
+#warning This header is obsolete, please include fuse_constraints/absolute_orientation_3d_stamped_constraint.hpp instead
#include
diff --git a/fuse_constraints/include/fuse_constraints/absolute_orientation_3d_stamped_constraint.hpp b/fuse_constraints/include/fuse_constraints/absolute_orientation_3d_stamped_constraint.hpp
index 0f63bdf86..d3f7b02c0 100644
--- a/fuse_constraints/include/fuse_constraints/absolute_orientation_3d_stamped_constraint.hpp
+++ b/fuse_constraints/include/fuse_constraints/absolute_orientation_3d_stamped_constraint.hpp
@@ -52,7 +52,6 @@
#include
#include
-
namespace fuse_constraints
{
@@ -80,11 +79,9 @@ class AbsoluteOrientation3DStampedConstraint : public fuse_core::Constraint
* @param[in] mean The measured/prior orientation as a quaternion (4x1 vector: w, x, y, z)
* @param[in] covariance The measurement/prior covariance (3x3 matrix: qx, qy, qz)
*/
- AbsoluteOrientation3DStampedConstraint(
- const std::string & source,
- const fuse_variables::Orientation3DStamped & orientation,
- const fuse_core::Vector4d & mean,
- const fuse_core::Matrix3d & covariance);
+ AbsoluteOrientation3DStampedConstraint(const std::string& source,
+ const fuse_variables::Orientation3DStamped& orientation,
+ const fuse_core::Vector4d& mean, const fuse_core::Matrix3d& covariance);
/**
* @brief Create a constraint using a measurement/prior of a 3D orientation
@@ -94,11 +91,9 @@ class AbsoluteOrientation3DStampedConstraint : public fuse_core::Constraint
* @param[in] mean The measured/prior orientation as an Eigen quaternion
* @param[in] covariance The measurement/prior covariance (3x3 matrix: qx, qy, qz)
*/
- AbsoluteOrientation3DStampedConstraint(
- const std::string & source,
- const fuse_variables::Orientation3DStamped & orientation,
- const Eigen::Quaterniond & mean,
- const fuse_core::Matrix3d & covariance);
+ AbsoluteOrientation3DStampedConstraint(const std::string& source,
+ const fuse_variables::Orientation3DStamped& orientation,
+ const Eigen::Quaterniond& mean, const fuse_core::Matrix3d& covariance);
/**
* @brief Create a constraint using a measurement/prior of a 3D orientation
@@ -108,11 +103,10 @@ class AbsoluteOrientation3DStampedConstraint : public fuse_core::Constraint
* @param[in] mean The measured/prior orientation as a ROS quaternion message
* @param[in] covariance The measurement/prior covariance (3x3 matrix: qx, qy, qz)
*/
- AbsoluteOrientation3DStampedConstraint(
- const std::string & source,
- const fuse_variables::Orientation3DStamped & orientation,
- const geometry_msgs::msg::Quaternion & mean,
- const std::array & covariance);
+ AbsoluteOrientation3DStampedConstraint(const std::string& source,
+ const fuse_variables::Orientation3DStamped& orientation,
+ const geometry_msgs::msg::Quaternion& mean,
+ const std::array& covariance);
/**
* @brief Destructor
@@ -124,14 +118,20 @@ class AbsoluteOrientation3DStampedConstraint : public fuse_core::Constraint
*
* Order is (w, x, y, z)
*/
- const fuse_core::Vector4d & mean() const {return mean_;}
+ const fuse_core::Vector4d& mean() const
+ {
+ return mean_;
+ }
/**
* @brief Read-only access to the square root information matrix.
*
* Order is (x, y, z)
*/
- const fuse_core::Matrix3d & sqrtInformation() const {return sqrt_information_;}
+ const fuse_core::Matrix3d& sqrtInformation() const
+ {
+ return sqrt_information_;
+ }
/**
* @brief Compute the measurement covariance matrix.
@@ -145,7 +145,7 @@ class AbsoluteOrientation3DStampedConstraint : public fuse_core::Constraint
*
* @param[out] stream The stream to write to. Defaults to stdout.
*/
- void print(std::ostream & stream = std::cout) const override;
+ void print(std::ostream& stream = std::cout) const override;
/**
* @brief Construct an instance of this constraint's cost function
@@ -157,7 +157,7 @@ class AbsoluteOrientation3DStampedConstraint : public fuse_core::Constraint
*
* @return A base pointer to an instance of a derived CostFunction.
*/
- ceres::CostFunction * costFunction() const override;
+ ceres::CostFunction* costFunction() const override;
protected:
/**
@@ -165,23 +165,23 @@ class AbsoluteOrientation3DStampedConstraint : public fuse_core::Constraint
* @param[in] quaternion - The input Eigen quaternion
* @return The \p quaternion, converted to an Eigen Vector4d
*/
- static fuse_core::Vector4d toEigen(const Eigen::Quaterniond & quaternion);
+ static fuse_core::Vector4d toEigen(const Eigen::Quaterniond& quaternion);
/**
* @brief Utility method to convert an ROS quaternion message to an Eigen Vector4d
* @param[in] quaternion - The input ROS quaternion message
* @return The \p quaternion, converted to an Eigen Vector4d
*/
- static fuse_core::Vector4d toEigen(const geometry_msgs::msg::Quaternion & quaternion);
+ static fuse_core::Vector4d toEigen(const geometry_msgs::msg::Quaternion& quaternion);
/**
* @brief Utility method to convert a flat 1D array to a 3x3 Eigen matrix
* @param[in] covariance - The input covariance array
* @return The \p covariance, converted to an Eigen Matrix3d
*/
- static fuse_core::Matrix3d toEigen(const std::array & covariance);
+ static fuse_core::Matrix3d toEigen(const std::array& covariance);
- fuse_core::Vector4d mean_; //!< The measured/prior mean vector for this variable
+ fuse_core::Vector4d mean_; //!< The measured/prior mean vector for this variable
fuse_core::Matrix3d sqrt_information_; //!< The square root information matrix
private:
@@ -195,12 +195,12 @@ class AbsoluteOrientation3DStampedConstraint : public fuse_core::Constraint
* @param[in/out] archive - The archive object that holds the serialized class members
* @param[in] version - The version of the archive being read/written. Generally unused.
*/
- template
- void serialize(Archive & archive, const unsigned int /* version */)
+ template
+ void serialize(Archive& archive, const unsigned int /* version */)
{
- archive & boost::serialization::base_object(*this);
- archive & mean_;
- archive & sqrt_information_;
+ archive& boost::serialization::base_object(*this);
+ archive& mean_;
+ archive& sqrt_information_;
}
};
diff --git a/fuse_constraints/include/fuse_constraints/absolute_orientation_3d_stamped_euler_constraint.h b/fuse_constraints/include/fuse_constraints/absolute_orientation_3d_stamped_euler_constraint.h
index 4d388fa17..0511e627f 100644
--- a/fuse_constraints/include/fuse_constraints/absolute_orientation_3d_stamped_euler_constraint.h
+++ b/fuse_constraints/include/fuse_constraints/absolute_orientation_3d_stamped_euler_constraint.h
@@ -35,9 +35,7 @@
#ifndef FUSE_CONSTRAINTS__ABSOLUTE_ORIENTATION_3D_STAMPED_EULER_CONSTRAINT_H_
#define FUSE_CONSTRAINTS__ABSOLUTE_ORIENTATION_3D_STAMPED_EULER_CONSTRAINT_H_
-#warning \
- This header is obsolete, please include \
- fuse_constraints/absolute_orientation_3d_stamped_euler_constraint.hpp instead
+#warning This header is obsolete, please include fuse_constraints/absolute_orientation_3d_stamped_euler_constraint.hpp instead
#include
diff --git a/fuse_constraints/include/fuse_constraints/absolute_orientation_3d_stamped_euler_constraint.hpp b/fuse_constraints/include/fuse_constraints/absolute_orientation_3d_stamped_euler_constraint.hpp
index b224a2878..bcf527abc 100644
--- a/fuse_constraints/include/fuse_constraints/absolute_orientation_3d_stamped_euler_constraint.hpp
+++ b/fuse_constraints/include/fuse_constraints/absolute_orientation_3d_stamped_euler_constraint.hpp
@@ -52,7 +52,6 @@
#include
#include
-
namespace fuse_constraints
{
@@ -87,12 +86,10 @@ class AbsoluteOrientation3DStampedEulerConstraint : public fuse_core::Constraint
* @param[in] axes Used to specify which of the Euler axes they want to include in the
* constraint, e.g. "{ Euler::ROLL, EULER::YAW }"
*/
- AbsoluteOrientation3DStampedEulerConstraint(
- const std::string & source,
- const fuse_variables::Orientation3DStamped & orientation,
- const fuse_core::VectorXd & mean,
- const fuse_core::MatrixXd & covariance,
- const std::vector & axes);
+ AbsoluteOrientation3DStampedEulerConstraint(const std::string& source,
+ const fuse_variables::Orientation3DStamped& orientation,
+ const fuse_core::VectorXd& mean, const fuse_core::MatrixXd& covariance,
+ const std::vector& axes);
/**
* @brief Destructor
@@ -103,7 +100,10 @@ class AbsoluteOrientation3DStampedEulerConstraint : public fuse_core::Constraint
* @brief Read-only access to the vector that dictates the order of the Euler axes in the \p mean,
* \p covariance, and \p sqrtInformation.
*/
- const std::vector axes() const {return axes_;}
+ const std::vector axes() const
+ {
+ return axes_;
+ }
/**
* @brief Read-only access to the measured/prior vector of mean values.
@@ -112,7 +112,10 @@ class AbsoluteOrientation3DStampedEulerConstraint : public fuse_core::Constraint
* other currently implemented constraints in that the order does _not_ match the order defined in
* the variable.
*/
- const fuse_core::VectorXd & mean() const {return mean_;}
+ const fuse_core::VectorXd& mean() const
+ {
+ return mean_;
+ }
/**
* @brief Read-only access to the square root information matrix.
@@ -121,7 +124,10 @@ class AbsoluteOrientation3DStampedEulerConstraint : public fuse_core::Constraint
* from all other currently implemented constraints in that the order does _not_ match the order
* defined in the variable.
*/
- const fuse_core::MatrixXd & sqrtInformation() const {return sqrt_information_;}
+ const fuse_core::MatrixXd& sqrtInformation() const
+ {
+ return sqrt_information_;
+ }
/**
* @brief Compute the measurement covariance matrix.
@@ -137,7 +143,7 @@ class AbsoluteOrientation3DStampedEulerConstraint : public fuse_core::Constraint
*
* @param[out] stream The stream to write to. Defaults to stdout.
*/
- void print(std::ostream & stream = std::cout) const override;
+ void print(std::ostream& stream = std::cout) const override;
/**
* @brief Construct an instance of this constraint's cost function
@@ -149,12 +155,12 @@ class AbsoluteOrientation3DStampedEulerConstraint : public fuse_core::Constraint
*
* @return A base pointer to an instance of a derived CostFunction.
*/
- ceres::CostFunction * costFunction() const override;
+ ceres::CostFunction* costFunction() const override;
protected:
- fuse_core::VectorXd mean_; //!< The measured/prior mean vector for this variable
+ fuse_core::VectorXd mean_; //!< The measured/prior mean vector for this variable
fuse_core::MatrixXd sqrt_information_; //!< The square root information matrix
- std::vector axes_; //!< Which Euler angle axes we want to measure
+ std::vector axes_; //!< Which Euler angle axes we want to measure
private:
// Allow Boost Serialization access to private methods
@@ -167,13 +173,13 @@ class AbsoluteOrientation3DStampedEulerConstraint : public fuse_core::Constraint
* @param[in/out] archive - The archive object that holds the serialized class members
* @param[in] version - The version of the archive being read/written. Generally unused.
*/
- template
- void serialize(Archive & archive, const unsigned int /* version */)
+ template
+ void serialize(Archive& archive, const unsigned int /* version */)
{
- archive & boost::serialization::base_object(*this);
- archive & mean_;
- archive & sqrt_information_;
- archive & axes_;
+ archive& boost::serialization::base_object(*this);
+ archive& mean_;
+ archive& sqrt_information_;
+ archive& axes_;
}
};
diff --git a/fuse_constraints/include/fuse_constraints/absolute_pose_2d_stamped_constraint.h b/fuse_constraints/include/fuse_constraints/absolute_pose_2d_stamped_constraint.h
index 5c1e81bed..5be4cba8e 100644
--- a/fuse_constraints/include/fuse_constraints/absolute_pose_2d_stamped_constraint.h
+++ b/fuse_constraints/include/fuse_constraints/absolute_pose_2d_stamped_constraint.h
@@ -35,8 +35,7 @@
#ifndef FUSE_CONSTRAINTS__ABSOLUTE_POSE_2D_STAMPED_CONSTRAINT_H_
#define FUSE_CONSTRAINTS__ABSOLUTE_POSE_2D_STAMPED_CONSTRAINT_H_
-#warning \
- This header is obsolete, please include fuse_constraints/absolute_pose_2d_stamped_constraint.hpp \
+#warning This header is obsolete, please include fuse_constraints/absolute_pose_2d_stamped_constraint.hpp \
instead
#include
diff --git a/fuse_constraints/include/fuse_constraints/absolute_pose_2d_stamped_constraint.hpp b/fuse_constraints/include/fuse_constraints/absolute_pose_2d_stamped_constraint.hpp
index e9ed10a56..00623124b 100644
--- a/fuse_constraints/include/fuse_constraints/absolute_pose_2d_stamped_constraint.hpp
+++ b/fuse_constraints/include/fuse_constraints/absolute_pose_2d_stamped_constraint.hpp
@@ -52,7 +52,6 @@
#include
#include
-
namespace fuse_constraints
{
@@ -66,7 +65,7 @@ namespace fuse_constraints
* Some sensors, such as GPS, provide direct measurements of the robot's pose in the global frame.
* And localization systems often match laserscans to a prior map (scan-to-map measurements). This
* constraint holds the measured 2D pose and the measurement uncertainty/covariance. It also permits
- * measurement of a subset of the pose provided in the position and orientation varables.
+ * measurement of a subset of the pose provided in the position and orientation variables.
*/
class AbsolutePose2DStampedConstraint : public fuse_core::Constraint
{
@@ -103,14 +102,12 @@ class AbsolutePose2DStampedConstraint : public fuse_core::Constraint
* dimensions e.g. "{fuse_variables::Orientation2DStamped::Yaw}"
*/
AbsolutePose2DStampedConstraint(
- const std::string & source,
- const fuse_variables::Position2DStamped & position,
- const fuse_variables::Orientation2DStamped & orientation,
- const fuse_core::VectorXd & partial_mean,
- const fuse_core::MatrixXd & partial_covariance,
- const std::vector & linear_indices =
- {fuse_variables::Position2DStamped::X, fuse_variables::Position2DStamped::Y}, // NOLINT
- const std::vector & angular_indices = {fuse_variables::Orientation2DStamped::YAW}); // NOLINT
+ const std::string& source, const fuse_variables::Position2DStamped& position,
+ const fuse_variables::Orientation2DStamped& orientation, const fuse_core::VectorXd& partial_mean,
+ const fuse_core::MatrixXd& partial_covariance,
+ const std::vector& linear_indices = { fuse_variables::Position2DStamped::X,
+ fuse_variables::Position2DStamped::Y }, // NOLINT
+ const std::vector& angular_indices = { fuse_variables::Orientation2DStamped::YAW }); // NOLINT
/**
* @brief Destructor
@@ -123,7 +120,10 @@ class AbsolutePose2DStampedConstraint : public fuse_core::Constraint
* Order is (x, y, yaw). Note that the returned vector will be full sized (3x1) and in the stated
* order.
*/
- const fuse_core::Vector3d & mean() const {return mean_;}
+ const fuse_core::Vector3d& mean() const
+ {
+ return mean_;
+ }
/**
* @brief Read-only access to the square root information matrix.
@@ -131,7 +131,10 @@ class AbsolutePose2DStampedConstraint : public fuse_core::Constraint
* If only a partial covariance matrix was provided in the constructor, this covariance matrix
* will not be square.
*/
- const fuse_core::MatrixXd & sqrtInformation() const {return sqrt_information_;}
+ const fuse_core::MatrixXd& sqrtInformation() const
+ {
+ return sqrt_information_;
+ }
/**
* @brief Compute the measurement covariance matrix.
@@ -147,7 +150,7 @@ class AbsolutePose2DStampedConstraint : public fuse_core::Constraint
*
* @param[out] stream The stream to write to. Defaults to stdout.
*/
- void print(std::ostream & stream = std::cout) const override;
+ void print(std::ostream& stream = std::cout) const override;
/**
* @brief Construct an instance of this constraint's cost function
@@ -159,10 +162,10 @@ class AbsolutePose2DStampedConstraint : public fuse_core::Constraint
*
* @return A base pointer to an instance of a derived CostFunction.
*/
- ceres::CostFunction * costFunction() const override;
+ ceres::CostFunction* costFunction() const override;
protected:
- fuse_core::Vector3d mean_; //!< The measured/prior mean vector for this variable
+ fuse_core::Vector3d mean_; //!< The measured/prior mean vector for this variable
fuse_core::MatrixXd sqrt_information_; //!< The square root information matrix
private:
@@ -176,12 +179,12 @@ class AbsolutePose2DStampedConstraint : public fuse_core::Constraint
* @param[in/out] archive - The archive object that holds the serialized class members
* @param[in] version - The version of the archive being read/written. Generally unused.
*/
- template
- void serialize(Archive & archive, const unsigned int /* version */)
+ template
+ void serialize(Archive& archive, const unsigned int /* version */)
{
- archive & boost::serialization::base_object(*this);
- archive & mean_;
- archive & sqrt_information_;
+ archive& boost::serialization::base_object(*this);
+ archive& mean_;
+ archive& sqrt_information_;
}
};
diff --git a/fuse_constraints/include/fuse_constraints/absolute_pose_3d_stamped_constraint.h b/fuse_constraints/include/fuse_constraints/absolute_pose_3d_stamped_constraint.h
index e5a3240ac..2f501a6f7 100644
--- a/fuse_constraints/include/fuse_constraints/absolute_pose_3d_stamped_constraint.h
+++ b/fuse_constraints/include/fuse_constraints/absolute_pose_3d_stamped_constraint.h
@@ -35,8 +35,7 @@
#ifndef FUSE_CONSTRAINTS__ABSOLUTE_POSE_3D_STAMPED_CONSTRAINT_H_
#define FUSE_CONSTRAINTS__ABSOLUTE_POSE_3D_STAMPED_CONSTRAINT_H_
-#warning \
- This header is obsolete, please include fuse_constraints/absolute_pose_3d_stamped_constraint.hpp \
+#warning This header is obsolete, please include fuse_constraints/absolute_pose_3d_stamped_constraint.hpp \
instead
#include
diff --git a/fuse_constraints/include/fuse_constraints/absolute_pose_3d_stamped_constraint.hpp b/fuse_constraints/include/fuse_constraints/absolute_pose_3d_stamped_constraint.hpp
index 51238c8b7..8fcc4925c 100644
--- a/fuse_constraints/include/fuse_constraints/absolute_pose_3d_stamped_constraint.hpp
+++ b/fuse_constraints/include/fuse_constraints/absolute_pose_3d_stamped_constraint.hpp
@@ -52,7 +52,6 @@
#include
#include
-
namespace fuse_constraints
{
@@ -88,12 +87,9 @@ class AbsolutePose3DStampedConstraint : public fuse_core::Constraint
* (7x1 vector: x, y, z, qw, qx, qy, qz)
* @param[in] covariance The measurement/prior covariance (6x6 matrix: x, y, z, qx, qy, qz)
*/
- AbsolutePose3DStampedConstraint(
- const std::string & source,
- const fuse_variables::Position3DStamped & position,
- const fuse_variables::Orientation3DStamped & orientation,
- const fuse_core::Vector7d & mean,
- const fuse_core::Matrix6d & covariance);
+ AbsolutePose3DStampedConstraint(const std::string& source, const fuse_variables::Position3DStamped& position,
+ const fuse_variables::Orientation3DStamped& orientation,
+ const fuse_core::Vector7d& mean, const fuse_core::Matrix6d& covariance);
/**
* @brief Destructor
@@ -105,14 +101,20 @@ class AbsolutePose3DStampedConstraint : public fuse_core::Constraint
*
* Order is (x, y, z, qw, qx, qy, qz)
*/
- const fuse_core::Vector7d & mean() const {return mean_;}
+ const fuse_core::Vector7d& mean() const
+ {
+ return mean_;
+ }
/**
* @brief Read-only access to the square root information matrix.
*
* Order is (x, y, z, qx, qy, qz)
*/
- const fuse_core::Matrix6d & sqrtInformation() const {return sqrt_information_;}
+ const fuse_core::Matrix6d& sqrtInformation() const
+ {
+ return sqrt_information_;
+ }
/**
* @brief Compute the measurement covariance matrix.
@@ -129,7 +131,7 @@ class AbsolutePose3DStampedConstraint : public fuse_core::Constraint
*
* @param[out] stream The stream to write to. Defaults to stdout.
*/
- void print(std::ostream & stream = std::cout) const override;
+ void print(std::ostream& stream = std::cout) const override;
/**
* @brief Construct an instance of this constraint's cost function
@@ -141,10 +143,10 @@ class AbsolutePose3DStampedConstraint : public fuse_core::Constraint
*
* @return A base pointer to an instance of a derived CostFunction.
*/
- ceres::CostFunction * costFunction() const override;
+ ceres::CostFunction* costFunction() const override;
protected:
- fuse_core::Vector7d mean_; //!< The measured/prior mean vector for this variable
+ fuse_core::Vector7d mean_; //!< The measured/prior mean vector for this variable
fuse_core::Matrix6d sqrt_information_; //!< The square root information matrix
private:
@@ -158,12 +160,12 @@ class AbsolutePose3DStampedConstraint : public fuse_core::Constraint
* @param[in/out] archive - The archive object that holds the serialized class members
* @param[in] version - The version of the archive being read/written. Generally unused.
*/
- template
- void serialize(Archive & archive, const unsigned int /* version */)
+ template
+ void serialize(Archive& archive, const unsigned int /* version */)
{
- archive & boost::serialization::base_object(*this);
- archive & mean_;
- archive & sqrt_information_;
+ archive& boost::serialization::base_object(*this);
+ archive& mean_;
+ archive& sqrt_information_;
}
};
diff --git a/fuse_constraints/include/fuse_constraints/marginal_constraint.hpp b/fuse_constraints/include/fuse_constraints/marginal_constraint.hpp
index 15f729ab7..f9c8ed372 100644
--- a/fuse_constraints/include/fuse_constraints/marginal_constraint.hpp
+++ b/fuse_constraints/include/fuse_constraints/marginal_constraint.hpp
@@ -65,7 +65,6 @@
#include
#include
-
namespace fuse_constraints
{
@@ -103,14 +102,9 @@ class MarginalConstraint : public fuse_core::Constraint
* @param[in] last_A Iterator pointing to one past the last A matrix
* @param[in] b The b vector of the marginal cost (of the form A*(x - x_bar) + b)
*/
- template
- MarginalConstraint(
- const std::string & source,
- VariableIterator first_variable,
- VariableIterator last_variable,
- MatrixIterator first_A,
- MatrixIterator last_A,
- const fuse_core::VectorXd & b);
+ template
+ MarginalConstraint(const std::string& source, VariableIterator first_variable, VariableIterator last_variable,
+ MatrixIterator first_A, MatrixIterator last_A, const fuse_core::VectorXd& b);
/**
* @brief Destructor
@@ -120,23 +114,32 @@ class MarginalConstraint : public fuse_core::Constraint
/**
* @brief Read-only access to the A matrices of the marginal constraint
*/
- const std::vector & A() const {return A_;}
+ const std::vector& A() const
+ {
+ return A_;
+ }
/**
* @brief Read-only access to the b vector of the marginal constraint
*/
- const fuse_core::VectorXd & b() const {return b_;}
+ const fuse_core::VectorXd& b() const
+ {
+ return b_;
+ }
/**
* @brief Read-only access to the variable linearization points, x_bar
*/
- const std::vector & x_bar() const {return x_bar_;}
+ const std::vector& x_bar() const
+ {
+ return x_bar_;
+ }
#if !CERES_SUPPORTS_MANIFOLDS
/**
* @brief Read-only access to the variable local parameterizations
*/
- const std::vector & localParameterizations() const
+ const std::vector& localParameterizations() const
{
return local_parameterizations_;
}
@@ -144,7 +147,10 @@ class MarginalConstraint : public fuse_core::Constraint
/**
* @brief Read-only access to the variable manifolds
*/
- const std::vector & manifolds() const {return manifolds_;}
+ const std::vector& manifolds() const
+ {
+ return manifolds_;
+ }
#endif
/**
@@ -152,7 +158,7 @@ class MarginalConstraint : public fuse_core::Constraint
*
* @param[out] stream The stream to write to. Defaults to stdout.
*/
- void print(std::ostream & stream = std::cout) const override;
+ void print(std::ostream& stream = std::cout) const override;
/**
* @brief Construct an instance of this constraint's cost function
@@ -164,11 +170,11 @@ class MarginalConstraint : public fuse_core::Constraint
*
* @return A base pointer to an instance of a derived CostFunction.
*/
- ceres::CostFunction * costFunction() const override;
+ ceres::CostFunction* costFunction() const override;
protected:
std::vector A_; //!< The A matrices of the marginal constraint
- fuse_core::VectorXd b_; //!< The b vector of the marginal constraint
+ fuse_core::VectorXd b_; //!< The b vector of the marginal constraint
#if !CERES_SUPPORTS_MANIFOLDS
//!< The local parameterizations
std::vector local_parameterizations_;
@@ -187,8 +193,8 @@ class MarginalConstraint : public fuse_core::Constraint
* @param[out] archive - The archive object into which class members will be serialized
* @param[in] version - The version of the archive being written.
*/
- template
- void save(Archive & archive, const unsigned int /* version */) const
+ template
+ void save(Archive& archive, const unsigned int /* version */) const
{
archive << boost::serialization::base_object(*this);
archive << A_;
@@ -207,13 +213,14 @@ class MarginalConstraint : public fuse_core::Constraint
* @param[in] archive - The archive object that holds the serialized class members
* @param[in] version - The version of the archive being read.
*/
- template
- void load(Archive & archive, const unsigned int version)
+ template
+ void load(Archive& archive, const unsigned int version)
{
archive >> boost::serialization::base_object(*this);
archive >> A_;
archive >> b_;
- if (version == 0) {
+ if (version == 0)
+ {
// Version 0 serialization files will contain a std::vector of LocalParameterization
// shared pointers. If the current version of Ceres Solver does not support Manifolds,
// then the serialized LocalParameterization pointers can be deserialized directly into
@@ -224,26 +231,25 @@ class MarginalConstraint : public fuse_core::Constraint
#else
auto local_parameterizations = std::vector();
archive >> local_parameterizations;
- std::transform(
- std::make_move_iterator(local_parameterizations.begin()),
- std::make_move_iterator(local_parameterizations.end()),
- std::back_inserter(manifolds_),
- [](fuse_core::LocalParameterization::SharedPtr local_parameterization)
- {return fuse_core::ManifoldAdapter::make_shared(std::move(local_parameterization));});
+ std::transform(std::make_move_iterator(local_parameterizations.begin()),
+ std::make_move_iterator(local_parameterizations.end()), std::back_inserter(manifolds_),
+ [](fuse_core::LocalParameterization::SharedPtr local_parameterization) {
+ return fuse_core::ManifoldAdapter::make_shared(std::move(local_parameterization));
+ });
#endif
- } else { // (version >= 1)
- // Version 1 serialization files will contain a std::vector of Manifold shared pointers. If
- // the current version of Ceres Solver does not support Manifolds, then there is no way to
- // deserialize the requested data. But if the current version of Ceres Solver does support
- // manifolds, then the serialized Manifold pointers can be deserialized directly into the
- // class member.
+ }
+ else
+ { // (version >= 1)
+ // Version 1 serialization files will contain a std::vector of Manifold shared pointers. If
+ // the current version of Ceres Solver does not support Manifolds, then there is no way to
+ // deserialize the requested data. But if the current version of Ceres Solver does support
+ // manifolds, then the serialized Manifold pointers can be deserialized directly into the
+ // class member.
#if !CERES_SUPPORTS_MANIFOLDS
- throw std::runtime_error(
- "Attempting to deserialize an archive saved in Version " +
- std::to_string(
- version) + " format. However, the current version of Ceres Solver (" +
- CERES_VERSION_STRING + ") does not support manifolds. Ceres Solver version 2.1.0 "
- "or later is required to load this file.");
+ throw std::runtime_error("Attempting to deserialize an archive saved in Version " + std::to_string(version) +
+ " format. However, the current version of Ceres Solver (" + CERES_VERSION_STRING +
+ ") does not support manifolds. Ceres Solver version 2.1.0 "
+ "or later is required to load this file.");
#else
archive >> manifolds_;
#endif
@@ -259,7 +265,7 @@ namespace detail
/**
* @brief Return the UUID of the provided variable
*/
-inline const fuse_core::UUID getUuid(const fuse_core::Variable & variable)
+inline const fuse_core::UUID getUuid(const fuse_core::Variable& variable)
{
return variable.uuid();
}
@@ -267,7 +273,7 @@ inline const fuse_core::UUID getUuid(const fuse_core::Variable & variable)
/**
* @brief Return the current value of the provided variable
*/
-inline const fuse_core::VectorXd getCurrentValue(const fuse_core::Variable & variable)
+inline const fuse_core::VectorXd getCurrentValue(const fuse_core::Variable& variable)
{
return Eigen::Map(variable.data(), variable.size());
}
@@ -276,8 +282,7 @@ inline const fuse_core::VectorXd getCurrentValue(const fuse_core::Variable & var
/**
* @brief Return the local parameterization of the provided variable
*/
-inline fuse_core::LocalParameterization::SharedPtr getLocalParameterization(
- const fuse_core::Variable & variable)
+inline fuse_core::LocalParameterization::SharedPtr getLocalParameterization(const fuse_core::Variable& variable)
{
return fuse_core::LocalParameterization::SharedPtr(variable.localParameterization());
}
@@ -285,7 +290,7 @@ inline fuse_core::LocalParameterization::SharedPtr getLocalParameterization(
/**
* @brief Return the manifold of the provided variable
*/
-inline fuse_core::Manifold::SharedPtr getManifold(const fuse_core::Variable & variable)
+inline fuse_core::Manifold::SharedPtr getManifold(const fuse_core::Variable& variable)
{
return fuse_core::Manifold::SharedPtr(variable.manifold());
}
@@ -293,31 +298,27 @@ inline fuse_core::Manifold::SharedPtr getManifold(const fuse_core::Variable & va
} // namespace detail
-template
-MarginalConstraint::MarginalConstraint(
- const std::string & source,
- VariableIterator first_variable,
- VariableIterator last_variable,
- MatrixIterator first_A,
- MatrixIterator last_A,
- const fuse_core::VectorXd & b)
-: Constraint(source,
- boost::make_transform_iterator(first_variable, &fuse_constraints::detail::getUuid),
- boost::make_transform_iterator(last_variable, &fuse_constraints::detail::getUuid)),
- A_(first_A, last_A),
- b_(b),
+template
+MarginalConstraint::MarginalConstraint(const std::string& source, VariableIterator first_variable,
+ VariableIterator last_variable, MatrixIterator first_A, MatrixIterator last_A,
+ const fuse_core::VectorXd& b)
+ : Constraint(source, boost::make_transform_iterator(first_variable, &fuse_constraints::detail::getUuid),
+ boost::make_transform_iterator(last_variable, &fuse_constraints::detail::getUuid))
+ , A_(first_A, last_A)
+ , b_(b)
+ ,
#if !CERES_SUPPORTS_MANIFOLDS
- local_parameterizations_(boost::make_transform_iterator(first_variable,
- &fuse_constraints::detail::getLocalParameterization),
- boost::make_transform_iterator(last_variable,
- &fuse_constraints::detail::getLocalParameterization)),
+ local_parameterizations_(
+ boost::make_transform_iterator(first_variable, &fuse_constraints::detail::getLocalParameterization),
+ boost::make_transform_iterator(last_variable, &fuse_constraints::detail::getLocalParameterization))
+ ,
#else
- manifolds_(
- boost::make_transform_iterator(first_variable, &fuse_constraints::detail::getManifold),
- boost::make_transform_iterator(last_variable, &fuse_constraints::detail::getManifold)),
+ manifolds_(boost::make_transform_iterator(first_variable, &fuse_constraints::detail::getManifold),
+ boost::make_transform_iterator(last_variable, &fuse_constraints::detail::getManifold))
+ ,
#endif
x_bar_(boost::make_transform_iterator(first_variable, &fuse_constraints::detail::getCurrentValue),
- boost::make_transform_iterator(last_variable, &fuse_constraints::detail::getCurrentValue))
+ boost::make_transform_iterator(last_variable, &fuse_constraints::detail::getCurrentValue))
{
assert(!A_.empty());
assert(A_.size() == x_bar_.size());
@@ -327,19 +328,11 @@ MarginalConstraint::MarginalConstraint(
assert(A_.size() == manifolds_.size());
#endif
assert(b_.rows() > 0);
- assert(
- std::all_of(
- A_.begin(), A_.end(), [this](const auto & A) {
- return A.rows() == this->b_.rows();
- })); // NOLINT
- assert(
- std::all_of(
- boost::make_zip_iterator(boost::make_tuple(A_.begin(), first_variable)),
- boost::make_zip_iterator(boost::make_tuple(A_.end(), last_variable)),
- [](const boost::tuple & tuple) // NOLINT
- {
- return static_cast(tuple.get<0>().cols()) == tuple.get<1>().localSize();
- })); // NOLINT
+ assert(std::all_of(A_.begin(), A_.end(), [this](const auto& A) { return A.rows() == this->b_.rows(); })); // NOLINT
+ assert(std::all_of(boost::make_zip_iterator(boost::make_tuple(A_.begin(), first_variable)),
+ boost::make_zip_iterator(boost::make_tuple(A_.end(), last_variable)),
+ [](const boost::tuple& tuple) // NOLINT
+ { return static_cast(tuple.get<0>().cols()) == tuple.get<1>().localSize(); })); // NOLINT
}
} // namespace fuse_constraints
diff --git a/fuse_constraints/include/fuse_constraints/marginal_cost_function.hpp b/fuse_constraints/include/fuse_constraints/marginal_cost_function.hpp
index 671ebf380..c8a734221 100644
--- a/fuse_constraints/include/fuse_constraints/marginal_cost_function.hpp
+++ b/fuse_constraints/include/fuse_constraints/marginal_cost_function.hpp
@@ -78,11 +78,9 @@ class MarginalCostFunction : public ceres::CostFunction
* @param[in] x_bar The linearization point of the involved variables
* @param[in] local_parameterizations The local parameterization associated with the variable
*/
- MarginalCostFunction(
- const std::vector & A,
- const fuse_core::VectorXd & b,
- const std::vector & x_bar,
- const std::vector & local_parameterizations);
+ MarginalCostFunction(const std::vector& A, const fuse_core::VectorXd& b,
+ const std::vector& x_bar,
+ const std::vector& local_parameterizations);
#else
/**
* @brief Construct a cost function instance
@@ -92,11 +90,9 @@ class MarginalCostFunction : public ceres::CostFunction
* @param[in] x_bar The linearization point of the involved variables
* @param[in] manifolds The manifold associated with the variable
*/
- MarginalCostFunction(
- const std::vector & A,
- const fuse_core::VectorXd & b,
- const std::vector & x_bar,
- const std::vector