# Examples

## Basics

The following examples demonstrate the conceptual operation of Caesar, highlighting specific features of the framework and its use.

### Continuous Scalar

This abstract example illustrates how `IncrementalInference`

enables algebraic relations between stochastic variables, and how a final posterior belief estimate is calculated from several pieces of information.

### Hexagonal 2D

A simple 2D robot trajectory example is expanded below using techniques developed in simultaneous localization and mapping (SLAM).

### Fixed-Lag Solving - Hexagonal2D Revisited

### A Under-Constrained Solution (unforced multimodality)

This tutorial describes a range-only system where there are always more variable dimensions than range measurements made. The error distribution over ranges could be nearly anything, but are restricted to Gaussian-only in this example to illustrate an alternative point – other examples show inference results where highly non-Gaussian error distributions are used.

Multi-modal range only example (click here or image for full Vimeo):

Multi-Modal Under-Constrained Example

### Uncertain Data Associations, a Multi-Modal Solution (forced multi-hypothesis)

Documentation in progress, in the mean time please see the

`addFactor!(..., multihypo=[1.0; 0.5;0.5])`

feature for 50/50 uncertainty. Similarly for trinary or higher multi-hypotheses per factor.

TODO: add example.

### Adding Factors - Simple Factor Design

Caesar can be extended with new variables and factors without changing the core code. An example of this design pattern is provided in this example.

Defining New Variables and Factor

### Adding Factors - DynPose Factor

Intermediate Example: Adding Dynamic Factors and Variables

## Application Examples and Demos

### Multi-session Use-case

Multi-session Turtlebot example of the second floor in the Stata Center:

See reference for more details:

Fourie, D., Claassens, S., Pillai, S., Mata, R., Leonard, J.: "SLAMinDB: Centralized graph databases for mobile robotics", IEEE International Conference on Robotics and Automation (ICRA), Singapore, 2017.

### Simulated Ambiguous SONAR in 3D

Intersection of ambiguous elevation angle from planar SONAR sensor:

Bi-modal belief

### Synthetic Aperture Sonar SLAM

The full functional (approximate sum-product) inference approach can be used to natively imbed single hydrophone acoustic waveform data into highly non-Gaussian SAS factors–that implicitly perform beamforming/micro-location–-for a simultaneous localization and mapping solution (image links to video):

See reference for more details:

Cheung, M., Fourie, D., Rypkema, N., Vaz Teixeira, P., Schmidt, H., and Leonard, J.: "Non-Gaussian SLAM utilizing Synthetic Aperture Sonar", Intl. Conf. On Robotics and Automation (ICRA), IEEE, Montreal, 2019.

## Probabilistic Data Association (Uncertain loop closures)

Example where the standard multihypothesis `addFactor!(.., multihypo=[1.0;0.5;0.5])`

interface is used. This is from the Kitti driving dataset. Video here.

See reference for more details:

Doherty, K., Fourie, D., Leonard, J.: "Multimodal Semantic SLAM with Probabilistic Data Association", Intl. Conf. On Robotics and Automation (ICRA), IEEE, Montreal, 2019.

## More Examples

Please see examples folders for Caesar and RoME for more examples, with expanded documentation in the works.