@@ -25,7 +25,7 @@ def __init__(self, vehicle=None, obstacles=None, actions=None):
2525 # Vehicle model
2626 self ._vehicle = None
2727
28- # SecondOrderDubinsCar() #x = (tx,ty,theta) and u = (fwd_velocity,turnRate).
28+ # SecondOrderDubinsCar() #x = (tx,ty,theta,v,dtheta ) and u = (fwd_accel,wheel_angle_rate)
2929 self .vehicle_sim = IntegratorControlSpace (SecondOrderDubinsCar (), 1 , 0.1 )
3030 #@TODO create a more standardized way to define the actions
3131 self ._actions = [(1 , - 1 ), (1 , - 0.5 ), (1 ,0 ), (1 , 0.5 ), (1 ,1 ),
@@ -60,7 +60,7 @@ def is_goal_reached(self, current: List[float], goal: List[float]):
6060 # @TODO Currently, the threshold is just a random number, get rid of magic constants
6161 print (f"Current Pose: { current } " )
6262 print (f"Goal Pose: { goal } " )
63- if current [2 ] > 0 : return False # car must be stopped, this equality will only work in simulation
63+ if np . abs ( current [3 ]) > 0 : return False # car must be stopped, this equality will only work in simulation
6464 return np .linalg .norm (np .array ([current [0 ], current [1 ]]) - np .array ([goal [0 ], goal [1 ]])) < 1
6565 vehicle
6666 def heuristic_cost_estimate (self , vehicle_state_1 , vehicle_state_2 ):
@@ -185,9 +185,11 @@ def update(self, state : AllState) -> Trajectory:
185185 self .planner .vehicle = vehicle
186186
187187 # Compute the new trajectory and return it
188- route = Path (frame = vehicle .pose .frame , points = list (self .planner .astar (start_state , goal_state )))
188+ res = list (self .planner .astar (start_state , goal_state ))
189+ points = [state [:2 ] for state in res ]
189190 print ("===========================" )
190- print (f"Points: { len (list (self .planner .astar (start_state , goal_state )))} " )
191- traj = longitudinal_plan (route , 1 , - 1 , 5 , vehicle .v , "milestone" )
191+ print (f"Points: { points } " )
192+ route = Path (frame = vehicle .pose .frame , points = points )
193+ traj = longitudinal_plan (route , 2 , - 2 , 10 , vehicle .v , "milestone" )
192194 print (traj )
193195 return traj
0 commit comments