Skip to content

Commit 83e4ea5

Browse files
committed
onboard frame changes
1 parent f95315b commit 83e4ea5

2 files changed

Lines changed: 24 additions & 12 deletions

File tree

GEMstack/onboard/planning/parking_planning.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

launch/parking_detection.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ drive: # Full pipeline on board
3232
planning:
3333
parking_component:
3434
type: ParkingSim
35-
# route_planning_component:
36-
# type: RoutePlanningComponent
37-
# trajectory_tracking:
38-
# type: pure_pursuit.PurePursuitTrajectoryTracker
39-
# print: False
35+
route_planning_component:
36+
type: RoutePlanningComponent
37+
motion_planning: longitudinal_planning.YieldTrajectoryPlanner
38+
trajectory_tracking:
39+
type: pure_pursuit.PurePursuitTrajectoryTracker
40+
print: False
4041
#usually can keep this constant
4142
computation_graph: !include "../GEMstack/knowledge/defaults/computation_graph.yaml"
4243

0 commit comments

Comments
 (0)