Module Planning
Planning Problem
PlanningProblem class
- class commonocean.planning.planning_problem.PlanningProblem(planning_problem_id: int, initial_state: CustomState, goal_region: GoalRegion, waypoints: Optional[List[GoalRegion]] = None, max_lateral_deviation: Optional[float] = None)[source]
- generate_reference_points_from_waypoint()[source]
returns the centers of the waypoint goals as list
- property goal: GoalRegion
Region that has to be reached
- goal_reached(trajectory: Trajectory) Tuple[bool, int][source]
Checks if the goal region defined in the planning problem is reached by any state of a given trajectory
- Parameters:
trajectory – trajectory to test
- 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: CustomState
Initial state of the ego vehicle
- translate_rotate(translation: ndarray, angle: float)[source]
translate and rotates the planning problem with given translation and angle around the origin (0, 0)
- Parameters:
translation – translation vector [x_off, y_off] in x- and y-direction
angle – rotation angle in radian (counter-clockwise)
- property waypoints: List[GoalRegion]
waypoints of a planning problem
PlanningProblemSet class
- class commonocean.planning.planning_problem.PlanningProblemSet(planning_problem_list: Union[None, List[PlanningProblem]] = None)[source]
- add_planning_problem(planning_problem: PlanningProblem)[source]
Adds the given planning problem to self.planning_problem_list
- Parameters:
planning_problem – Planning problem to add
- find_planning_problem_by_id(planning_problem_id: int) PlanningProblem[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 – id to find
- 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: ndarray, angle: float)[source]
translate and rotates the planning problem set with given translation and angle around the origin (0, 0)
- Parameters:
translation – translation vector [x_off, y_off] in x- and y-direction
angle – rotation angle in radian (counter-clockwise)
Goal Region
GoalRegion class
- class commonocean.planning.goal.GoalRegion(state_list: List[GeneralState], waters_of_goal_position: Union[None, Dict[int, List[int]]] = None)[source]
- is_reached(state: GeneralState) bool[source]
Checks if a given state is inside the goal region.
- Parameters:
state – state with exact values
- Returns:
True, if state fulfills all requirements of the goal region. False if at least one requirement of the goal region is not fulfilled.