@@ -294,20 +294,26 @@ def prepare_custom_universe(self, cfg_dict):
294
294
if cfg_dict ["zip" ].startswith ("data:" ):
295
295
_ , _ , zip_file = cfg_dict ["zip" ].partition ("base64," )
296
296
297
- universe_ref = "/workspace/worlds/" + cfg_dict ["name" ]
298
- zip_destination = universe_ref + ".zip"
299
- with open ( zip_destination , "wb" ) as result :
300
- result . write ( base64 . b64decode ( zip_file ) )
297
+ universe_ref = "/workspace/worlds/src/ " + cfg_dict ["name" ]
298
+ # Remove old content
299
+ if os . path . exists ( "/workspace/worlds" ) :
300
+ shutil . rmtree ( "/workspace/worlds" , ignore_errors = False )
301
301
302
302
# Create the folder if it doesn't exist
303
303
universe_folder = universe_ref + "/"
304
304
if not os .path .exists (universe_folder ):
305
305
os .makedirs (universe_folder )
306
306
307
+ zip_destination = universe_ref + ".zip"
308
+ with open (zip_destination , "wb" ) as result :
309
+ result .write (base64 .b64decode (zip_file ))
310
+
307
311
zip_ref = zipfile .ZipFile (zip_destination , "r" )
308
312
zip_ref .extractall (universe_folder + "/" )
309
313
zip_ref .close ()
310
314
315
+ os .system ('/bin/bash -c "cd /workspace/worlds; source /opt/ros/humble/setup.bash; colcon build --symlink-install; source install/setup.bash; cd ../.."' )
316
+
311
317
def on_prepare_visualization (self , event ):
312
318
313
319
LogManager .logger .info ("Visualization transition started" )
@@ -327,7 +333,7 @@ def on_prepare_visualization(self, event):
327
333
self .gui_server = Server (2303 , self .update )
328
334
self .gui_server .start ()
329
335
elif self .visualization_type in ["bt_studio" , "bt_studio_gz" ]:
330
- self .gui_server = FileWatchdog ('/tmp/tree_state' , self .update_bt_studio ) # TODO: change if type bt
336
+ self .gui_server = FileWatchdog ('/tmp/tree_state' , self .update_bt_studio )
331
337
self .gui_server .start ()
332
338
333
339
LogManager .logger .info ("Visualization transition finished" )
@@ -568,7 +574,6 @@ def on_code_autocomplete(self, event):
568
574
except Exception as e :
569
575
LogManager .logger .info ('Error formating code' + str (e ))
570
576
571
-
572
577
def on_run_application (self , event ):
573
578
def find_docker_console ():
574
579
"""Search console in docker different of /dev/pts/0"""
0 commit comments