Skip to content

Commit eeeb3e2

Browse files
shalinmehtalgsvlherb-kuta-lge
authored andcommitted
AUTO-5127: Perform mapping on config options before sending to Dreamview
1 parent ef94a37 commit eeeb3e2

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

lgsvl/dreamview/dreamview.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,29 +126,36 @@ def disable_module(self, module):
126126
)
127127
return
128128

129-
def set_hd_map(self, map):
129+
def set_hd_map(self, hd_map):
130130
"""
131131
Folders in /apollo/modules/map/data/ are the available HD maps
132132
Map options in Dreamview are the folder names with the following changes:
133133
- underscores (_) are replaced with spaces
134134
- the first letter of each word is capitalized
135135
136-
map parameter is the modified folder name.
137-
map should match one of the options in the right-most drop down in the top-right corner of Dreamview.
136+
hd_map parameter is the modified folder name.
137+
hd_map should match one of the options in the right-most drop down in the top-right corner of Dreamview.
138138
"""
139+
140+
word_list = []
141+
for s in hd_map.split('_'):
142+
word_list.append(s[0].upper() + s[1:])
143+
144+
mapped_map = ' '.join(word_list)
145+
139146
self.ws.send(
140-
json.dumps({"type": "HMIAction", "action": "CHANGE_MAP", "value": map})
147+
json.dumps({"type": "HMIAction", "action": "CHANGE_MAP", "value": mapped_map})
141148
)
142149

143-
if not self.get_current_map() == map:
144-
folder_name = map.replace(" ", "_")
150+
if not self.get_current_map() == mapped_map:
151+
folder_name = hd_map.replace(" ", "_")
145152
error_message = (
146153
"HD Map {0} was not set. Verify the files exist in "
147154
"/apollo/modules/map/data/{1} and restart Dreamview -- Aborting..."
148155
)
149156
log.error(
150157
error_message.format(
151-
map, folder_name
158+
mapped_map, folder_name
152159
)
153160
)
154161
sys.exit(1)
@@ -165,23 +172,30 @@ def set_vehicle(self, vehicle, gps_offset_x=0.0, gps_offset_y=0.0, gps_offset_z=
165172
vehicle parameter is the modified folder name.
166173
vehicle should match one of the options in the middle drop down in the top-right corner of Dreamview.
167174
"""
175+
176+
word_list = []
177+
for s in vehicle.split('_'):
178+
word_list.append(s[0].upper() + s[1:])
179+
180+
mapped_vehicle = ' '.join(word_list)
181+
168182
self.ws.send(
169183
json.dumps(
170-
{"type": "HMIAction", "action": "CHANGE_VEHICLE", "value": vehicle}
184+
{"type": "HMIAction", "action": "CHANGE_VEHICLE", "value": mapped_vehicle}
171185
)
172186
)
173187

174188
self.gps_offset = lgsvl.Vector(gps_offset_x, gps_offset_y, gps_offset_z)
175189

176-
if not self.get_current_vehicle() == vehicle:
190+
if not self.get_current_vehicle() == mapped_vehicle:
177191
folder_name = vehicle.replace(" ", "_")
178192
error_message = (
179193
"Vehicle calibration {0} was not set. Verify the files exist in "
180194
"/apollo/modules/calibration/data/{1} and restart Dreamview -- Aborting..."
181195
)
182196
log.error(
183197
error_message.format(
184-
vehicle, folder_name
198+
mapped_vehicle, folder_name
185199
)
186200
)
187201
sys.exit(1)

0 commit comments

Comments
 (0)