# Mobile robot - unicycle model


```python
import numpy as np
import sympy as sy
sy.init_printing()
```


```python
s = sy.symbols('s', real=False)
x, y, theta = sy.symbols('x, y, theta')
x0, y0, theta0 = sy.symbols('x0, y0, theta0')
omega, v = sy.symbols('omega, v')
omega0, v0 = sy.symbols('omega_0, v_0')
zx, zy, ztheta = sy.symbols('z_x, z_y, z_theta')
ztheta
```


```python
xi = sy.Matrix([theta, x, y])
dxidt = sy.Matrix([omega, v*sy.cos(theta), v*sy.sin(theta)])
```

## Linearization


```python
A1 = dxidt.diff(theta).subs([(theta, theta0), (v, v0)])
A1
```


```python
A = sy.zeros(3,3)
A[:, 0] = A1
A
```


```python
A*A
```

## Measurements


```python
phi = sy.atan2(y, x) - theta + 180
d = sy.sqrt(x*x + y*y)
d
```


```python
C1 = sy.Matrix([[phi.diff(theta).subs([(x, x0), (y, y0)]), 
                 phi.diff(x).subs([(x, x0), (y, y0)]), 
                 phi.diff(y).subs([(x, x0), (y, y0)])]])  
C1
```


```python
C2 = sy.Matrix([[d.diff(theta).subs([(x, x0), (y, y0)]), 
                 d.diff(x).subs([(x, x0), (y, y0)]), 
                 d.diff(y).subs([(x, x0), (y, y0)])]])  
C2
```


```python
C = sy.Matrix([C1, C2])
C
```


```python
Obs = sy.Matrix([C, C*A, C*A*A])
Obs
```


```python
Obs.rank()
```


```python

```

813fd990a9c049ab71588eeffa22f83807b9f963
ipynb
Jupyter Notebook
modern-control/notebooks/Unicycle-model.ipynb
kjartan-at-tec/mr2025
88c28aa76e84890c25d252167e5bbcd25318463e
MIT
modern-control/notebooks/Unicycle-model.ipynb
kjartan-at-tec/mr2025
88c28aa76e84890c25d252167e5bbcd25318463e
MIT
modern-control/notebooks/Unicycle-model.ipynb
kjartan-at-tec/mr2025
88c28aa76e84890c25d252167e5bbcd25318463e
MIT
Qwen/Qwen-72B
1. YES
2. YES