Uncertainty Models
commonroad_control.simulation.uncertainty_model.uncertainty_interface
UncertaintyInterface
dataclass
Bases: ABC
Interface for dataclasses storing noise/disturbances.
Source code in commonroad_control/simulation/uncertainty_model/uncertainty_interface.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
dim
property
Returns:
| Type | Description |
|---|---|
|
uncertainty dimension - int |
convert_to_array()
abstractmethod
Converts instance of class to numpy array.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray of dimension (self.dim,1) |
Source code in commonroad_control/simulation/uncertainty_model/uncertainty_interface.py
29 30 31 32 33 34 35 | |
UncertaintyInterfaceIndex
dataclass
Bases: ABC
Indices of the uncertainties.
Source code in commonroad_control/simulation/uncertainty_model/uncertainty_interface.py
7 8 9 10 11 12 13 | |
commonroad_control.simulation.uncertainty_model.uncertainty_model_interface
UncertaintyModelInterface
Bases: ABC
Interface for uncertainty models for modeling disturbances or sensor noise. Examples include the gaussian or uniform distribution.
Source code in commonroad_control/simulation/uncertainty_model/uncertainty_model_interface.py
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
dim
property
Returns:
| Type | Description |
|---|---|
int
|
dimension of the uncertainty |
nominal_value
abstractmethod
property
Returns the nominal value of uncertainty model (the expected value of the underlying distribution or a user-defined nominal value).
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray of dimension (self.dim,) |
__init__(dim, nominal_value)
Initialize uncertainty model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dim
|
int
|
dimension of the uncertainty - int |
required |
nominal_value
|
Union[ndarray, List[float], UncertaintyInterface]
|
(optinally user-defined) nominal value of the uncertainty - array/ list of floats/ instance of class UncertaintyInterface |
required |
Source code in commonroad_control/simulation/uncertainty_model/uncertainty_model_interface.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
commonroad_control.simulation.uncertainty_model.no_uncertainty
NoUncertainty
Bases: UncertaintyModelInterface
Dummy uncertainty model, e.g., if no disturbance or noise models are employed for simulation.
Source code in commonroad_control/simulation/uncertainty_model/no_uncertainty.py
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 40 41 42 43 44 45 46 47 48 49 50 | |
nominal_value
property
Returns the nominal value of uncertainty model.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray of dimension (self.dim,) |
__init__(dim, *args, nominal_value=None, **kwargs)
Initialize no-uncertainty model. If no user-defined nominal value is provided, the nominal value is set to zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dim
|
int
|
dimension of the uncertainty - int |
required |
nominal_value
|
Union[ndarray, List[float], UncertaintyInterface, None]
|
if not None: user-defined nominal value of the uncertainty - array/ list of floats/ instance of class UncertaintyInterface |
None
|
Source code in commonroad_control/simulation/uncertainty_model/no_uncertainty.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
sample_uncertainty()
Since this model features no uncertainty, the nominal value is returned.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray of dimension (self.dim,) |
Source code in commonroad_control/simulation/uncertainty_model/no_uncertainty.py
45 46 47 48 49 50 | |
commonroad_control.simulation.uncertainty_model.uniform_distribution
UniformDistribution
Bases: UncertaintyModelInterface
Uncertainty model for generating uniformly distributed noise or disturbances.
Source code in commonroad_control/simulation/uncertainty_model/uniform_distribution.py
16 17 18 19 20 21 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 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 | |
nominal_value
property
Returns the nominal value, which is either the user-defined nominal value (passed as an input argument) or the mean of the uniform distribution
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray of dimension (self.dim,) |
__init__(dim, lower_bound, upper_bound, *args, nominal_value=None, **kwargs)
Initialize uncertainty model. If no user-defined nominal value is provided, the mean of the uniform distribution serves as the nominal value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dim
|
int
|
dimension of the uncertainty - int |
required |
lower_bound
|
Union[ndarray, list[float], UncertaintyInterface]
|
lower bound of the uncertainty values - array/ list of floats/ instance of class UncertaintyInterface |
required |
upper_bound
|
Union[ndarray, list[float], UncertaintyInterface]
|
upper bound of the uncertainty values - array/ list of floats/ instance of class UncertaintyInterface |
required |
nominal_value
|
Union[ndarray, list[float], UncertaintyInterface]
|
if not None: user-defined nominal value of the uncertainty - array/ list of floats/ instance of class UncertaintyInterface |
None
|
Source code in commonroad_control/simulation/uncertainty_model/uniform_distribution.py
21 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 50 51 52 53 54 55 56 57 | |
_sanity_check()
Check args.
Source code in commonroad_control/simulation/uncertainty_model/uniform_distribution.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
sample_uncertainty()
Generates a random sample from the uniform distribution.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray of dimension (self.dim,) |
Source code in commonroad_control/simulation/uncertainty_model/uniform_distribution.py
92 93 94 95 96 97 | |
commonroad_control.simulation.uncertainty_model.gaussian_distribution
GaussianDistribution
Bases: UncertaintyModelInterface
Uncertainty model for generating Gaussian noise or disturbances.
Source code in commonroad_control/simulation/uncertainty_model/gaussian_distribution.py
16 17 18 19 20 21 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 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 | |
mean
property
Returns:
| Type | Description |
|---|---|
ndarray
|
mean value |
nominal_value
property
Returns the nominal value, which is either the user-defined nominal value (passed as an input argument) or the mean of the Gaussian distribution
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray of dimension (self.dim,) |
std_deviations
property
"
Returns:
| Type | Description |
|---|---|
ndarray
|
standard deviations per entry |
__init__(dim, mean, std_deviation, *args, nominal_value=None, **kwargs)
Initialize uncertainty model. If no user-defined nominal value is provided, the mean of the Gaussian distribution serves as the nominal value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dim
|
int
|
dimension of the uncertainty - int |
required |
mean
|
Union[ndarray, List[float], UncertaintyInterface]
|
mean value - array/ list of floats/ instance of class UncertaintyInterface |
required |
std_deviation
|
Union[ndarray, List[float], UncertaintyInterface]
|
standard deviations (component-wise) - array/ list of floats/ instance of class UncertaintyInterface |
required |
nominal_value
|
Union[ndarray, List[float], UncertaintyInterface, None]
|
if not None: user-defined nominal value of the uncertainty - array/ list of floats/ instance of class UncertaintyInterface |
None
|
Source code in commonroad_control/simulation/uncertainty_model/gaussian_distribution.py
21 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 50 51 52 53 54 55 56 | |
_sanity_check()
Checks args
Source code in commonroad_control/simulation/uncertainty_model/gaussian_distribution.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
sample_uncertainty()
Generates a random sample from the Gaussian distribution.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray of dimension (self.dim,) |
Source code in commonroad_control/simulation/uncertainty_model/gaussian_distribution.py
97 98 99 100 101 102 | |