IDM Trajectory
IDMTrajectory
Bases: Trajectory
IDM Trajectory
Source code in commonroad_idm_planner/idm_trajectory.py
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 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 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 | |
__init__(initial_time_step, state_list, delta_t=0.1)
IDM Trajectory
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_time_step
|
int
|
initial state time step |
required |
state_list
|
List[IDMState]
|
list of states of initial state |
required |
delta_t
|
float
|
time step size |
0.1
|
Source code in commonroad_idm_planner/idm_trajectory.py
29 30 31 32 33 34 35 36 37 38 | |
calc_steering_angle_from_orientation(wheelbase_rear_to_cog, dt)
Updates states in state list by calculating the steering angle as the difference of orientations of to states.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wheelbase_rear_to_cog
|
float
|
distance of the rear wheelbase to the center of gravity |
required |
delta_t
|
time between steps |
required |
Source code in commonroad_idm_planner/idm_trajectory.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
check_collision(collision_checker, scenario, vehicle_width, vehicle_length)
Checks collision and returns true if so
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collision_checker
|
CollisionChecker
|
cr collision checker |
required |
scenario
|
Scenario
|
commonroad scenario |
required |
vehicle_width
|
float
|
vehicle width |
required |
vehicle_length
|
float
|
vehicle length |
required |
Returns:
| Type | Description |
|---|---|
CollisionStatus
|
true if collision and time step |
Source code in commonroad_idm_planner/idm_trajectory.py
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 | |
remove_all_states_later_than_state(idm_state)
Remove all states later than given state
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
idm_state
|
IDMState
|
last state that should be kept |
required |
Source code in commonroad_idm_planner/idm_trajectory.py
40 41 42 43 44 45 46 47 | |
to_cr_dynamic_obstacle(vehicle_width, vehicle_length, vehicle_id)
Converts trajectory cr dynamic obstacle for plotting
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vehicle_width
|
float
|
vehicle width |
required |
vehicle_length
|
float
|
vehicle length |
required |
vehicle_id
|
int
|
vehicle id |
required |
Returns:
| Type | Description |
|---|---|
DynamicObstacle
|
cr dynamic obstacle |
Source code in commonroad_idm_planner/idm_trajectory.py
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 | |
IDMState
dataclass
Bases: ExtendedPMState
IDM dataclass as extended point mass class
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
2d position as array |
required | |
velocity
|
long. velocity |
required | |
orientation
|
cartesian orientaiton |
required | |
acceleration
|
long. acceleration |
required | |
time_step
|
Time step of the state |
required | |
steering_angle
|
Optional[float]
|
steering angle |
None
|
Source code in commonroad_idm_planner/idm_state.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
IDMInput
dataclass
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
acceleration
|
float
|
long. acceleration |
required |
steering_angle_velocity
|
float
|
steering angle_velocity |
required |
time_step
|
int
|
time step at which the input is applied. |
required |
Source code in commonroad_idm_planner/idm_input.py
10 11 12 13 14 15 16 17 18 19 20 | |
IDMInputFactory
Approximates the input trajectory given a double-integrator-based state trajectory.
Source code in commonroad_idm_planner/idm_input.py
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 | |
input_from_idm_trajectory(idm_trajectory, dt)
Approximate input sequence of idm trajectory using a double integrator model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
idm_trajectory
|
IDMTrajectory
|
idm trajectory |
required |
dt
|
float
|
time steps size |
required |
Returns:
| Type | Description |
|---|---|
List[IDMInput]
|
sequence of inputs |
Source code in commonroad_idm_planner/idm_input.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
input_from_states(current_state, next_state, dt)
Calculate input via forward simulation
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
current_state
|
IDMState
|
current idm state |
required |
next_state
|
IDMState
|
next idm state |
required |
dt
|
float
|
time between two steps |
required |
Returns:
| Type | Description |
|---|---|
IDMInput
|
idm input |
Source code in commonroad_idm_planner/idm_input.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |