|  | 
| 6 | 6 |    "source": [ | 
| 7 | 7 |     "# Model predictive speed and steering control\n", | 
| 8 | 8 |     "\n", | 
|  | 9 | +    "code:\n", | 
|  | 10 | +    "\n", | 
| 9 | 11 |     "https://github.com/AtsushiSakai/PythonRobotics/blob/master/PathTracking/model_predictive_speed_and_steer_control/model_predictive_speed_and_steer_control.py\n", | 
| 10 | 12 |     "\n", | 
| 11 | 13 |     "This is a path tracking simulation using model predictive control (MPC)\n", | 
|  | 
| 17 | 19 |    "cell_type": "markdown", | 
| 18 | 20 |    "metadata": {}, | 
| 19 | 21 |    "source": [ | 
| 20 |  | -    "# MPC modeling" | 
|  | 22 | +    "# MPC modeling\n", | 
|  | 23 | +    "\n", | 
|  | 24 | +    "State vector is:\n", | 
|  | 25 | +    "$$ z = [x, y, v,\\phi]$$ x: x-position, y:y-position, v:velocity, φ: yaw angle\n", | 
|  | 26 | +    "\n", | 
|  | 27 | +    "Input vector is:\n", | 
|  | 28 | +    "$$ u = [a, \\delta]$$ a: accellation, δ: steering angle\n", | 
|  | 29 | +    "\n" | 
|  | 30 | +   ] | 
|  | 31 | +  }, | 
|  | 32 | +  { | 
|  | 33 | +   "cell_type": "markdown", | 
|  | 34 | +   "metadata": {}, | 
|  | 35 | +   "source": [ | 
|  | 36 | +    "The MPC cotroller minimize this cost function for path tracking:\n", | 
|  | 37 | +    "\n", | 
|  | 38 | +    "$$min\\ Q_f(z_{T,ref}-z_{T})^2+Q\\Sigma({z_{t,ref}-z_{t}})^2+R\\Sigma{u_t}^2+R_d\\Sigma({u_{t+1}-u_{t}})^2$$\n", | 
|  | 39 | +    "\n", | 
|  | 40 | +    "z_ref come from target path and speed." | 
|  | 41 | +   ] | 
|  | 42 | +  }, | 
|  | 43 | +  { | 
|  | 44 | +   "cell_type": "markdown", | 
|  | 45 | +   "metadata": {}, | 
|  | 46 | +   "source": [ | 
|  | 47 | +    "subject to:\n", | 
|  | 48 | +    "- Linearlied vehicle model\n", | 
|  | 49 | +    "$$z_{t+1}=Az_t+Bu+C$$\n", | 
|  | 50 | +    "- Maximum steering speed\n", | 
|  | 51 | +    "$$|u_{t+1}-u_{t}|<du_{max}$$\n", | 
|  | 52 | +    "- Maximum steering angle\n", | 
|  | 53 | +    "$$|u_{t}|<u_{max}$$\n", | 
|  | 54 | +    "- Initial state\n", | 
|  | 55 | +    "$$z_0 = z_{0,ob}$$\n", | 
|  | 56 | +    "- Maximum and minimum speed\n", | 
|  | 57 | +    "$$v_{min} < v_t < v_{max}$$\n", | 
|  | 58 | +    "- Maximum and minimum input\n", | 
|  | 59 | +    "$$u_{min} < u_t < u_{max}$$\n" | 
|  | 60 | +   ] | 
|  | 61 | +  }, | 
|  | 62 | +  { | 
|  | 63 | +   "cell_type": "markdown", | 
|  | 64 | +   "metadata": {}, | 
|  | 65 | +   "source": [ | 
|  | 66 | +    "This is implemented at \n", | 
|  | 67 | +    "https://github.com/AtsushiSakai/PythonRobotics/blob/f51a73f47cb922a12659f8ce2d544c347a2a8156/PathTracking/model_predictive_speed_and_steer_control/model_predictive_speed_and_steer_control.py#L247-L301" | 
| 21 | 68 |    ] | 
| 22 | 69 |   }, | 
| 23 | 70 |   { | 
|  | 
| 26 | 73 |    "source": [ | 
| 27 | 74 |     "# Vehicle model linearization\n", | 
| 28 | 75 |     "\n", | 
| 29 |  | -    "State vector is:\n", | 
| 30 |  | -    "$$ z = [x, y, v,\\phi]$$ x: x-position, y:y-position, v:velocity, φ: yaw angle\n", | 
| 31 | 76 |     "\n", | 
| 32 |  | -    "Input vector is:\n", | 
| 33 |  | -    "$$ u = [a, \\delta]$$ a: accellation, δ: steering angle\n", | 
| 34 | 77 |     "\n", | 
| 35 | 78 |     "Vehicle model is \n", | 
| 36 | 79 |     "$$ \\dot{x} = vcos(\\phi)$$\n", | 
|  | 
0 commit comments