Robot State Space
1. **State space equations and variables for robot models:**
a) **Unicycle model:**
- State variables: $x$, $y$, $\theta$ (position and orientation)
- Control variables: $v$ (linear velocity), $\omega$ (angular velocity)
- Equations:
$$\dot{x} = v \cos(\theta)$$
$$\dot{y} = v \sin(\theta)$$
$$\dot{\theta} = \omega$$
b) **Differential drive robot:**
- State variables: $x$, $y$, $\theta$
- Control variables: $\omega_l$, $\omega_r$ (left and right wheel angular velocities)
- Parameters: $r$ (wheel radius), $L$ (distance between wheels)
- Equations:
$$v = \frac{r}{2}(\omega_l + \omega_r)$$
$$\omega = \frac{r}{L}(\omega_r - \omega_l)$$
$$\dot{x} = v \cos(\theta)$$
$$\dot{y} = v \sin(\theta)$$
$$\dot{\theta} = \omega$$
c) **Simplified car model:**
- State variables: $x$, $y$, $\theta$
- Control variables: $v$ (velocity), $\phi$ (steering angle)
- Parameter: $L$ (wheelbase length)
- Equations:
$$\dot{x} = v \cos(\theta)$$
$$\dot{y} = v \sin(\theta)$$
$$\dot{\theta} = \frac{v}{L} \tan(\phi)$$
2. **Meaning of state and control variables:**
- State variables represent the robot's current position and orientation in 2D space.
- Control variables are inputs that influence the robot's motion, such as velocities or steering angles.
3. **Differences in dynamics:**
- Unicycle model uses linear and angular velocity directly.
- Differential drive uses wheel velocities to compute linear and angular velocities.
- Simplified car model includes steering angle affecting angular velocity, modeling car-like constraints.
4. **Simulation of unicycle model using Euler's method:**
- Given $\Delta t = 0.1$, $t \in [0,10]$, initial states $x(0)=0$, $y(0)=0$, $\theta(0)=1$.
- Control inputs $v=1$ always.
- Angular velocity $\omega(t)$ piecewise defined:
$$\omega(t) = \begin{cases} 3 & 0.5 \leq t \leq 1.5 \\ -3 & 2 \leq t \leq 3 \\ -3 & 4 \leq t \leq 5 \\ 3 & 6 \leq t \leq 7 \\ -3 & 8 \leq t \leq 9 \\ 0 & \text{otherwise} \end{cases}$$
- Euler update equations:
$$x_{k+1} = x_k + \Delta t \cdot v \cos(\theta_k)$$
$$y_{k+1} = y_k + \Delta t \cdot v \sin(\theta_k)$$
$$\theta_{k+1} = \theta_k + \Delta t \cdot \omega(t_k)$$
5. **Simulation of differential drive robot:**
- Parameters: $r=0.1$, $L=1$, initial states $x(0)=0$, $y(0)=0$, $\theta(0)=1$.
- Control inputs $\omega_l(t)$ and $\omega_r(t)$ piecewise defined:
$$\omega_l(t) = \begin{cases} 12 & 4 \leq t \leq 6 \\ 12 & 6 \leq t \leq 8 \\ 1 & \text{otherwise} \end{cases}$$
$$\omega_r(t) = \begin{cases} 12 & 0.5 \leq t \leq 1.5 \\ 12 & 2 \leq t \leq 4 \\ 1 & \text{otherwise} \end{cases}$$
- Compute linear and angular velocities:
$$v = \frac{r}{2}(\omega_l + \omega_r)$$
$$\omega = \frac{r}{L}(\omega_r - \omega_l)$$
- Euler update equations same as unicycle model.
6. **Plotting:**
- For both models, plot $x$ vs $y$, $x$ vs $t$, $y$ vs $t$, and $\theta$ vs $t$.
- Plotting $x$ vs $y$ over time creates a 2D trajectory movie.
7. **Code and plots:**
- Due to format, code and plots are not included here but can be implemented in Python or MATLAB using the above equations and Euler integration.
**Final note:**
- This completes the requested derivations, explanations, and simulation setup for the robot models.