Sensor Models
commonroad_control.simulation.sensor_models.sensor_model_interface
SensorModelInterface
Bases: ABC
Interface for sensor models which take the current state and control input as an input argument and simulate a (noisy) measurement.
Source code in commonroad_control/simulation/sensor_models/sensor_model_interface.py
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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
input_dimension
property
Returns:
| Type | Description |
|---|---|
int
|
input dimension |
noise_model
property
Returns:
| Type | Description |
|---|---|
UncertaintyModelInterface
|
Uncertainty model representing sensor noise |
output_dimension
property
Returns:
| Type | Description |
|---|---|
int
|
output dimension |
state_dimension
property
Returns:
| Type | Description |
|---|---|
int
|
state dimension |
__init__(noise_model, state_output_factory, dim, state_dimension, input_dimension)
Initialize baseclass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
noise_model
|
UncertaintyModelInterface
|
uncertainty model representing sensor noise - UncertaintyModelInterface |
required |
state_output_factory
|
Union[StateInputDisturbanceTrajectoryFactoryInterface, Any]
|
factory for creating States or Outputs as output arguments - StateInputDisturbanceTrajectoryFactoryInterface |
required |
dim
|
int
|
dimension of the output - int |
required |
state_dimension
|
int
|
state dimension - int |
required |
input_dimension
|
int
|
input dimension - int |
required |
Source code in commonroad_control/simulation/sensor_models/sensor_model_interface.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 | |
_output_function_cas(x, u)
abstractmethod
Implements the nominal output function y=h(x,u), where e.g., h(x,u) = Cx + Du for linear systems.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Union[array, sym]
|
state |
required |
u
|
Union[array, sym]
|
control input |
required |
Returns:
| Type | Description |
|---|---|
Union[sym, array]
|
value of the output function evaluated at x, u |
Source code in commonroad_control/simulation/sensor_models/sensor_model_interface.py
77 78 79 80 81 82 83 84 85 86 87 | |
measure(x, u, rand_noise=True)
abstractmethod
Evaluates the output function and applies (random) noise to the output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
StateInterface
|
state |
required |
u
|
InputInterface
|
input |
required |
rand_noise
|
bool
|
true, if random noise shall be applied, otherwise the nominal value of the uncertainty model is applied. |
True
|
Returns:
| Type | Description |
|---|---|
Union[StateInterface, Any]
|
(noisy) measurement |
Source code in commonroad_control/simulation/sensor_models/sensor_model_interface.py
113 114 115 116 117 118 119 120 121 122 | |
nominal_output(x, u)
Evaluates the nominal output value given a state and corresponding control input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Union[StateInterface, array]
|
state |
required |
u
|
Union[StateInterface, array]
|
control input |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
nominal output at (x,u) represented as a numpy array |
Source code in commonroad_control/simulation/sensor_models/sensor_model_interface.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
commonroad_control.simulation.sensor_models.full_state_feedback.full_state_feedback
FullStateFeedback
Bases: SensorModelInterface
Full state feedback sensor model, i.e., the output function is y = x + n, where n denotes (random) measurement noise.
Source code in commonroad_control/simulation/sensor_models/full_state_feedback/full_state_feedback.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 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 | |
__init__(noise_model, state_output_factory, state_dimension, input_dimension)
Initialize sensor model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
noise_model
|
UncertaintyModelInterface
|
uncertainty model representing sensor noise - UncertaintyModelInterface |
required |
state_output_factory
|
StateInputDisturbanceTrajectoryFactoryInterface
|
factory for creating States or Outputs as output arguments - StateInputDisturbanceTrajectoryFactoryInterface |
required |
state_dimension
|
int
|
state dimension - int |
required |
input_dimension
|
int
|
input dimension - int |
required |
Source code in commonroad_control/simulation/sensor_models/full_state_feedback/full_state_feedback.py
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 | |
_output_function_cas(x, u)
Implements the nominal output function y=x.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Union[array, sym]
|
state |
required |
u
|
Union[array, sym]
|
control input |
required |
Returns:
| Type | Description |
|---|---|
Union[sym, array]
|
value of the output function evaluated at x, u |
Source code in commonroad_control/simulation/sensor_models/full_state_feedback/full_state_feedback.py
54 55 56 57 58 59 60 61 62 63 | |
_sanity_check()
Check args.
Source code in commonroad_control/simulation/sensor_models/full_state_feedback/full_state_feedback.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
measure(x, u, rand_noise=True)
Evaluates the output function and applies (random) noise to the output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
StateInterface
|
state |
required |
u
|
InputInterface
|
input |
required |
rand_noise
|
bool
|
true, if random noise shall be applied, otherwise the nominal value of the uncertainty model is applied. |
True
|
Returns:
| Type | Description |
|---|---|
StateInterface
|
(noisy) measurement |
Source code in commonroad_control/simulation/sensor_models/full_state_feedback/full_state_feedback.py
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 | |
commonroad_control.vehicle_dynamics.full_state_noise_interface
FullStateNoiseInterface
dataclass
Bases: UncertaintyInterface
Abstract base class for full state noise - required for the full state feedback sensor model.
Source code in commonroad_control/vehicle_dynamics/full_state_noise_interface.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
dim
property
Returns:
| Type | Description |
|---|---|
int
|
noise dimension |
convert_to_array()
abstractmethod
Converts instance of class to numpy array.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray of dimension (self.dim,) |
Source code in commonroad_control/vehicle_dynamics/full_state_noise_interface.py
34 35 36 37 38 39 40 | |
FullStateNoiseInterfaceIndex
dataclass
Bases: UncertaintyInterfaceIndex
Indices of the noise variables.
Source code in commonroad_control/vehicle_dynamics/full_state_noise_interface.py
12 13 14 15 16 17 18 | |
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.kinematic_bicycle.kb_noise
KBNoise
dataclass
Bases: FullStateNoiseInterface
Full state noise of the kinematic bicycle model - required for the full state feedback sensor model.
Source code in commonroad_control/vehicle_dynamics/kinematic_bicycle/kb_noise.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 | |
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/kinematic_bicycle/kb_noise.py
44 45 46 47 48 49 50 51 52 53 54 55 56 | |
KBNoiseIndices
dataclass
Bases: FullStateNoiseInterfaceIndex
Indices of the noise variables.
Source code in commonroad_control/vehicle_dynamics/kinematic_bicycle/kb_noise.py
11 12 13 14 15 16 17 18 19 20 21 22 | |
commonroad_control.vehicle_dynamics.dynamic_bicycle.db_noise
DBNoise
dataclass
Bases: FullStateNoiseInterface
Full state noise of the dynamic bicycle model - required for the full state feedback sensor model.
Source code in commonroad_control/vehicle_dynamics/dynamic_bicycle/db_noise.py
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 | |
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/dynamic_bicycle/db_noise.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
DBNoiseIndices
dataclass
Bases: FullStateNoiseInterfaceIndex
Indices of the noise variables.
Source code in commonroad_control/vehicle_dynamics/dynamic_bicycle/db_noise.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |