Control
Controller
¤
__init__(self, vehicle)
special
¤
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vehicle |
Vehicle |
Vehicle instance |
required |
Source code in ROAR_simulation/roar_autonomous_system/control_module/controller.py
12 13 14 15 16 17 18 19 20 |
|
run_step(self, vehicle, next_waypoint, **kwargs)
¤
Abstract function for run step
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vehicle |
Vehicle |
new vehicle state |
required |
next_waypoint |
Transform |
next waypoint |
required |
**kwargs |
|
{} |
Returns:
Type | Description |
---|---|
VehicleControl |
VehicleControl |
Source code in ROAR_simulation/roar_autonomous_system/control_module/controller.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
sync_data(self, vehicle)
¤
default sync data function
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vehicle |
Vehicle |
new vehicle state |
required |
Returns:
Type | Description |
---|---|
None |
None |
Source code in ROAR_simulation/roar_autonomous_system/control_module/controller.py
39 40 41 42 43 44 45 46 47 48 49 |
|
VehicleMPCController
¤
__init__(self, vehicle, route_file_path, target_speed=inf, steps_ahead=10, max_throttle=1, max_steering=1, dt=0.1)
special
¤
Source code in ROAR_simulation/roar_autonomous_system/control_module/mpc_controller.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
clip_throttle(throttle, curr_speed, target_speed)
staticmethod
¤
Source code in ROAR_simulation/roar_autonomous_system/control_module/mpc_controller.py
410 411 412 413 414 415 416 |
|
create_array_of_symbols(str_symbol, N)
staticmethod
¤
Source code in ROAR_simulation/roar_autonomous_system/control_module/mpc_controller.py
398 399 400 |
|
generate_fun(self, symb_fun, vars_, init, poly)
¤
Generates a function of the form fun(x, *args)
Source code in ROAR_simulation/roar_autonomous_system/control_module/mpc_controller.py
317 318 319 320 321 322 |
|
generate_grad(self, symb_fun, vars_, init, poly)
¤
TODO: add comments
Source code in ROAR_simulation/roar_autonomous_system/control_module/mpc_controller.py
324 325 326 327 328 329 330 331 332 333 |
|
get_closest_waypoint_index_2D(self, car_location, waypoint_location)
¤
Get the index of the closest waypoint in self.pts_2D Note: it may give wrong index when the route is overlapped
Source code in ROAR_simulation/roar_autonomous_system/control_module/mpc_controller.py
387 388 389 390 391 392 393 394 395 396 |
|
get_closest_waypoint_index_3D(self, car_location, waypoint_location)
¤
Get the index of the closest waypoint in self.track_DF car_location: current car location waypoint_location: next_waypoint
Source code in ROAR_simulation/roar_autonomous_system/control_module/mpc_controller.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
get_func_constraints_and_bounds(self)
¤
Defines MPC's cost function and constraints.
Source code in ROAR_simulation/roar_autonomous_system/control_module/mpc_controller.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
|
get_state0(self, v, cte, epsi, a, delta, poly)
¤
Source code in ROAR_simulation/roar_autonomous_system/control_module/mpc_controller.py
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
|
minimize_cost(self, bounds, x0, init)
¤
Source code in ROAR_simulation/roar_autonomous_system/control_module/mpc_controller.py
353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
|
run_step(self, vehicle, next_waypoint, **kwargs)
¤
Abstract function for run step
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vehicle |
Vehicle |
new vehicle state |
required |
next_waypoint |
Transform |
next waypoint |
required |
**kwargs |
|
{} |
Returns:
Type | Description |
---|---|
VehicleControl |
VehicleControl |
Source code in ROAR_simulation/roar_autonomous_system/control_module/mpc_controller.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
|
sync_data(self, vehicle)
¤
default sync data function
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vehicle |
|
new vehicle state |
required |
Returns:
Type | Description |
---|---|
None |
None |
Source code in ROAR_simulation/roar_autonomous_system/control_module/mpc_controller.py
208 209 |
|
transform_into_cars_coordinate_system(pts, x, y, cos_ψ, sin_ψ)
staticmethod
¤
Source code in ROAR_simulation/roar_autonomous_system/control_module/mpc_controller.py
402 403 404 405 406 407 408 |
|
This module contains PID controllers to perform lateral and longitudinal control.
OPTIMIZED_LATERAL_PID_VALUES
¤
PIDLateralController
¤
PIDLateralController implements lateral control using a PID.
__init__(self, vehicle, K_P=1.0, K_D=0.0, K_I=0.0, dt=0.03)
special
¤
Constructor method. :param vehicle: actor to apply to local planner logic onto :param K_P: Proportional term :param K_D: Differential term :param K_I: Integral term :param dt: time differential in seconds
Source code in ROAR_simulation/roar_autonomous_system/control_module/pid_controller.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
run_step(self, target_waypoint)
¤
Execute one step of lateral control to steer the vehicle towards a certain waypoin. :param target_waypoint: :return: steering control in the range [-1, 1] where: -1 maximum steering to left +1 maximum steering to right
Source code in ROAR_simulation/roar_autonomous_system/control_module/pid_controller.py
244 245 246 247 248 249 250 251 252 253 254 255 |
|
PIDLongitudinalController
¤
PIDLongitudinalController implements longitudinal control using a PID.
__init__(self, vehicle, K_P=1.0, K_D=0.0, K_I=0.0, dt=0.03)
special
¤
Constructor method. :param vehicle: actor to apply to local planner logic onto :param K_P: Proportional term :param K_D: Differential term :param K_I: Integral term :param dt: time differential in seconds
Source code in ROAR_simulation/roar_autonomous_system/control_module/pid_controller.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
|
run_step(self, target_speed)
¤
Execute one step of longitudinal control to reach a given target speed. :param target_speed: target speed in Km/h :return: throttle control
Source code in ROAR_simulation/roar_autonomous_system/control_module/pid_controller.py
188 189 190 191 192 193 194 195 |
|
PIDParam
pydantic-model
¤
dt: float
pydantic-field
¤
K_D: float
pydantic-field
¤
K_I: float
pydantic-field
¤
K_P: float
pydantic-field
¤
__config__
¤
__json_encoder__(obj)
special
staticmethod
¤
default_lateral_param()
staticmethod
¤
Source code in ROAR_simulation/roar_autonomous_system/control_module/pid_controller.py
30 31 32 |
|
default_longitudinal_param()
staticmethod
¤
Source code in ROAR_simulation/roar_autonomous_system/control_module/pid_controller.py
34 35 36 |
|
VehiclePIDController
¤
VehiclePIDController is the combination of two PID controllers (lateral and longitudinal) to perform the low level control a vehicle from client side
__init__(self, vehicle, args_lateral, args_longitudinal, target_speed=inf, max_throttle=1, max_steering=1)
special
¤
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vehicle |
Vehicle |
actor to apply to local planner logic onto |
required |
args_lateral |
PIDParam |
dictionary of arguments to set the lateral PID control |
required |
args_longitudinal |
PIDParam |
dictionary of arguments to set the longitudinal |
required |
target_speed |
|
target speedd in km/h |
inf |
max_throttle |
|
maximum throttle from, will be capped at 1 |
1 |
max_steering |
|
absolute maximum steering ranging from -1 - 1 |
1 |
Source code in ROAR_simulation/roar_autonomous_system/control_module/pid_controller.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
run_step(self, vehicle, next_waypoint, **kwargs)
¤
Execute one step of control invoking both lateral and longitudinal PID controllers to reach a target waypoint at a given target_speed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vehicle |
Vehicle |
New vehicle state |
required |
next_waypoint |
Transform |
target location encoded as a waypoint |
required |
**kwargs |
|
{} |
Returns:
Type | Description |
---|---|
VehicleControl |
Next Vehicle Control |
Source code in ROAR_simulation/roar_autonomous_system/control_module/pid_controller.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
sync_data(self, vehicle)
¤
default sync data function
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vehicle |
|
new vehicle state |
required |
Returns:
Type | Description |
---|---|
None |
None |
Source code in ROAR_simulation/roar_autonomous_system/control_module/pid_controller.py
161 162 163 164 |
|
LatitunalPurePursuitController
¤
__init__(self, vehicle, look_ahead_gain, look_ahead_distance)
special
¤
Source code in ROAR_simulation/roar_autonomous_system/control_module/pure_pursuit_control.py
95 96 97 98 99 100 101 |
|
run_step(self, vehicle, next_waypoint)
¤
Source code in ROAR_simulation/roar_autonomous_system/control_module/pure_pursuit_control.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
sync(self, vehicle)
¤
Source code in ROAR_simulation/roar_autonomous_system/control_module/pure_pursuit_control.py
124 125 |
|
LongitunalPurePursuitController
¤
__init__(self, vehicle, target_speed=60, kp=0.1)
special
¤
Source code in ROAR_simulation/roar_autonomous_system/control_module/pure_pursuit_control.py
76 77 78 79 |
|
run_step(self, vehicle)
¤
Source code in ROAR_simulation/roar_autonomous_system/control_module/pure_pursuit_control.py
81 82 83 84 85 86 87 88 |
|
sync(self, vehicle)
¤
Source code in ROAR_simulation/roar_autonomous_system/control_module/pure_pursuit_control.py
90 91 |
|
PurePursuitController
¤
__init__(self, vehicle, look_ahead_gain=0.1, look_ahead_distance=2, target_speed=60)
special
¤
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vehicle |
Vehicle |
Vehicle information |
required |
look_ahead_gain |
float |
Look ahead factor |
0.1 |
look_ahead_distance |
float |
look ahead distance |
2 |
target_speed |
|
desired longitudinal speed to maintain |
60 |
Source code in ROAR_simulation/roar_autonomous_system/control_module/pure_pursuit_control.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
run_step(self, vehicle, next_waypoint, **kwargs)
¤
run one step of Pure Pursuit Control
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vehicle |
Vehicle |
current vehicle state |
required |
next_waypoint |
Transform |
Next waypoint, Transform |
required |
**kwargs |
|
{} |
Returns:
Type | Description |
---|---|
VehicleControl |
Vehicle Control |
Source code in ROAR_simulation/roar_autonomous_system/control_module/pure_pursuit_control.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|