Module Planning

Planning Problem

PlanningProblem class

class commonroad.planning.planning_problem.PlanningProblem(planning_problem_id, initial_state, goal_region)[source]
goal

Region that has to be reached

Return type:GoalRegion
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.
initial_state

Initial state of the ego vehicle

Return type:State
planning_problem_id

Id of the planning problem

Return type:int
translate_rotate(translation, angle)[source]

translate and rotates the planning problem with given translation and angle around the origin (0, 0)

Parameters:
  • translation (ndarray) – translation vector [x_off, y_off] in x- and y-direction
  • angle (float) – rotation angle in radian (counter-clockwise)

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
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:PlanningProblem
Returns:Planning problem with id planning_problem_id, Raises key error, if id not in the dict.
planning_problem_dict

Dict that contains all PlanningProblems that are added. Keys: Ids of planning problems

Return type:Dict[int, PlanningProblem]
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-direction
  • angle (float) – rotation angle in radian (counter-clockwise)

Goal Region

GoalRegion class

class commonroad.planning.goal.GoalRegion(state_list, lanelets_of_goal_position=None)[source]
is_reached(state)[source]

Checks if a given state is inside the goal region.

Parameters:state (State) – 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.
lanelets_of_goal_position

Dict that contains all lanelet ids and lanelets of the goal position. None, if goal position is not a lanelet

Return type:Union[None, Dict[int, List[int]]]
state_list

List that contains all goal states

Return type:List[State]
translate_rotate(translation, angle)[source]

translate and rotates the goal region with given translation and angle around the origin (0, 0)

Parameters:
  • translation (ndarray) – translation vector [x_off, y_off] in x- and y-direction
  • angle (float) – rotation angle in radian (counter-clockwise)