# Example notebooks

## Introductory examples

If you haven't already, check out the tutorials, which explain how to build and simulate models in Collimator.

### Primitive blocks and composability

Shows how to build systems with primitive blocks and how to compose them into larger diagrams.

### Bouncing ball

Shows hybrid dynamics modeling of a bouncing ball.

### Linear Quadratic Regulator (LQR)

Demonstrates the LQR for a pendulum and a planar quadrotor model.

### Energy shaping and LQR stabilization

Demonstrates energy shaping control to swing a pendulum to the vertically 'up' orientation and then stabilize it in the 'up' orientation via LQR.

### Linear Model Predictive Control (MPC)

Demonstrates MPC on a linearized model of the Cessna Citation aircraft and a pendulum model.

### Multi-layer perceptron (MLP)

Demonstrates training of a multi-layer perceptron (MLP), a class of feedforward artificial neural networks, for a regression task.

### Interacting with the Dashboard

Demonstrates how to interact with Collimator's Dashboard to upload your local models, import Dashboard models and run simulations on the cloud.

## Advanced examples

### Trajectory optimization and stabilization

Shows trajectory optimization for the problem of swinging an Acrobot to the vertically 'up' orientation and then stabilizing the trajectory via finite-horizon LQR.

### Robotic arm control

Implement a controller for a "pick-and-place" task with a robotic arm using MuJoCo as a multibody physics engine. Download the necessary files from here.

### Automatic tuning of a PID controller

Demonstrates automatic differentiation and optimization capabilities of Collimator to automatically tune the gains of a discrete-time PID controller.

### Interactive and automatic tuning of a PID controller with sensitivity constraints

Showcases fast compiled simulations in Collimator for interactive applications and automatic tuning of a continuous-time PID controller with maximum sensitivity and complementary sensitivity constraints.

### Finding limit cycles

Demonstrates how to find limit cycles and assess their stability by leveraging the automatic differentiation capabilities of Collimator.

### Kalman Filters: linear and nonlinear extensions

Demonstrates the use of Kalman filters (finite and infinite-horizon) and nonlinear extensions (Extended Kalman Filter and Unscented Kalman Filter) for state estimation in a pendulum model. Where necessary, the nonlinear Pendulum plant is automatically linearized and discretized by Collimator for the construction of the filters.

### Universal Differential Equations (UDEs) and symbolic regression (SR)

Demonstrates training a Universal Differential Equation (UDE) to fit the observations produced by the Lotka-Volterra predator-prey system. Subsequently, the UDE is symbolically regressed to learn a closed-form model.

### Nonlinear MPC

See thematic series on modeling and control of 3D quadcopter below, which showcases trajectory tracking by nonlinear MPC.

### Submodels

Demonstrates how to download a submodel defined in the Dashboard, incorporate it in a local model to run an optimization workflow and upload the result to the Dashboard.

## Thematic examples

### Battery modeling

- Equivalent circuit model (ECM) for a battery
- ECM parameter estimation: synthetic data
- ECM parameter estimation: experimental data
- Data-driven modeling: Dynamic Mode Decomposition (DMD)
- Data-driven modeling: Extended DMD
- Data-driven modeling: SINDy with control
- Data-driven modeling: Neural Networks

### 3D quadcopter modeling and control

- 3D quadcopter modelling
- Trajectory generation through differentially flat outputs
- Control with nonlinear MPC