Models¶
bicycle
¶
SimpleBicycleModel
¶
Simple Bicycle Model.
State-space equation is:
where \(x, y, \phi, v\) are \(x\) position, \(y\) position, yaw, and velocity;
\(\delta, a\) are the steering angle and acceleration inputs; and \(L\) is the
wheel base length. This object also includes a method for dynamics updates
based on the set sampling time and the embedded bicycle model. Units are
[m, rad, s, m/s]
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state |
Optional[VehicleState]
|
Initial state of model, defaults to origin. |
None
|
update(steering, velocity, dt)
¶
Updates state.
Updates state using set sampling time, dt
, and embedded bicycle
dynamics. Designed to take same inputs as SVEA vehicle’s low-level
interface.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
steering |
float
|
Input steering angle for the car |
required |
velocity |
float
|
Input velocity for the car |
required |
cooperative
¶
Module for cooperative models with params set for SVEA cars. This model can be used for maintaining platoon structures with various setups of intra-platoon communication.
TODO
- Finish documentation of the state-space equation
- Create nice printout for Laplacian
- Add support for arbitrary communication structures, currently the model creation only supports k-nearest neighbor communication.
C_OVRV
¶
Bases: object
Cooperative model for the SVEA car.
The cooperative version of the optimal-velocity-relative-velocity (OVRV) model, aka the C-OVRV model. The model dictates the longitudinal speed of a given vehicle in a platoon based on the communicated state of the k-nearest platoon members. Specifically, the expected communicated values are the forward space-gap, velocity and length of each of the communicating vehicles. This C-OVRV model has the following state-space equation:
where \(s, \dot{x}\) are the space-gap between a vehicle and the vehicle in
front of it and the longitudinal speed of the vehicle. Units are
[m, s, m/s]
.
This model is meant to be used at steady-state. In other words, the platoon should already be formed and travelling at the intended speed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
platoon_size |
int
|
Number of vehicles in platoon. |
required |
num_neighbors |
int
|
Number of forward neighbors communicating with initially. |
required |
k_gains |
Sequence
|
Gains \(k_1, k_2, k_3, k_4\). Exception will be thrown if given number of values is not 4. |
required |
min_spacing |
float
|
Jam or minimum spacing, corresponds to \(\eta\) in |
required |
time_headway |
float
|
Desired time headway, corresponds to \(\tau\) in |
required |
init_leader_vel |
float
|
Initial velocity of leader vehicle in |
required |
length |
float
|
Bumper-to-bumper length in |
0.586
|
dt |
float
|
Sampling time for dynamics update in |
0.01
|
:type platoon_size: int :type num_neighbors: int :type k_gains: list :type min_spacing: float :type time_headway: float :type init_leader_vel: float :type length: float :type dt: float
compute_accel(spaces, velocities, leader_v)
¶
Given current spacing and velocity in the platoon, compute the acceleration based on the C-OVRV model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
spaces |
Sequence
|
Spaces in front of each vehicle in the platoon, must be same length as the size of the platoon. |
required |
velocities |
Sequence
|
Velocity of each vehicle in the platoon, must be same length as the size of the platoon. |
required |
leader_v |
float
|
Current velocity of the vehicle in front of the platoon. |
required |
Returns:
Type | Description |
---|---|
list
|
Accelerations for each vehicle to properly maintain the platoon. |
list
|
These can be considered control inputs. |
update_k_neighbors(new_k)
¶
Update number of communicating neighbors (in the forward direction) for updating dynamics and equilibrium point of C-OVRV model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
new_k |
int
|
New number of communicating neighbors. |
required |
update_leader_vel(new_vel)
¶
Update leader velocity [m/s]
for updating equilibrium of C-OVRV
model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
new_vel |
float
|
New velocity of the vehicle in front of the platoon (leader). |
required |
update_platoon_size(new_size)
¶
Update platoon size for updating dynamics and equilibrium point of C-OVRV model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
new_size |
int
|
New platoon size. |
required |