@@ -387,7 +387,7 @@ def state_to_object(self, state):
387387 theta = state [2 ]
388388 t = state [3 ]
389389
390- pose = ObjectPose (frame = ObjectFrameEnum .ABSOLUTE_CARTESIAN ,t = t , x = x ,y = y ,z = 0 ,yaw = theta )
390+ pose = ObjectPose (frame = ObjectFrameEnum .CURRENT ,t = t , x = x ,y = y ,z = 0 ,yaw = theta )
391391
392392 temp_obj = PhysicalObject (pose = pose ,
393393 dimensions = self .vehicle .to_object ().dimensions ,
@@ -456,6 +456,7 @@ def vehicle_state_to_first_order(self, vehicle_state: VehicleState) -> Tuple[flo
456456 Returns:
457457 Tuple[float, float]: _description_
458458 """
459+ vehicle_state .pose = vehicle_state .pose .to_frame ()
459460 x = vehicle_state .pose .x
460461 y = vehicle_state .pose .y
461462 theta = vehicle_state .pose .yaw # check that this is correct
@@ -482,7 +483,11 @@ def update(self, state : AllState) -> Route:
482483 # print(f"Obstacles {obstacles}")
483484 print (f"Agents { agents } " )
484485 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 )
486+ goal_pose = ObjectPose (frame = ObjectFrameEnum .CURRENT , t = 15 , x = state .mission_plan .goal_x ,y = state .mission_plan .goal_y ,z = 0 ,yaw = state .mission_plan .goal_orientation )
487+ print ("Checking VALUE: " , state .start_vehicle_pose )
488+ start_pose = state .vehicle .pose .to_frame (ObjectFrameEnum .CURRENT , current_pose = state .vehicle .pose ,start_pose_abs = state .start_vehicle_pose )
489+ start_cur = VehicleState .zero ()
490+ start_cur .pose = start_pose
486491 goal = VehicleState .zero ()
487492 goal .pose = goal_pose
488493 goal .v = 0
@@ -492,7 +497,7 @@ def update(self, state : AllState) -> Route:
492497 # goal_state = self.vehicle_state_to_dynamics(goal)
493498
494499 # Need to parse and create second order dubin car states
495- start_state = self .vehicle_state_to_first_order (vehicle )
500+ start_state = self .vehicle_state_to_first_order (start_cur ) # MAY BE AN ISSUE
496501 goal_state = self .vehicle_state_to_first_order (goal )
497502
498503 # Update the planner
@@ -506,14 +511,20 @@ def update(self, state : AllState) -> Route:
506511 for state in res :
507512 points .append ((state [0 ], state [1 ]))
508513 times = [state [3 ] for state in res ]
509- path = Path (frame = vehicle .pose .frame , points = points )
510- traj = Trajectory (path .frame ,points ,times )
514+ route = Path (frame = ObjectFrameEnum .CURRENT , points = points )
515+ print (f"ROUTE BEFORE FRAME CHANGE: { route } " )
516+ route = route .to_frame (frame = ObjectFrameEnum .START ,\
517+ current_pose = start_cur , # does this want the current pose in the current frame?
518+ start_pose_abs = state .start_vehicle_pose
519+ )
520+ print (f"ROUTE AFTER FRAME CHANGE: { route } " )
521+ # traj = Trajectory(path.frame,points,times)
511522 # print("===========================")
512523 # print(f"Points: {points}")
513524 # print(f"Times: {times}")
514- route = Path (frame = vehicle .pose .frame , points = points )
525+ # route = Path(frame=vehicle.pose.frame, points=points)
515526 # traj = longitudinal_plan(route, 2, -2, 10, vehicle.v, "milestone")
516- print (traj )
527+ # print(traj)
517528 return route
518529
519530
0 commit comments