Skip to content

Commit

Permalink
Merge pull request #696 from JuliaRobotics/21Q1/prep/manijl
Browse files Browse the repository at this point in the history
bump v0.10.0, compat for manijl, and CI
  • Loading branch information
dehann authored Mar 28, 2021
2 parents d251002 + a7941f4 commit fd8320b
Show file tree
Hide file tree
Showing 11 changed files with 122 additions and 37 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: CI
on:
pull_request:
push:
branches:
- master
- develop
- release**
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.6'
- 'nightly'
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@latest
- run: |
git config --global user.name Tester
git config --global user.email [email protected]
- uses: julia-actions/julia-runtest@latest
continue-on-error: ${{ matrix.version == 'nightly' }}
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
file: lcov.info

test-masters:
#if: github.ref != 'refs/heads/release**'
name: This and Masters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: julia-actions/setup-julia@v1
with:
version: 1.6
arch: x64

- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- run: |
git config --global user.name Tester
git config --global user.email [email protected]
- name: Run tests on masters
run: |
julia --project=@. --check-bounds=yes -e 'using Pkg; Pkg.add(PackageSpec(name="RoME",rev="master"));'
julia --project=@. --check-bounds=yes -e 'using Pkg; Pkg.add(PackageSpec(name="IncrementalInference",rev="master"));'
julia --project=@. --check-bounds=yes -e 'using Pkg; Pkg.add(PackageSpec(name="ApproxManifoldProducts",rev="master"));'
julia --project=@. --check-bounds=yes -e 'using Pkg; Pkg.add(PackageSpec(name="DistributedFactorGraphs",rev="master"));'
julia --project=@. --check-bounds=yes -e 'using Pkg; Pkg.test("Caesar"; coverage=false)'
shell: bash
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ addons:
- hdf5-tools

julia:
- 1.5
- 1.6
- nightly


jobs:
include:
- name: "DEV MASTERS"
if: NOT branch =~ ^release.*$
julia: 1.5
julia: 1.6
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia -e 'using Pkg; Pkg.add(PackageSpec(name="RoME", rev="master"))'
Expand All @@ -30,7 +30,7 @@ jobs:
- julia --check-bounds=yes -e 'using Pkg; Pkg.test("Caesar"; coverage=false)'
after_success: skip
- stage: "Documentation"
julia: 1.5
julia: 1.6
script:
- julia --project=docs/ -e 'using Pkg; Pkg.add(PackageSpec(name="Caesar", rev="master")); Pkg.instantiate()'
- julia --project=docs/ -e 'using Pkg; Pkg.add(PackageSpec(name="RoME", rev="master"))'
Expand Down
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "Caesar"
uuid = "62eebf14-49bc-5f46-9df9-f7b7ef379406"
keywords = ["SLAM", "state-estimation", "MM-iSAM", "MM-iSAMv2", "inference", "robotics", "ROS"]
desc = "Non-Gaussian simultaneous localization and mapping"
version = "0.9.0"
version = "0.10.0"

[deps]
ApproxManifoldProducts = "9bbbb610-88a1-53cd-9763-118ce10c1f89"
Expand Down Expand Up @@ -54,7 +54,7 @@ FFTW = "1"
FileIO = "1"
ImageCore = "0.7, 0.8, 0.9"
ImageMagick = "0.7, 1.0, 1.1"
IncrementalInference = "0.20.1, 0.21"
IncrementalInference = "0.21, 0.22"
JLD2 = "0.1, 0.2, 0.3, 0.4"
JSON = "0.18, 0.19, 0.20, 0.21, 0.22, 0.23"
JSON2 = "0.3, 0.4"
Expand All @@ -64,7 +64,7 @@ Optim = "1"
ProgressMeter = "0.9, 1"
Reexport = "0.2, 1.0"
Requires = "0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 1"
RoME = "0.11, 0.12, 0.13"
RoME = "0.13, 0.14"
Rotations = "0.13, 1"
TensorCast = "0.2, 0.3, 0.4"
TimeZones = "1.3.1, 1.4"
Expand Down
3 changes: 2 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ makedocs(
"Multi-Language Support" => "concepts/multilang.md",
"Cloud Server/Database" => "concepts/database_interactions.md",
"Multi-session/agent Solving" => "concepts/multisession.md",
"Visualization (3D)" => "concepts/arena_visualizations.md",
"Parametric Solve (EXP)" => "examples/parametric_solve.md",
"Visualization (3D)" => "concepts/arena_visualizations.md",
],
"Examples" => [
"Caesar Examples" => "examples/examples.md",
Expand Down
2 changes: 1 addition & 1 deletion docs/src/concepts/available_varfacs.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ Pose3Pose3XYYaw

# Extending Caesar with New Variables and Factors

A question that frequently arises is how to design custom variables and factors to solve a specific type of graph. One strength of Caesar is the ability to incorporate new variables and factors at will. Please refer to [Adding Factors](adding_variables_factors.md) for more information on creating your own factors.
A question that frequently arises is how to design custom variables and factors to solve a specific type of graph. One strength of Caesar is the ability to incorporate new variables and factors at will. Please refer to [Adding Factors](../examples/adding_variables_factors.md) for more information on creating your own factors.
2 changes: 1 addition & 1 deletion docs/src/concepts/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,6 @@ It might also be convenient to warm up some of the Just-In-Time compiling:
The best way to avoid compile time (when not developing) is to use the established Julia "first time to plot" approach based on PackageCompiler.jl, and more details are provided at [Ahead of Time compiling](https://juliarobotics.org/Caesar.jl/latest/installation_environment/#Ahead-Of-Time-Compile-RoME.so), and a few common questions might be answered via [FAQ here](https://juliarobotics.org/Caesar.jl/latest/faq/#Static,-Shared-Object-.so-Compilation).
The next section describes the initial steps in constructing and solving graphs will be discussed in the upcoming documentation page [Building and Solving Graphs](building_graphs.md). We also recommend reviewing the various examples available in the [Examples section](../examples/examples.md). The variables and factors in Caesar should be sufficient for the majority of robotic applications, however Caesar allows users to extend the framework without changing the core code. This is discussed in [Creating New Variables and Factors](adding_variables_factors.md). Caesar supports both in-memory solving (fast, for moderately-sized graphs) as well as [shared data persistence and inference](database_interactions.md) for massive graphs, multiple sessions, and multiple agents.
The next section describes the initial steps in constructing and solving graphs will be discussed in the upcoming documentation page [Building and Solving Graphs](building_graphs.md). We also recommend reviewing the various examples available in the [Examples section](../examples/examples.md). The variables and factors in Caesar should be sufficient for the majority of robotic applications, however Caesar allows users to extend the framework without changing the core code. This is discussed in [Creating New Variables and Factors](../examples/adding_variables_factors.md). Caesar supports both in-memory solving (fast, for moderately-sized graphs) as well as [shared data persistence and inference](database_interactions.md) for massive graphs, multiple sessions, and multiple agents.
Although Caesar is Julia-based, it provides multi-language support with a ZMQ interface. This is discussed in [Caesar Multi-Language Support](multilang.md). Caesar.jl also supports various visualizations and plots by using Arena, RoMEPlotting, and Director. This is discussed in [Visualization with Arena.jl and RoMEPlotting.jl](arena_visualizations.md).
4 changes: 2 additions & 2 deletions docs/src/examples/basic_continuousscalar.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ using IncrementalInference
# using Distributions # automatically reexported by IncrementalInference
```

Guidelines for developing your own functions are discussed here in [Adding Variables and Factors](../concepts/adding_variables_factors.md), and we note that mechanizations and manifolds required for robotic simultaneous localization and mapping (SLAM) has been tightly integrated with the expansion package [RoME.jl](http://www.github.com/dehann/RoME.jl).
Guidelines for developing your own functions are discussed here in [Adding Variables and Factors](../examples/adding_variables_factors.md), and we note that mechanizations and manifolds required for robotic simultaneous localization and mapping (SLAM) has been tightly integrated with the expansion package [RoME.jl](http://www.github.com/dehann/RoME.jl).

The next step is to describe the inference problem with a graphical model with any of the existing concrete types that inherit from `<: AbstractDFG`.
The first step is to create an empty factor graph object and start populating it with variable nodes.
Expand All @@ -36,7 +36,7 @@ Factor graphs are bipartite graphs with `factors` that act as mathematical struc
After adding node `:x0`, a singleton factor of type `Prior` (which was defined by the user earlier) is 'connected to' variable node `:x0`.
This unary factor is taken as a `Distributions.Normal` distribution with zero mean and a standard devitation of `1`.
`Graphviz` can be used to visualize the factor graph structure, although the package is not installed by default -- `$ sudo apt-get install graphviz`.
Furthermore, the `writeGraphPdf` member definition is given at the end of this tutorial, which allows the user to store the graph image in graphviz supported image types.
Furthermore, the [`drawGraph`](@ref) member definition is given at the end of this tutorial, which allows the user to store the graph image in graphviz supported image types.
```julia
drawGraph(fg, show=true)
```
Expand Down
26 changes: 13 additions & 13 deletions docs/src/examples/basic_definingfactors.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ The `cfo` object contains the field `.factor::T` which is the type of the user f

Previously we looked at adding a prior. This section demonstrates the first of two `<:AbstractRelative` factor types. These are factors that introduce only relative information between variables in the factor graph.

This example is on `<:AbstractRelativeRoots`. First, lets create the factor as before
This example is on `<:IIF.AbstractRelativeRoots`. First, lets create the factor as before
```julia
struct MyFactor{T <: SamplableBelief} <: IIF.AbstractRelativeRoots
Z::T
Expand All @@ -116,9 +116,9 @@ end
```


The selection of `<:AbstractRelativeRoots`, akin to earlier `<:AbstractPrior`, instructs IIF to find the roots of the provided residual function. That is the one dimensional residual function, `res[1] = measurement - prediction`, is used during inference to approximate the convolution of conditional beliefs from the approximate beliefs of the connected variables in the factor graph.
The selection of `<:IIF.AbstractRelativeRoots`, akin to earlier `<:AbstractPrior`, instructs IIF to find the roots of the provided residual function. That is the one dimensional residual function, `res[1] = measurement - prediction`, is used during inference to approximate the convolution of conditional beliefs from the approximate beliefs of the connected variables in the factor graph.

Important aspects to note, `<:AbstractRelativeRoots` requires all elements `length(res)` (the factor measurement dimension) to have a feasible zero crossing solution. A two dimensional system will solve for variables where both `res[1]==0` and `res[2]==0`.
Important aspects to note, `<:IIF.AbstractRelativeRoots` requires all elements `length(res)` (the factor measurement dimension) to have a feasible zero crossing solution. A two dimensional system will solve for variables where both `res[1]==0` and `res[2]==0`.

!!! note
As of IncrementalInference v0.21, CalcResidual no longer takes a residual as input parameter and should return residual, see IIF#467.
Expand All @@ -128,7 +128,7 @@ Important aspects to note, `<:AbstractRelativeRoots` requires all elements `leng

### Two Dimension Minimize Example

The second type is `<:AbstractRelativeMinimize` which simply minimizes the residual vector of the user factor. This type is useful for partial constraint situations where the residual function is not gauranteed to have zero crossings in all dimensions and the problem is converted into a minimization problem instead:
The second type is `<:IIF.AbstractRelativeMinimize` which simply minimizes the residual vector of the user factor. This type is useful for partial constraint situations where the residual function is not gauranteed to have zero crossings in all dimensions and the problem is converted into a minimization problem instead:
```julia
struct OtherFactor{T <: SamplableBelief} <: IIF.AbstractRelativeMinimize
Z::T # assuming something 2 dimensional
Expand Down Expand Up @@ -171,7 +171,7 @@ MyMagnetoPrior(z) = MyMagnetoPrior(z, (3,))
getSample(cfo::CalcFactor{<:MyMagnetoPrior}, N::Int=1) = (reshape(rand(cfo.factor.Z,N),1,N),)
```

Similarly for `<:AbstractRelativeMinimize`, and note that the Roots version currently does not support the `.partial` option.
Similarly for `<:IIF.AbstractRelativeMinimize`, and note that the Roots version currently does not support the `.partial` option.

### Metadata

Expand Down Expand Up @@ -247,26 +247,26 @@ See the [parametric solve section](@ref parametric_factors)
All factors inherit from one of the following types, depending on their function:
* AbstractPrior: AbstractPrior are priors (unary factors) that provide an absolute constraint for a single variable. A simple example of this is an absolute GPS prior, or equivalently a (0, 0, 0) starting location in a [`Pose2`](@ref) scenario.
* Requires: A getSample function
* AbstractRelativeMinimize: AbstractRelativeMinimize are relative factors that introduce an algebraic relationship between two or more variables. A simple example of this is an odometry factor between two pose variables, or a range factor indicating the range between a pose and another variable.
* IIF.AbstractRelativeMinimize: IIF.AbstractRelativeMinimize are relative factors that introduce an algebraic relationship between two or more variables. A simple example of this is an odometry factor between two pose variables, or a range factor indicating the range between a pose and another variable.
* Requires: A getSample function and a residual function definition
* The minimize suffix specifies that the residual function of this factor will be enforced by numerical minimization (find me the minimum of this function)
* AbstractRelativeRoots: AbstractRelativeRoots are relative factors that introduce algebraic relationships between two or more variables. They are the same as AbstractRelativeMinimize, however they use root finding to find the zero crossings (rather than numerical minimization).
* IIF.AbstractRelativeRoots: IIF.AbstractRelativeRoots are relative factors that introduce algebraic relationships between two or more variables. They are the same as IIF.AbstractRelativeMinimize, however they use root finding to find the zero crossings (rather than numerical minimization).
* Requires: A getSample function and a residual function definition

How do you decide which to use?
* If you are creating factors for world-frame information that will be tied to a single variable, inherit from `<:AbstractPrior`
* GPS coordinates should be priors
* If you are creating factors for local-frame relationships between variables, inherit from AbstractRelativeMinimize
* If you are creating factors for local-frame relationships between variables, inherit from IIF.AbstractRelativeMinimize
* Odometry and bearing deltas should be introduced as pairwise factors and should be local frame
TBD: Users should start with AbstractRelativeMinimize, discuss why and when they should promote their factors to AbstractRelativeRoots.
TBD: Users should start with IIF.AbstractRelativeMinimize, discuss why and when they should promote their factors to IIF.AbstractRelativeRoots.

!!! note
AbstractRelativeMinimize does not imply that the overall inference algorithm only minimizes an objective function. The Multi-model iSAM algorithm is built around fixed-point analysis. Minimization is used here to locally enforce the residual function.
IIF.AbstractRelativeMinimize does not imply that the overall inference algorithm only minimizes an objective function. The Multi-model iSAM algorithm is built around fixed-point analysis. Minimization is used here to locally enforce the residual function.

What you need to build in the new factor:
* A struct for the factor itself
* A sampler function to return measurements from the random ditributions
* If you are building a [`AbstractRelativeMinimize`](@ref) or a [`AbstractRelativeRoots`](@ref) you need to define a residual function to introduce the relative algebraic relationship between the variables
* If you are building a [`IIF.AbstractRelativeMinimize`](@ref) or a [`IIF.AbstractRelativeRoots`](@ref) you need to define a residual function to introduce the relative algebraic relationship between the variables
* Minimization function should be lower-bounded and smooth
* A packed type of the factor which must be named Packed[Factor name], and allows the factor to be packed/transmitted/unpacked
* Serialization and deserialization methods
Expand All @@ -278,6 +278,6 @@ What you need to build in the new factor:
An example of this is the [`Pose2Point2BearingRange`](@ref), which provides a bearing+range relationship between a 2D pose and a 2D point.

```@docs
AbstractRelativeMinimize
AbstractRelativeRoots
IIF.AbstractRelativeMinimize
IIF.AbstractRelativeRoots
```
2 changes: 1 addition & 1 deletion docs/src/examples/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,4 @@ Caesar can be extended with new variables and factors without changing the core

### Adding Factors - DynPose Factor

[Intermediate Example: Adding Dynamic Factors and Variables](interm_dynpose.md)
[Intermediate Example: Adding Dynamic Factors and Variables](../principles/interm_dynpose.md)
Loading

0 comments on commit fd8320b

Please sign in to comment.