Skip to content

Commit 9dc561c

Browse files
committed
Modified the merge, added webapp flag in yaml
1 parent 74bec3a commit 9dc561c

2 files changed

Lines changed: 25 additions & 30 deletions

File tree

GEMstack/onboard/planning/summoning_mission_planning.py

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def check_pose_distance(goal_pose : Union[List, ObjectPose], current_pose : Obje
4242

4343

4444
class SummoningMissionPlanner(Component):
45-
def __init__(self, mode, state_machine):
45+
def __init__(self, mode, webapp, state_machine):
4646
self.mode = mode
4747
self.state_machine = StateMachine([eval(s) for s in state_machine])
4848
self.goal_location = None
@@ -53,8 +53,8 @@ def __init__(self, mode, state_machine):
5353

5454
self.count = 0 # for test only, simulate a delay to get the gaol location
5555

56-
# Set False when omitting the webapp. TODO: add a flag to the config file
57-
self.flag_use_webapp = True
56+
# Set False in yaml file when omitting the webapp.
57+
self.flag_use_webapp = webapp
5858

5959
if self.flag_use_webapp:
6060
# Initialize the state in the server
@@ -97,25 +97,6 @@ def update(self, state: AllState):
9797
if self.count <3:
9898
return mission_plan
9999

100-
if self.mode == 'sim':
101-
# scene = settings.get('simulator.scene', None)
102-
goal_location = [10, 11] # scene.get('goal_location', [0.0, 0.0]) # for simulation test only
103-
goal_frame = 'start'
104-
elif self.mode == 'real':
105-
# TODO: Modify to a GET request to get goal location from the server
106-
# current_goal_location = self.goal_location
107-
# url = ""
108-
# response = requests.get(url)
109-
# if response.status_code == 200:
110-
# data = response.json()
111-
# goal_location = data['goal_location']
112-
# goal_frame = data['goal_frame']
113-
goal_location = [-88.235828, 40.092741] # for highbay test only [-88.2358085, 40.092819]
114-
goal_frame = 'global'
115-
else:
116-
raise ValueError("Invalid mode argument")
117-
118-
119100

120101
if self.flag_use_webapp:
121102
goal_location = None
@@ -134,14 +115,25 @@ def update(self, state: AllState):
134115
goal_frame = 'global'
135116
print("Goal location:", goal_location)
136117
print("Goal frame:", goal_frame)
137-
138-
goal_location = [10, 0] # for simlulation test only
139-
goal_frame = 'start'
140-
else:
141-
goal_location = [10, 11] # for simulation test only
142-
goal_frame = 'start'
143-
144118

119+
if self.flag_use_webapp is False or goal_location is not None:
120+
if self.mode == 'sim':
121+
# scene = settings.get('simulator.scene', None)
122+
goal_location = [10, 11] # scene.get('goal_location', [0.0, 0.0]) # for simulation test only
123+
goal_frame = 'start'
124+
elif self.mode == 'real':
125+
# TODO: Modify to a GET request to get goal location from the server
126+
# current_goal_location = self.goal_location
127+
# url = ""
128+
# response = requests.get(url)
129+
# if response.status_code == 200:
130+
# data = response.json()
131+
# goal_location = data['goal_location']
132+
# goal_frame = data['goal_frame']
133+
goal_location = [-88.235828, 40.092741] # for highbay test only [-88.2358085, 40.092819]
134+
goal_frame = 'global'
135+
else:
136+
raise ValueError("Invalid mode argument")
145137

146138

147139
if self.goal_location == goal_location:
@@ -163,7 +155,9 @@ def update(self, state: AllState):
163155
else:
164156
raise ValueError("Invalid frame argument")
165157

166-
self.goal_pose = self.goal_pose.to_frame(ObjectFrameEnum.START, start_pose_abs=start_vehicle_pose)
158+
# self.goal_pose = self.goal_pose.to_frame(ObjectFrameEnum.START, start_pose_abs=start_vehicle_pose)
159+
# Moved into if statement above to avoid the case where goal_location is None
160+
self.goal_pose = self.goal_pose.to_frame(ObjectFrameEnum.START, start_pose_abs=start_vehicle_pose)
167161

168162
# Initiate state
169163
if mission_plan is None:

launch/summoning.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ drive:
2020
type: SummoningMissionPlanner
2121
args:
2222
mode: 'real'
23+
webapp: True
2324
state_machine: [PlannerEnum.IDLE, PlannerEnum.SUMMON_DRIVING, PlannerEnum.PARALLEL_PARKING]
2425
route_planning_component:
2526
type: RoutePlanningComponent

0 commit comments

Comments
 (0)