-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import os | ||
import subprocess | ||
from src.manager.manager.launcher.launcher_interface import ILauncher, LauncherException | ||
from src.manager.manager.docker_thread.docker_thread import DockerThread | ||
from typing import List, Any | ||
|
||
class LauncherAerostack2(ILauncher): | ||
exercise_id: str | ||
type: str | ||
module: str | ||
world_file: str | ||
running = False | ||
thread: Any = None | ||
|
||
def run(self, callback): | ||
world_file = os.path.expandvars(self.world_file) | ||
|
||
as2_launch_cmd = f"ros2 launch jderobot_drones as2_default_classic_gazebo.launch.py world_file:={world_file}" | ||
|
||
self.thread = DockerThread(as2_launch_cmd) | ||
self.thread.start() | ||
|
||
self.running = True | ||
|
||
def is_running(self): | ||
return True | ||
|
||
def terminate(self): | ||
if self.is_running(): | ||
self.thread.terminate() | ||
self.thread.join() |