Autonomous-Motorsports-Purdue / AMP_ASSv5

The fifth iteration of our Autonomous Software Stack
0 stars 0 forks source link

ZED tracking coordinate-based kart control #8

Open arya1106 opened 7 months ago

arya1106 commented 7 months ago

Use the information provided by #6 and a series of target points to plan and follow a given path. Output control values of:

arya1106 commented 7 months ago

Discord Channel

arya1106 commented 6 months ago

Planning to use LQR implementation with forward kinematics from here. Another example implementation. Simulation code here.

arya1106 commented 6 months ago

Symbol definitions:

$x$ – x-coordinate relative to world frame $\dot{x}$ – x-coordinate change $y$ – y-coordinate relative to world frame $\dot{y}$ – y-coordinate change $\theta$ – yaw in degrees relative to world frae $\dot{\theta}$ – change in yaw $\phi$ – current steering angle of car $\dot{\phi}$ – current steering angle of car $t_0$ – current time $t_1$ – time we are trying to predict $dt$ – discrete time step $\beta$ – Brake (0-255) $\tau$ – Throttle (0-255) $\pi$ – Steering Angle (0-255) $u_1$ - velocity of kart $u_2$ - turning rate of kart

Image

What we get from the kart:

$x, y, \theta$ – Coordinates from #6 $\phi$ - Control memory

Forward kinematics

State vector

\begin{bmatrix}
x \\
y \\
\phi \\
\theta 
\end{bmatrix} 

Inputs:

Software (us) Controls (inputs):

Conversions:

$u_1$ = $c_1\beta + c_2\tau$ $u_2$ = $\frac{\pi - \phi}{dt}$

$c_1$ and $c_2$ to be found experimentally.

Differential State Matrix

\begin{bmatrix}
\dot{x} \\
\dot{y} \\
\dot{\phi} \\
\dot{\theta}

\end{bmatrix} =
\begin{bmatrix}
u_1\cos\theta \\
u_1\sin\theta \\
u_2 \\
u_1\cdot\frac{1}{L}\cdot\tan\phi 

\end{bmatrix}

State prediction

\begin{bmatrix}
x_t \\
y_t \\
\phi_t \\
\theta_t 
\end{bmatrix} 
+
\begin{bmatrix}
\dot{x} \\
\dot{y} \\
\dot{\phi} \\
\dot{\theta}

\end{bmatrix}
=
\begin{bmatrix}
x_{t+1}  \\
y_{t+1}  \\
\phi_{t+1}  \\
\theta_{t+1} 
\end{bmatrix} 
arya1106 commented 6 months ago

Just found this....

Worth a try to implement ourselves for the challenge, but we can use the reference here if we struggle.