Skip to content

Commit 0ec665a

Browse files
committed
Got rid of all constants, need to add them to yaml file now. Currently switched things to use default values to keep the settings we were using
1 parent 47955b8 commit 0ec665a

2 files changed

Lines changed: 27 additions & 9 deletions

File tree

GEMstack/onboard/planning/parking_route_planner.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,16 @@ def state_to_polygon(self, state):
198198

199199
return temp_obj.polygon()
200200

201-
def generate_action_set():
201+
# def generate_action_set(max_vel, max_turn_rate):
202+
# return [
203+
# (.75, -0.3), (.75, 0.0), (.75, 0.3),
204+
# (-.75, -0.3), (-.75, 0.0), (-.75, 0.3)
205+
# ]
206+
207+
def generate_action_set(max_vel, max_turn_rate):
202208
return [
203-
(.75, -0.3), (.75, 0.0), (.75, 0.3),
204-
(-.75, -0.3), (-.75, 0.0), (-.75, 0.3)
209+
(max_vel, -max_turn_rate), (max_vel, 0.0), (max_vel, max_turn_rate),
210+
(-max_vel, -max_turn_rate), (-max_vel, 0.0), (-max_vel, max_turn_rate)
205211
]
206212
class ParkingSolverFirstOrderDubins(AStar):
207213
"""sample use of the astar algorithm. In this exemple we work on a maze made of ascii characters,
@@ -212,11 +218,17 @@ def __init__(self, vehicle=None, obstacles=None, actions=None):
212218

213219
# Vehicle model
214220
self._vehicle = None
221+
222+
# settings
223+
self.T = settings.get("planning.dubins.integrator.time_step", 1.5)
224+
self.dt = settings.get("planning.dubins.integrator.time_step", .25)
225+
self.max_v = settings.get("planning.dubins.actions.max_velocity", 0.75)
226+
self.max_turn_rate = settings.get("planning.dubins.actions.max_turn_rate", 0.3)
215227

216228
self.vehicle = DubinsCar() #x = (tx,ty,theta) and u = (fwd_velocity,turnRate).
217-
self.vehicle_sim = DubinsCarIntegrator(self.vehicle, 1.5, 0.25)
229+
self.vehicle_sim = DubinsCarIntegrator(self.vehicle, self.T, self.dt)
218230
#@TODO create a more standardized way to define the actions
219-
self._actions = generate_action_set()
231+
self._actions = generate_action_set(self.max_v, self.max_turn_rate)
220232

221233

222234
@property
@@ -420,6 +432,8 @@ def __init__(self):
420432
# self.planner = ParkingSolverSecondOrderDubins()
421433
self.planner = ParkingSolverFirstOrderDubins()
422434

435+
self.iterations = settings.get("planning.astar.iterations", 20000)
436+
423437
def state_inputs(self):
424438
return ['all']
425439

@@ -481,8 +495,12 @@ def update(self, state : AllState) -> Route:
481495
all_obstacles = {**agents, **obstacles}
482496
# print(f"Obstacles {obstacles}")
483497
print(f"Agents {agents}")
484-
route = state.route
485-
goal_pose = ObjectPose(frame=ObjectFrameEnum.ABSOLUTE_CARTESIAN, t=15, x=state.mission_plan.goal_x,y=state.mission_plan.goal_y,z=0,yaw=state.mission_plan.goal_orientation)
498+
# goal= state.goal
499+
# print(goal.frame)
500+
# assert goal.frame == ObjectFrameEnum.ABSOLUTE_CARTESIAN
501+
# assert goal.v == 0
502+
# print(f"Goal {goal}")
503+
goal_pose = ObjectPose(frame=ObjectFrameEnum.ABSOLUTE_CARTESIAN, t=0.0, x=state.mission_plan.goal_x,y=state.mission_plan.goal_y,z=0.0,yaw=state.mission_plan.goal_orientation)
486504
goal = VehicleState.zero()
487505
goal.pose = goal_pose
488506
goal.v = 0
@@ -500,7 +518,7 @@ def update(self, state : AllState) -> Route:
500518
self.planner.vehicle = vehicle
501519

502520
# Compute the new trajectory and return it
503-
res = list(self.planner.astar(start_state, goal_state, reversePath=False, iterations=10000))
521+
res = list(self.planner.astar(start_state, goal_state, reversePath=False, iterations=self.iterations))
504522
# points = [state[:2] for state in res] # change here to return the theta as well
505523
points = []
506524
for state in res:

GEMstack/onboard/planning/route_planning_component.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from GEMstack.state.route import PlannerEnum, Route, Path
1010
from GEMstack.state.trajectory import Trajectory
1111
from .rrt_star import RRTStar
12-
from .parking_planning import ParkingPlanner
12+
from .parking_route_planner import ParkingPlanner
1313
from .parking_scanning import StraightLineMotion
1414
from .longitudinal_planning import longitudinal_plan
1515

0 commit comments

Comments
 (0)