Reference Trajectory
commonroad_control.control.reference_trajectory_factory
ReferenceTrajectoryFactory
Stores the reference trajectory (provided by a given planner) and provides the required snippet to the controller. For most controllers, this snippet consists of a single pair of state and control input at a given point in time. For model predictive control (MPC), the snippet spans the full MPC prediction horizon. If desired, a look-ahead horizon can be included; it will be handled automatically when querying the reference trajectory.
Source code in commonroad_control/control/reference_trajectory_factory.py
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 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 | |
state_trajectory
property
Returns:
| Type | Description |
|---|---|
Union[TrajectoryInterface, None]
|
state trajectory |
__init__(delta_t_controller, sidt_factory, mpc_horizon=0, t_look_ahead=0.0)
Initialize class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
delta_t_controller
|
float
|
sampling time of the controller - float |
required |
sidt_factory
|
StateInputDisturbanceTrajectoryFactoryInterface
|
factory for creating Trajectory objects |
required |
mpc_horizon
|
int
|
prediction horizon of a model predictive controller (number of time steps) - int |
0
|
t_look_ahead
|
float
|
look-ahead for non-MPCs (in seconds) - float |
0.0
|
Source code in commonroad_control/control/reference_trajectory_factory.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 | |
get_reference_trajectory_at_time(t)
Returns a snippet from the reference trajectory (single or multiple points, depending on the controller, which is passed to the controller for computing the control inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float
|
current time - float |
required |
Returns:
| Type | Description |
|---|---|
Tuple[TrajectoryInterface, TrajectoryInterface]
|
state and input reference trajectory - TrajectoryInterface |
Source code in commonroad_control/control/reference_trajectory_factory.py
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 | |
set_reference_trajectory(state_ref, input_ref, t_0)
Function for updating the reference trajectory (e.g. given a new planned trajectory).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state_ref
|
TrajectoryInterface
|
state reference trajectory - TrajectoryInterface |
required |
input_ref
|
TrajectoryInterface
|
input reference trajectory - TrajectoryInterface |
required |
t_0
|
float
|
initial time step of the reference trajectories |
required |
Source code in commonroad_control/control/reference_trajectory_factory.py
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 | |