Module Planning
Planning Problem
PlanningProblem
class
- class commonroad.planning.planning_problem.PlanningProblem(planning_problem_id, initial_state, goal_region)[source]
- draw(renderer, draw_params=None)[source]
Draw the object
- Parameters:
renderer (
IRenderer
) – Renderer to use for drawingdraw_params (
Union
[PlanningProblemParams
,MPDrawParams
,None
]) – optional parameters for plotting, overriding the parameters of the renderer
- Returns:
None
- property goal: GoalRegion
Region that has to be reached
- goal_reached(trajectory)[source]
Checks if the goal region defined in the planning problem is reached by any state of a given trajectory
- Parameters:
trajectory (
Trajectory
) – trajectory to test- Return type:
Tuple
[bool
,int
]- Returns:
Tuple: (True, index of first state in trajectory.state_list that reaches goal) if one state reaches the goal. (False, -1) if no state reaches the goal.
- property initial_state: InitialState
Initial state of the ego vehicle
- property planning_problem_id: int
Id of the planning problem
PlanningProblemSet
class
- class commonroad.planning.planning_problem.PlanningProblemSet(planning_problem_list=None)[source]
- add_planning_problem(planning_problem)[source]
Adds the given planning problem to self.planning_problem_list
- Parameters:
planning_problem (
PlanningProblem
) – Planning problem to add
- draw(renderer, draw_params=None)[source]
Draw the object
- Parameters:
renderer (
IRenderer
) – Renderer to use for drawingdraw_params (
Union
[PlanningProblemSetParams
,MPDrawParams
,None
]) – optional parameters for plotting, overriding the parameters of the renderer
- Returns:
None
- find_planning_problem_by_id(planning_problem_id)[source]
Searches in planning_problem_dict for a planning problem with the given id. Returns the planning problem or raises error, if id cannot be found.
- Parameters:
planning_problem_id (
int
) – id to find- Return type:
- Returns:
Planning problem with id planning_problem_id, Raises key error, if id not in the dict.
- property planning_problem_dict: Dict[int, PlanningProblem]
Dict that contains all PlanningProblems that are added. Keys: Ids of planning problems
- translate_rotate(translation, angle)[source]
translate and rotates the planning problem set with given translation and angle around the origin (0, 0)
- Parameters:
translation (
ndarray
) – translation vector [x_off, y_off] in x- and y-directionangle (
float
) – rotation angle in radian (counter-clockwise)
Goal Region
GoalRegion
class
- class commonroad.planning.goal.GoalRegion(state_list, lanelets_of_goal_position=None)[source]
- draw(renderer, draw_params=None)[source]
Draw the object
- Parameters:
renderer (
IRenderer
) – Renderer to use for drawingdraw_params (
Union
[OccupancyParams
,MPDrawParams
,None
]) – optional parameters for plotting, overriding the parameters of the renderer
- Returns:
None
- is_reached(state)[source]
Checks if a given state is inside the goal region.
- Parameters:
state (
Union
[State
,InitialState
,PMState
,KSState
,KSTState
,STState
,STDState
,MBState
,InputState
,PMInputState
,LateralState
,LongitudinalState
,CustomState
,ExtendedPMState
]) – state with exact values- Return type:
bool
- Returns:
True, if state fulfills all requirements of the goal region. False if at least one requirement of the goal region is not fulfilled.
- property lanelets_of_goal_position: None | Dict[int, List[int]]
Dict that contains the index of the state in the state_list to which the lanelets belong. None, if goal position is not a lanelet
- property state_list: List[State | InitialState | PMState | KSState | KSTState | STState | STDState | MBState | InputState | PMInputState | LateralState | LongitudinalState | CustomState | ExtendedPMState]
List that contains all goal states
Trajectory Planner Interface
TrajectoryPlannerInterface
class
- class commonroad.planning.planner_interface.TrajectoryPlannerInterface[source]
Base class for trajectory planner.
- plan(sc, pp, ref_path=None)[source]
Interface method for planning.
- Parameters:
sc (
Scenario
) – CommonRoad scenario.pp (
PlanningProblem
) – CommonRoad planning problem.ref_path (
Optional
[ndarray
]) – Reference path which the trajectory planner should follow.
- Return type:
- Returns:
CommonRoad trajectory.