Double Integrator
commonroad_control.vehicle_dynamics.double_integrator.double_integrator
DoubleIntegrator
Bases: VehicleModelInterface
Double integrator model.
Source code in commonroad_control/vehicle_dynamics/double_integrator/double_integrator.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 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
_discretize_nominal()
Time-discretization of the nominal dynamics model assuming a constant control input throughout the time interval [0, delta_t].
Returns:
| Type | Description |
|---|---|
Tuple[Function, Function, Function]
|
time-discretized dynamical system (CasADi function) and its Jacobians (CasADi function) |
Source code in commonroad_control/vehicle_dynamics/double_integrator/double_integrator.py
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 | |
_dynamics_cas(x, u, w)
Continuous-time dynamics function of the vehicle model for simulation and symbolic operations using CasADi.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Union[sym, ndarray[tuple[float], dtype[float64]]]
|
state - CasADi symbolic/ array of dimension (self._nx,) |
required |
u
|
Union[sym, ndarray[tuple[float], dtype[float64]]]
|
control input - CasADi symbolic/ array of dimension (self._nu,) |
required |
w
|
Union[sym, ndarray[tuple[float], dtype[float64]]]
|
disturbance - CasADi symbolic/ array of dimension (self._nw,) |
required |
Returns:
| Type | Description |
|---|---|
sym
|
dynamics function evaluated at (x,u,w) - CasADi symbolic/ array of dimension (self._nx,) |
Source code in commonroad_control/vehicle_dynamics/double_integrator/double_integrator.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
_set_input_bounds(params)
Extract input bounds from vehicle parameters and returns them as instances of the Input class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
VehicleParameters
|
vehicle parameters |
required |
Returns:
| Type | Description |
|---|---|
Tuple[DIInput, DIInput]
|
lower and upper bound on the inputs - DIInputs |
Source code in commonroad_control/vehicle_dynamics/double_integrator/double_integrator.py
74 75 76 77 78 79 80 81 82 83 84 85 86 | |
_system_matrices()
staticmethod
Returns:
| Type | Description |
|---|---|
Tuple[array, array]
|
system and input matrix - arrays of dimension (self._nx, self._nx) and (self._nx, self._nu) |
Source code in commonroad_control/vehicle_dynamics/double_integrator/double_integrator.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
compute_normalized_acceleration(x, u)
Computes the normalized longitudinal and lateral acceleration (w.r.t. the maximum acceleration).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Union[DIState, sym, array]
|
state - State/ CasADi symbolic/ array of dimension (self._nx,) |
required |
u
|
Union[DIInput, sym, array]
|
control input - Input/ CasADi symbolic/ array of dimension (self._nu,) |
required |
Returns:
| Type | Description |
|---|---|
Tuple[Union[float, sym], Union[float, sym]]
|
normalized longitudinal and lateral acceleration - float/ CasADi symbolic |
Source code in commonroad_control/vehicle_dynamics/double_integrator/double_integrator.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
factory_method(params, delta_t)
classmethod
Factory method to generate class
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
VehicleParameters
|
CommonRoad-Control vehicle params |
required |
delta_t
|
float
|
sampling time |
required |
Returns:
| Type | Description |
|---|---|
DoubleIntegrator
|
instance |
Source code in commonroad_control/vehicle_dynamics/double_integrator/double_integrator.py
29 30 31 32 33 34 35 36 37 | |
state_bounds()
staticmethod
Returns:
| Type | Description |
|---|---|
Tuple[array, array, array, array]
|
|
Source code in commonroad_control/vehicle_dynamics/double_integrator/double_integrator.py
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 | |
commonroad_control.vehicle_dynamics.double_integrator.di_state
DIState
dataclass
Bases: StateInterface
Dataclass storing the states of the double integrator model.
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_state.py
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 | |
dim
property
Returns:
| Type | Description |
|---|---|
int
|
state dimension |
convert_to_array()
Converts instance of class to numpy array.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray of dimension (self.dim,) |
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_state.py
43 44 45 46 47 48 49 50 51 52 53 54 | |
to_cr_custom_state(time_step)
Convert to CommonRoad custom state
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time_step
|
int
|
time step - int |
required |
Returns:
| Type | Description |
|---|---|
CustomState
|
CommonRoad custom state |
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_state.py
64 65 66 67 68 69 70 | |
to_cr_initial_state(time_step)
Convert to CommonRoad initial state
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time_step
|
int
|
time step - int |
required |
Returns:
| Type | Description |
|---|---|
InitialState
|
CommonRoad InitialState |
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_state.py
56 57 58 59 60 61 62 | |
DIStateIndices
dataclass
Bases: StateInterfaceIndex
Indices of the states of the double integrator model.
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_state.py
12 13 14 15 16 17 18 19 20 21 22 | |
commonroad_control.vehicle_dynamics.double_integrator.di_input
DIInput
dataclass
Bases: InputInterface
Dataclass storing the control input of the double integrator model.
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_input.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 | |
dim
property
Returns:
| Type | Description |
|---|---|
int
|
control input dimension |
convert_to_array()
Converts instance of class to numpy array.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray of dimension (self.dim,) |
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_input.py
38 39 40 41 42 43 44 45 46 47 48 | |
DIInputIndices
dataclass
Bases: InputInterfaceIndex
Indices of the control inputs of the double integrator model.
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_input.py
11 12 13 14 15 16 17 18 19 | |
commonroad_control.vehicle_dynamics.double_integrator.di_trajectory
DITrajectory
dataclass
Bases: TrajectoryInterface
Double integrator model Trajectory
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_trajectory.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
to_cr_dynamic_obstacle(vehicle_width, vehicle_length, vehicle_id)
Converts state trajectory to CommonRoad dynamic obstacles 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 |
|---|---|
|
CommonRoad dynamic obstacle |
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_trajectory.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
commonroad_control.vehicle_dynamics.double_integrator.di_disturbance
DIDisturbance
dataclass
Bases: DisturbanceInterface
Dataclass storing the disturbances of the double integrator model.
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_disturbance.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 | |
dim
property
Returns:
| Type | Description |
|---|---|
int
|
disturbance dimension |
convert_to_array()
Converts instance of class to numpy array.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray of dimension (self.dim,) |
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_disturbance.py
42 43 44 45 46 47 48 49 50 51 52 53 | |
DIDisturbanceIndices
dataclass
Bases: DisturbanceInterfaceIndex
Indices of the disturbances of the double integrator model.
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_disturbance.py
11 12 13 14 15 16 17 18 19 20 21 | |
commonroad_control.vehicle_dynamics.double_integrator.di_noise
DINoise
dataclass
Bases: FullStateNoiseInterface
Full state noise of the double integrator model - required for the full state feedback sensor model.
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_noise.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 | |
dim
property
Returns:
| Type | Description |
|---|---|
int
|
noise dimension |
convert_to_array()
Converts instance of class to numpy array.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray of dimension (self.dim,) |
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_noise.py
42 43 44 45 46 47 48 49 50 51 52 53 | |
DINoiseIndices
dataclass
Bases: FullStateNoiseInterfaceIndex
Indices of the noise variables.
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_noise.py
11 12 13 14 15 16 17 18 19 20 21 | |
commonroad_control.vehicle_dynamics.double_integrator.di_sidt_factory
DISIDTFactory
Bases: StateInputDisturbanceTrajectoryFactoryInterface
Factory for creating double integrator model State, Input, Disturbance, and Trajectory.
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_sidt_factory.py
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 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 | |
disturbance_from_args(position_long=0.0, position_lat=0.0, velocity_long=0.0, velocity_lat=0.0)
classmethod
Create Disturbance from args - the default value of all variables is zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position_long
|
float
|
longitudinal position |
0.0
|
position_lat
|
float
|
lateral position |
0.0
|
velocity_long
|
float
|
longitudinal velocity |
0.0
|
velocity_lat
|
float
|
lateral velocity |
0.0
|
Returns:
| Type | Description |
|---|---|
Union[DIDisturbance]
|
DIDisturbance |
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_sidt_factory.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
disturbance_from_numpy_array(w_np)
classmethod
Create Disturbance from numpy array
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
w_np
|
ndarray[tuple[float], dtype[float64]]
|
disturbance - array of dimension (cls.disturbance_dimension,) |
required |
Returns:
| Type | Description |
|---|---|
Union[DIDisturbance]
|
DIDisturbance |
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_sidt_factory.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
input_from_args(acceleration_long, acceleration_lat)
classmethod
Create Input from args
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
acceleration_long
|
float
|
longitudinal acceleration |
required |
acceleration_lat
|
float
|
lateral acceleration |
required |
Returns:
| Type | Description |
|---|---|
Union[DIInput]
|
DIInput |
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_sidt_factory.py
61 62 63 64 65 66 67 68 69 | |
input_from_numpy_array(u_np)
classmethod
Create Input from numpy array
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u_np
|
ndarray[tuple[float], dtype[float64]]
|
control input - array of dimension (cls.input_dimension,) |
required |
Returns:
| Type | Description |
|---|---|
Union[DIInput]
|
DIInput |
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_sidt_factory.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
state_from_args(position_long, position_lat, velocity_long, velocity_lat)
classmethod
Create State from args
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position_long
|
float
|
longitudinal position |
required |
position_lat
|
float
|
lateral position |
required |
velocity_long
|
float
|
longitudinal velocity |
required |
velocity_lat
|
float
|
lateral velocity |
required |
Returns:
| Type | Description |
|---|---|
Union[DIState]
|
DIState |
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_sidt_factory.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
state_from_numpy_array(x_np)
classmethod
Create State from numpy array
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_np
|
ndarray[tuple[float], dtype[float64]]
|
state vector - array of dimension (cls.state_dimension,) |
required |
Returns:
| Type | Description |
|---|---|
Union[DIState]
|
DIState |
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_sidt_factory.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
trajectory_from_numpy_array(traj_np, mode, time_steps, t_0, delta_t)
classmethod
Create State, Input, or Disturbance Trajectory from numpy array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
traj_np
|
ndarray[tuple[float, float], dtype[float64]]
|
numpy array storing the values of the point variables |
required |
mode
|
TrajectoryMode
|
type of points (State, Input, or Disturbance) |
required |
time_steps
|
List[int]
|
time steps of the points in the columns of traj_np |
required |
t_0
|
float
|
initial time - float |
required |
delta_t
|
float
|
sampling time - float |
required |
Returns:
| Type | Description |
|---|---|
DITrajectory
|
DITrajectory |
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_sidt_factory.py
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 | |
trajectory_from_points(trajectory_dict, mode, t_0, delta_t)
classmethod
Create State, Input, or Disturbance Trajectory from list of DI points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trajectory_dict
|
Union[Dict[int, DIState], Dict[int, DIInput]]
|
dict of time steps to kb points |
required |
mode
|
TrajectoryMode
|
type of points (State, Input, or Disturbance) |
required |
t_0
|
float
|
initial time - float |
required |
delta_t
|
float
|
sampling time - float |
required |
Returns:
| Type | Description |
|---|---|
DITrajectory
|
DITrajectory |
Source code in commonroad_control/vehicle_dynamics/double_integrator/di_sidt_factory.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |