From ad40afac9b4d9230b0e941332dcc3a3d7f84b405 Mon Sep 17 00:00:00 2001 From: Alex Davies Date: Sat, 23 Nov 2024 16:05:14 -0400 Subject: [PATCH 01/20] Removed nvidia GPU requirement for gui_tools --- docker-compose.yml | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4490905..217671f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: "3.8" - services: gui-tools: env_file: @@ -9,44 +7,40 @@ services: environment: # Display settings - - DISPLAY=${DISPLAY} - - WAYLAND_DISPLAY=${WAYLAND_DISPLAY} - # - QT_QPA_PLATFORM=${QT_QPA_PLATFORM:-xcb} # Default to X11 - # If running with Wayland - - XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR} - - ROS_MASTER_URI=http://ros-master:11311 - # - NVIDIA_DRIVER_CAPABILITIES=compute,video,utility - # - NVIDIA_VISIBLE_DEVICES=all + DISPLAY: "${DISPLAY}" + WAYLAND_DISPLAY: "${WAYLAND_DISPLAY}" + # Uncomment below if using X11 + # QT_QPA_PLATFORM: "${QT_QPA_PLATFORM:-xcb}" + XDG_RUNTIME_DIR: "${XDG_RUNTIME_DIR}" + ROS_MASTER_URI: "http://ros-master:11311" + volumes: # X11 socket - /tmp/.X11-unix:/tmp/.X11-unix - ${XAUTHORITY:-~/.Xauthority}:/root/.Xauthority # Wayland socket #- ${XDG_RUNTIME_DIR}/wayland-0:${XDG_RUNTIME_DIR}/wayland-0 - # Allow access to the host's GPU + # Access to GPU devices - /dev/dri:/dev/dri - #Auto reload on code changes + # Code and configuration - ./guiTools/spiri_sdk_guitools/:/app/spiri_sdk_guitools/ - # Enable launching the SDK from the SDK - # - ./:/app/sdk - ./robots:/robots - /var/run/docker.sock:/var/run/docker.sock + devices: - # Provide access to GPU devices + # Provide access to GPU devices (supports non-NVIDIA GPUs) - /dev/dri:/dev/dri + network_mode: host ports: - 8923:8923 ipc: host - #user: "${UID}:${GID}" - privileged: true # Allow privileged access if necessary (e.g., for GPU access) - # restart: unless-stopped - # command: /bin/bash -c "source /opt/ros/foxy/setup.bash && rvis2" # Replace with the actual command to run Gazebo Ignition - deploy: - resources: - reservations: - devices: - - driver: cdi - device_ids: - - nvidia.com/gpu=all + privileged: true # Required for GPU access + # deploy: + # resources: + # reservations: + # devices: + # - driver: cdi # Optional for advanced resource scheduling + # device_ids: + # - "all" # Use "all" for all available GPUs -- 2.40.1 From af94edae60cd0cac86071d0b24ff3a6780c0574f Mon Sep 17 00:00:00 2001 From: Alex Davies Date: Sat, 23 Nov 2024 16:33:39 -0400 Subject: [PATCH 02/20] Refactor to make launch part of Robot. Auto detect compose files --- guiTools/spiri_sdk_guitools/launcher.py | 27 ++---------------- guiTools/spiri_sdk_guitools/sim_drone.py | 36 +++++++++++++++++++++++- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/guiTools/spiri_sdk_guitools/launcher.py b/guiTools/spiri_sdk_guitools/launcher.py index 53e6082..3deeb3c 100644 --- a/guiTools/spiri_sdk_guitools/launcher.py +++ b/guiTools/spiri_sdk_guitools/launcher.py @@ -27,7 +27,7 @@ def launch_app(command): ui.label("Spiri Robotics SDK").style('font-size: 40px; margin-bottom: 10px;').classes('w-full text-center') robots = [] -from spiri_sdk_guitools.sim_drone import Robot +from spiri_sdk_guitools.sim_drone import robot_types import aiodocker import asyncio @@ -65,29 +65,8 @@ async def main(): #Add a new robot with new_robot_widget: ui.label("Add new robot").classes("text-3xl") - newRobotParams = defaultdict(binding.BindableProperty) - ui.number(value=1, label="SysID", min=1, max=254, - ).bind_value(newRobotParams, 'sysid') - default_robot_compose = ( - "/robots/spiri-mu/core/docker-compose.yaml\n" - "#/robots/spiri-mu/virtual_camera/docker-compose.yaml --build" - ) - ui.label("Compose files").classes("text-xl") - ui.codemirror(value=default_robot_compose, language="bash", theme="basicDark").bind_value(newRobotParams, 'compose_files') - async def new_robot(): - compose_files = [] - #Split on comma or newline, and remove comments - for line in newRobotParams['compose_files'].split('\n'): - line = line.split('#')[0].strip() - if line: - compose_files.append(line) - current_robot = newRobotParams.copy() - current_robot['compose_files'] = compose_files - robot = Robot(**current_robot) - asyncio.tasks.create_task(robot.ui(robots_widget)) - - newRobotParams['sysid'] += 1 - ui.button("Add", on_click=new_robot) + for name, robot in robot_types.items(): + await robot.launch_widget(robots_widget) # Start the NiceGUI application ui.run(title="Spiri SDK Launcher", port=8923, dark=None) diff --git a/guiTools/spiri_sdk_guitools/sim_drone.py b/guiTools/spiri_sdk_guitools/sim_drone.py index b46b15d..44e08da 100644 --- a/guiTools/spiri_sdk_guitools/sim_drone.py +++ b/guiTools/spiri_sdk_guitools/sim_drone.py @@ -5,13 +5,14 @@ from typing import List import os import sh import subprocess -from nicegui import ui, run, app +from nicegui import ui, run, app, binding import yaml import docker import aiodocker import asyncio from spiri_sdk_guitools.video_button import EnableStreamingButton +from collections import defaultdict docker_client = docker.from_env() @@ -73,7 +74,13 @@ async def container_logs(container, element): # ui.html(conv.convert(bytes(log,'utf-8').decode('utf-8', 'xmlcharrefreplace'), full=False)) +robot_types = {} + class Robot: + def __init_subclass__(self): + robot_types[self.robot_type] = self + +class Spirimu(Robot): robot_type = "spiri_mu" def __init__(self, sysid: int, compose_files: List[Path] | str): @@ -92,6 +99,33 @@ class Robot: self.robot_name = f"{self.robot_type}_{self.sysid}".replace("-","_") self.world_name = "citadel_hill" + @classmethod + async def launch_widget(cls, robots_widget): + newRobotParams = defaultdict(binding.BindableProperty) + ui.number(value=1, label="SysID", min=1, max=254, + ).bind_value(newRobotParams, 'sysid') + default_robot_compose = "" + for compose_file in Path("/robots").glob("**/docker-compose.yaml"): + default_robot_compose += f"{compose_file} --build \n" + + ui.label("Compose files").classes("text-xl") + ui.codemirror(value=default_robot_compose, language="bash", theme="basicDark").bind_value(newRobotParams, 'compose_files') + async def new_robot(): + compose_files = [] + #Split on comma or newline, and remove comments + for line in newRobotParams['compose_files'].split('\n'): + line = line.split('#')[0].strip() + if line: + compose_files.append(line) + current_robot = newRobotParams.copy() + current_robot['compose_files'] = compose_files + robot = cls(**current_robot) + asyncio.tasks.create_task(robot.ui(robots_widget)) + + newRobotParams['sysid'] += 1 + ui.button("Add", on_click=new_robot) + + async def ui_containers(self, element): docker_elements = {} container_status = {} -- 2.40.1 From 3e4aad90943d7790bf0957e6bd63bab84c46a54b Mon Sep 17 00:00:00 2001 From: Alex Davies Date: Sat, 23 Nov 2024 16:50:09 -0400 Subject: [PATCH 03/20] Fixed ros spin for asyncio, added actions tab --- guiTools/spiri_sdk_guitools/launcher.py | 2 +- guiTools/spiri_sdk_guitools/sim_drone.py | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/guiTools/spiri_sdk_guitools/launcher.py b/guiTools/spiri_sdk_guitools/launcher.py index 3deeb3c..3151619 100644 --- a/guiTools/spiri_sdk_guitools/launcher.py +++ b/guiTools/spiri_sdk_guitools/launcher.py @@ -64,8 +64,8 @@ async def main(): #Add a new robot with new_robot_widget: - ui.label("Add new robot").classes("text-3xl") for name, robot in robot_types.items(): + ui.label(f"Add new {name}").classes("text-3xl") await robot.launch_widget(robots_widget) # Start the NiceGUI application diff --git a/guiTools/spiri_sdk_guitools/sim_drone.py b/guiTools/spiri_sdk_guitools/sim_drone.py index 44e08da..bb643d8 100644 --- a/guiTools/spiri_sdk_guitools/sim_drone.py +++ b/guiTools/spiri_sdk_guitools/sim_drone.py @@ -21,12 +21,15 @@ from rclpy.node import Node import rclpy import threading - -def ros_main() -> None: +async def ros_loop(): rclpy.init() + node = rclpy.create_node('async_subscriber') + while rclpy.ok(): + rclpy.spin_once(node, timeout_sec=0) + await asyncio.sleep(0.1) -app.on_startup(lambda: threading.Thread(target=ros_main).start()) +app.on_startup(ros_loop()) @contextlib.contextmanager @@ -186,6 +189,9 @@ class Spirimu(Robot): ui.label(topic[0]) await asyncio.sleep(10) + async def ui_actions(self, element): + pass + async def ui(self, element): adocker = aiodocker.Docker() @@ -209,11 +215,14 @@ class Spirimu(Robot): with ui.tabs() as tabs: tab_containers = ui.tab("Containers") tab_ros = ui.tab("ROS Topics") + tab_actions = ui.tab("Actions") with ui.tab_panels(tabs, value=tab_containers): tab = ui.tab_panel(tab_containers).classes("w-full") asyncio.create_task(self.ui_containers(tab)) tab = ui.tab_panel(tab_ros).classes("w-full") asyncio.create_task(self.ui_ros(tab)) + tab = ui.tab_panel(tab_actions).classes("w-full") + asyncio.create_task(self.ui_actions(tab)) async def async_stop(self): return await run.io_bound(self.stop) -- 2.40.1 From a5207c6b28d0bac0ef620b79365bb3d0c8ecbe4c Mon Sep 17 00:00:00 2001 From: Alex Davies Date: Sat, 23 Nov 2024 16:57:04 -0400 Subject: [PATCH 04/20] Added plugin loader --- guiTools/spiri_sdk_guitools/sim_drone.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/guiTools/spiri_sdk_guitools/sim_drone.py b/guiTools/spiri_sdk_guitools/sim_drone.py index bb643d8..b586eb9 100644 --- a/guiTools/spiri_sdk_guitools/sim_drone.py +++ b/guiTools/spiri_sdk_guitools/sim_drone.py @@ -13,6 +13,7 @@ import aiodocker import asyncio from spiri_sdk_guitools.video_button import EnableStreamingButton from collections import defaultdict +import importlib.util docker_client = docker.from_env() @@ -81,8 +82,17 @@ robot_types = {} class Robot: def __init_subclass__(self): + #Register sub-classes as plugins robot_types[self.robot_type] = self +for file in Path("/robots").glob("**/robot_plugins.py"): + logger.info(f"Loading plugin {file}") + spec = importlib.util.spec_from_file_location("robot_plugins", file) + plugin = importlib.util.module_from_spec(spec) + spec.loader.exec_module(plugin) + logger.info(f"Loaded plugin {file}") + + class Spirimu(Robot): robot_type = "spiri_mu" -- 2.40.1 From 5bad26fe3546207d7564487ce30e1275bd9f1f24 Mon Sep 17 00:00:00 2001 From: Alex Davies Date: Sun, 24 Nov 2024 11:56:06 -0400 Subject: [PATCH 05/20] Set timeout on spawning GZ model. This fixes UI block when you don't start gazebo --- docker-compose.yml | 1 + guiTools/spiri_sdk_guitools/sim_drone.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 217671f..31e1614 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,6 +13,7 @@ services: # QT_QPA_PLATFORM: "${QT_QPA_PLATFORM:-xcb}" XDG_RUNTIME_DIR: "${XDG_RUNTIME_DIR}" ROS_MASTER_URI: "http://ros-master:11311" + PYTHONASYNCIODEBUG: "1" volumes: # X11 socket diff --git a/guiTools/spiri_sdk_guitools/sim_drone.py b/guiTools/spiri_sdk_guitools/sim_drone.py index b586eb9..f6a37ac 100644 --- a/guiTools/spiri_sdk_guitools/sim_drone.py +++ b/guiTools/spiri_sdk_guitools/sim_drone.py @@ -342,11 +342,13 @@ class Spirimu(Robot): cwd=f"/ardupilot_gazebo/models/{DRONE_MODEL}", stdout=subprocess.PIPE, stderr=subprocess.PIPE, + timeout=1, ) ros2_gz_create_proc = subprocess.Popen( ROS2_CMD.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, + timeout=1, ) out, err = ros2_gz_create_proc.communicate(timeout=15) ros2_gz_create_proc.kill() -- 2.40.1 From 4b253db946c7004b1284b6a75ed4a8935609103b Mon Sep 17 00:00:00 2001 From: Alex Davies Date: Sun, 24 Nov 2024 13:14:57 -0400 Subject: [PATCH 06/20] Added in aiomonitor, x-spiri-docs in yaml --- guiTools/poetry.lock | 113 +++++++++++++++++- guiTools/pyproject.toml | 1 + guiTools/spiri_sdk_guitools/launcher.py | 13 +- guiTools/spiri_sdk_guitools/sim_drone.py | 37 ++++-- robots/spiri-mu/core/docker-compose.yaml | 3 + .../virtual_camera/docker-compose.yaml | 4 + 6 files changed, 161 insertions(+), 10 deletions(-) diff --git a/guiTools/poetry.lock b/guiTools/poetry.lock index a1990a2..83b3c98 100644 --- a/guiTools/poetry.lock +++ b/guiTools/poetry.lock @@ -1,5 +1,19 @@ # This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +[[package]] +name = "aioconsole" +version = "0.8.1" +description = "Asynchronous console and interfaces for asyncio" +optional = false +python-versions = ">=3.8" +files = [ + {file = "aioconsole-0.8.1-py3-none-any.whl", hash = "sha256:e1023685cde35dde909fbf00631ffb2ed1c67fe0b7058ebb0892afbde5f213e5"}, + {file = "aioconsole-0.8.1.tar.gz", hash = "sha256:0535ce743ba468fb21a1ba43c9563032c779534d4ecd923a46dbd350ad91d234"}, +] + +[package.extras] +dev = ["pytest", "pytest-asyncio", "pytest-cov", "pytest-repeat", "uvloop"] + [[package]] name = "aiodocker" version = "0.23.0" @@ -152,6 +166,30 @@ yarl = ">=1.12.0,<2.0" [package.extras] speedups = ["Brotli", "aiodns (>=3.2.0)", "brotlicffi"] +[[package]] +name = "aiomonitor" +version = "0.7.1" +description = "Adds monitor and Python REPL capabilities for asyncio applications" +optional = false +python-versions = ">=3.8" +files = [ + {file = "aiomonitor-0.7.1-py3-none-any.whl", hash = "sha256:10f50418ef8e60cd4b57efb3d2b984f62e01b3a7272772c6916e54f26877fd09"}, + {file = "aiomonitor-0.7.1.tar.gz", hash = "sha256:beb1f14429bc4a3135bbac32381d242fe2019d74fcf9c86d3f4bd7405dc562e4"}, +] + +[package.dependencies] +aioconsole = ">=0.7.0" +aiohttp = ">=3.8.5" +attrs = ">=20" +click = ">=8.0" +janus = ">=1.0" +jinja2 = ">=3.1.2" +prompt-toolkit = ">=3.0" +telnetlib3 = ">=2.0.4" +terminaltables = "*" +trafaret = ">=2.1.1" +typing-extensions = ">=4.1" + [[package]] name = "aiosignal" version = "1.3.1" @@ -690,6 +728,17 @@ files = [ {file = "itsdangerous-2.2.0.tar.gz", hash = "sha256:e0050c0b7da1eea53ffaf149c0cfbb5c6e2e2b69c4bef22c81fa6eb73e5f6173"}, ] +[[package]] +name = "janus" +version = "1.1.0" +description = "Mixed sync-async queue to interoperate between asyncio tasks and classic threads" +optional = false +python-versions = ">=3.9" +files = [ + {file = "janus-1.1.0-py3-none-any.whl", hash = "sha256:9a3daf0f1a16abda1a7c976e28dc1f6caf3b8d1de9b8c93b2ea84de424de7705"}, + {file = "janus-1.1.0.tar.gz", hash = "sha256:0634df8b2b31f8afda4311abcf7fea912686fef717d13769eeaa01ae08d2b84c"}, +] + [[package]] name = "jinja2" version = "3.1.4" @@ -1095,6 +1144,20 @@ files = [ {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, ] +[[package]] +name = "prompt-toolkit" +version = "3.0.48" +description = "Library for building powerful interactive command lines in Python" +optional = false +python-versions = ">=3.7.0" +files = [ + {file = "prompt_toolkit-3.0.48-py3-none-any.whl", hash = "sha256:f49a827f90062e411f1ce1f854f2aedb3c23353244f8108b89283587397ac10e"}, + {file = "prompt_toolkit-3.0.48.tar.gz", hash = "sha256:d6623ab0477a80df74e646bdbc93621143f5caf104206aa29294d53de1a03d90"}, +] + +[package.dependencies] +wcwidth = "*" + [[package]] name = "propcache" version = "0.2.0" @@ -1772,6 +1835,43 @@ anyio = ">=3.4.0,<5" [package.extras] full = ["httpx (>=0.22.0)", "itsdangerous", "jinja2", "python-multipart (>=0.0.7)", "pyyaml"] +[[package]] +name = "telnetlib3" +version = "2.0.4" +description = "Python 3 asyncio Telnet server and client Protocol library" +optional = false +python-versions = ">=3.7" +files = [ + {file = "telnetlib3-2.0.4-py2.py3-none-any.whl", hash = "sha256:b3c0f984a7fb1b6ee16e6fdaa410c56389b0dc492174a99c6661b1ba4c9d457d"}, + {file = "telnetlib3-2.0.4.tar.gz", hash = "sha256:dbcbc16456a0e03a62431be7cfefff00515ab2f4ce2afbaf0d3a0e51a98c948d"}, +] + +[[package]] +name = "terminaltables" +version = "3.1.10" +description = "Generate simple tables in terminals from a nested list of strings." +optional = false +python-versions = ">=2.6" +files = [ + {file = "terminaltables-3.1.10-py2.py3-none-any.whl", hash = "sha256:e4fdc4179c9e4aab5f674d80f09d76fa436b96fdc698a8505e0a36bf0804a874"}, + {file = "terminaltables-3.1.10.tar.gz", hash = "sha256:ba6eca5cb5ba02bba4c9f4f985af80c54ec3dccf94cfcd190154386255e47543"}, +] + +[[package]] +name = "trafaret" +version = "2.1.1" +description = "Validation and parsing library" +optional = false +python-versions = "*" +files = [ + {file = "trafaret-2.1.1-py3-none-any.whl", hash = "sha256:1966f432586797aed663edd54cbc201fd7ba59eed1638f1a7a33f17977b3a569"}, + {file = "trafaret-2.1.1.tar.gz", hash = "sha256:d9d00800318fbd343fdfb3353e947b2ebb5557159c844696c5ac24846f76d41c"}, +] + +[package.extras] +objectid = ["pymongo (>=2.4.1)"] +rfc3339 = ["python-dateutil (>=1.5)"] + [[package]] name = "typing-extensions" version = "4.12.2" @@ -1985,6 +2085,17 @@ files = [ [package.dependencies] anyio = ">=3.0.0" +[[package]] +name = "wcwidth" +version = "0.2.13" +description = "Measures the displayed width of unicode strings in a terminal" +optional = false +python-versions = "*" +files = [ + {file = "wcwidth-0.2.13-py2.py3-none-any.whl", hash = "sha256:3da69048e4540d84af32131829ff948f1e022c1c6bdb8d6102117aac784f6859"}, + {file = "wcwidth-0.2.13.tar.gz", hash = "sha256:72ea0c06399eb286d978fdedb6923a9eb47e1c486ce63e9b4e64fc18303972b5"}, +] + [[package]] name = "websockets" version = "13.1" @@ -2207,4 +2318,4 @@ propcache = ">=0.2.0" [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "7607ff77762b700b8f487fd9b5ef6c07e875eccd429feace40047276d2f84280" +content-hash = "bf8122985963391df3c60a13513784f7533309ec22095a82cac34034b6dae399" diff --git a/guiTools/pyproject.toml b/guiTools/pyproject.toml index 13d226f..644a980 100644 --- a/guiTools/pyproject.toml +++ b/guiTools/pyproject.toml @@ -14,6 +14,7 @@ sh = "^2.1.0" docker = "^7.1.0" aiodocker = "^0.23.0" numpy = "^2.1.3" +aiomonitor = "^0.7.1" [build-system] requires = ["poetry-core"] diff --git a/guiTools/spiri_sdk_guitools/launcher.py b/guiTools/spiri_sdk_guitools/launcher.py index 3151619..b9fe73a 100644 --- a/guiTools/spiri_sdk_guitools/launcher.py +++ b/guiTools/spiri_sdk_guitools/launcher.py @@ -3,6 +3,7 @@ import subprocess from collections import defaultdict import docker import time +from loguru import logger docker_client = docker.from_env() @@ -28,7 +29,6 @@ ui.label("Spiri Robotics SDK").style('font-size: 40px; margin-bottom: 10px;').cl robots = [] from spiri_sdk_guitools.sim_drone import robot_types -import aiodocker import asyncio @ui.page('/') @@ -68,5 +68,16 @@ async def main(): ui.label(f"Add new {name}").classes("text-3xl") await robot.launch_widget(robots_widget) +import aiomonitor +async def amonitor(): + # + logger.info("Starting aiomonitor") + loop = asyncio.get_running_loop() + run_forever = loop.create_future() + with aiomonitor.start_monitor(loop): + await run_forever + +app.on_startup(amonitor) + # Start the NiceGUI application ui.run(title="Spiri SDK Launcher", port=8923, dark=None) diff --git a/guiTools/spiri_sdk_guitools/sim_drone.py b/guiTools/spiri_sdk_guitools/sim_drone.py index f6a37ac..76fe448 100644 --- a/guiTools/spiri_sdk_guitools/sim_drone.py +++ b/guiTools/spiri_sdk_guitools/sim_drone.py @@ -119,7 +119,19 @@ class Spirimu(Robot): ).bind_value(newRobotParams, 'sysid') default_robot_compose = "" for compose_file in Path("/robots").glob("**/docker-compose.yaml"): - default_robot_compose += f"{compose_file} --build \n" + specialArgs = "" + try: + data = yaml.safe_load(compose_file.read_text()) + except yaml.YAMLError: + default_robot_compose += f"#{compose_file} not valid \n" + continue + specialArgs = data.get("x-spiri-sdk-default-args", "") + docstring = data.get("x-spiri-sdk-doc", "") + if docstring: + for line in docstring.split("\n"): + if line: + default_robot_compose += f"# {line}\n" + default_robot_compose += f"{compose_file} {specialArgs}\n" ui.label("Compose files").classes("text-xl") ui.codemirror(value=default_robot_compose, language="bash", theme="basicDark").bind_value(newRobotParams, 'compose_files') @@ -190,17 +202,28 @@ class Spirimu(Robot): with element: node_dummy = Node("_ros2cli_dummy_to_show_topic_list") scroll_area = ui.scroll_area() - with scroll_area: - while True: + def refresh_topics(): + with scroll_area: scroll_area.clear() #Filter for topics that start with self.robot_name for topic in node_dummy.get_topic_names_and_types(): if self.robot_name in topic[0]: ui.label(topic[0]) - await asyncio.sleep(10) + ui.button("Refresh topics", on_click=refresh_topics).classes("m-2") async def ui_actions(self, element): pass + with element: + node_dummy = Node("_ros2cli_dummy_to_show_service_list") + scroll_area = ui.scroll_area() + def refresh_topics(): + with scroll_area: + scroll_area.clear() + #Filter for topics that start with self.robot_name + for topic in node_dummy.get_action_names_and_types(): + if self.robot_name in topic[0]: + ui.label(topic[0]) + ui.button("Refresh topics", on_click=refresh_topics).classes("m-2") async def ui(self, element): adocker = aiodocker.Docker() @@ -342,15 +365,13 @@ class Spirimu(Robot): cwd=f"/ardupilot_gazebo/models/{DRONE_MODEL}", stdout=subprocess.PIPE, stderr=subprocess.PIPE, - timeout=1, ) ros2_gz_create_proc = subprocess.Popen( ROS2_CMD.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, - timeout=1, ) - out, err = ros2_gz_create_proc.communicate(timeout=15) + out, err = ros2_gz_create_proc.communicate(timeout=3) ros2_gz_create_proc.kill() return @@ -381,5 +402,5 @@ class Spirimu(Robot): stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) - out, err = remove_entity_proc.communicate(timeout=15) + out, err = remove_entity_proc.communicate(timeout=3) remove_entity_proc.kill() diff --git a/robots/spiri-mu/core/docker-compose.yaml b/robots/spiri-mu/core/docker-compose.yaml index 2ff1dbb..a152b63 100644 --- a/robots/spiri-mu/core/docker-compose.yaml +++ b/robots/spiri-mu/core/docker-compose.yaml @@ -1,3 +1,6 @@ +x-spiri-sdk-doc: | + Runs the core services for a simulated Spiri Mu + services: ardupilot: env_file: diff --git a/robots/spiri-mu/virtual_camera/docker-compose.yaml b/robots/spiri-mu/virtual_camera/docker-compose.yaml index 5a4bcf7..6caa122 100644 --- a/robots/spiri-mu/virtual_camera/docker-compose.yaml +++ b/robots/spiri-mu/virtual_camera/docker-compose.yaml @@ -1,4 +1,8 @@ +x-spiri-sdk-doc: | + Start a virtual camera that can be included in ros +x-spiri-sdk-default-args: --build + services: front-gimbal: ipc: host -- 2.40.1 From 9fc85c92e67bdd3ee0e40b33529e0ec7a3c76e1e Mon Sep 17 00:00:00 2001 From: Alex Davies Date: Sun, 24 Nov 2024 15:03:59 -0400 Subject: [PATCH 07/20] Use cyclonedds by default --- docker-compose.yml | 2 +- guiTools/Dockerfile | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 31e1614..64dfc66 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ services: # QT_QPA_PLATFORM: "${QT_QPA_PLATFORM:-xcb}" XDG_RUNTIME_DIR: "${XDG_RUNTIME_DIR}" ROS_MASTER_URI: "http://ros-master:11311" - PYTHONASYNCIODEBUG: "1" + RMW_IMPLEMENTATION: rmw_cyclonedds_cpp volumes: # X11 socket diff --git a/guiTools/Dockerfile b/guiTools/Dockerfile index 63306ea..6cd0dd2 100644 --- a/guiTools/Dockerfile +++ b/guiTools/Dockerfile @@ -11,7 +11,8 @@ RUN apt-get -y install qterminal mesa-utils \ gstreamer1.0-gl \ gstreamer1.0-plugins-good \ gstreamer1.0-plugins-bad \ - gstreamer1.0-plugins-ugly + gstreamer1.0-plugins-ugly \ + ros-${ROS_DISTRO}-rmw-cyclonedds-cpp COPY --from=git.spirirobotics.com/spiri/gazebo-resources:main /plugins /ardupilot_gazebo/plugins -- 2.40.1 From 9538f37c5b9062a79715f027b7cab31c8ba97da3 Mon Sep 17 00:00:00 2001 From: Alex Davies Date: Wed, 27 Nov 2024 15:22:07 -0400 Subject: [PATCH 08/20] Remove actions tab for now --- guiTools/spiri_sdk_guitools/sim_drone.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/guiTools/spiri_sdk_guitools/sim_drone.py b/guiTools/spiri_sdk_guitools/sim_drone.py index 76fe448..4f0a530 100644 --- a/guiTools/spiri_sdk_guitools/sim_drone.py +++ b/guiTools/spiri_sdk_guitools/sim_drone.py @@ -92,6 +92,13 @@ for file in Path("/robots").glob("**/robot_plugins.py"): spec.loader.exec_module(plugin) logger.info(f"Loaded plugin {file}") +async def topic_subscriber(element, topic_name): + while True: + with element: + element.clear() + ui.label(topic_name) + await asyncio.sleep(1) + class Spirimu(Robot): robot_type = "spiri_mu" @@ -209,6 +216,9 @@ class Spirimu(Robot): for topic in node_dummy.get_topic_names_and_types(): if self.robot_name in topic[0]: ui.label(topic[0]) + # expander = ui.expansion(topic[0]).classes('w-full') + # topic_subscriber(expander, topic[0]) + ui.button("Refresh topics", on_click=refresh_topics).classes("m-2") async def ui_actions(self, element): @@ -248,14 +258,14 @@ class Spirimu(Robot): with ui.tabs() as tabs: tab_containers = ui.tab("Containers") tab_ros = ui.tab("ROS Topics") - tab_actions = ui.tab("Actions") + # tab_actions = ui.tab("Actions") with ui.tab_panels(tabs, value=tab_containers): tab = ui.tab_panel(tab_containers).classes("w-full") asyncio.create_task(self.ui_containers(tab)) tab = ui.tab_panel(tab_ros).classes("w-full") asyncio.create_task(self.ui_ros(tab)) - tab = ui.tab_panel(tab_actions).classes("w-full") - asyncio.create_task(self.ui_actions(tab)) + # tab = ui.tab_panel(tab_actions).classes("w-full") + # asyncio.create_task(self.ui_actions(tab)) async def async_stop(self): return await run.io_bound(self.stop) -- 2.40.1 From e1ecb7538c11e2870c2de551d1ae8e7d001120c0 Mon Sep 17 00:00:00 2001 From: Alex Davies Date: Wed, 27 Nov 2024 16:04:48 -0400 Subject: [PATCH 09/20] Added camera capture app --- .gitignore | 1 + docker-compose.yml | 1 + .../spiri-mu/camera_capture/docker-compose.yaml | 15 +++++++++++++++ 3 files changed, 17 insertions(+) create mode 100644 robots/spiri-mu/camera_capture/docker-compose.yaml diff --git a/.gitignore b/.gitignore index 6e30435..1b0e716 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ docs/build/ .vscode *.pyc +survey/ diff --git a/docker-compose.yml b/docker-compose.yml index 64dfc66..e006568 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,7 @@ services: XDG_RUNTIME_DIR: "${XDG_RUNTIME_DIR}" ROS_MASTER_URI: "http://ros-master:11311" RMW_IMPLEMENTATION: rmw_cyclonedds_cpp + SDK_ROOT: ${PWD} volumes: # X11 socket diff --git a/robots/spiri-mu/camera_capture/docker-compose.yaml b/robots/spiri-mu/camera_capture/docker-compose.yaml new file mode 100644 index 0000000..b27f2be --- /dev/null +++ b/robots/spiri-mu/camera_capture/docker-compose.yaml @@ -0,0 +1,15 @@ +x-spiri-sdk-doc: Capture camera images for mapping + +services: + camera-capture: + ipc: host + network_mode: host + restart: unless-stopped + image: restreamio/gstreamer:2024-11-14T15-53-57Z-prod + volumes: + - ${SDK_ROOT}/survey/${ROBOT_NAME}:/survey + environment: + - RMW_IMPLEMENTATION=rmw_cyclonedds_cpp + command: sh -c "rm /survey/* && gst-launch-1.0 -vc udpsrc port=$GSTREAMER_UDP_PORT close-socket=false auto-multicast=true ! application/x-rtp, payload=96 ! rtph264depay ! decodebin3 ! videoconvert ! videorate ! video/x-raw,framerate=1/2 ! jpegenc ! multifilesink location=/survey/img_"frame%d".jpg throttle-time=1" + + -- 2.40.1 From b07870936c046da82ff6435e3979b899816e7311 Mon Sep 17 00:00:00 2001 From: Alex Davies Date: Wed, 27 Nov 2024 16:35:28 -0400 Subject: [PATCH 10/20] Documented custom docker-compose extentions --- README.md | 19 +++++++++++++++++++ guiTools/spiri_sdk_guitools/sim_drone.py | 5 +++++ .../camera_capture/docker-compose.yaml | 1 + 3 files changed, 25 insertions(+) diff --git a/README.md b/README.md index 8f67d5c..bf7601f 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,25 @@ ROS1 is considered end of life. It's recomended to use a ROS2 template instead We're working on it... +## Special docker options + +We support the following special docker options to make metadata available inside the SDK + + * x-spiri-sdk-doc: "" + +This will appear as a comment when creating a new robot + + * x-spiri-sdk-default-enabled: true + +Set this to false and that docker compose will be commented out by default when creating a new robot + + * x-spiri-sdk-default-args: "" + +Extra arguments to pass to docker compose. Should accept all docker compose arguments. + +Common options would be `--build`. You might also appreciate `--pull ("always"|"missing"|"never")`. + + ## NVIDIA Container Toolkit [Source](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) diff --git a/guiTools/spiri_sdk_guitools/sim_drone.py b/guiTools/spiri_sdk_guitools/sim_drone.py index 4f0a530..5fab2e1 100644 --- a/guiTools/spiri_sdk_guitools/sim_drone.py +++ b/guiTools/spiri_sdk_guitools/sim_drone.py @@ -133,11 +133,16 @@ class Spirimu(Robot): default_robot_compose += f"#{compose_file} not valid \n" continue specialArgs = data.get("x-spiri-sdk-default-args", "") + enabled = str(data.get("x-spiri-sdk-default-enabled", True)) + enabled = enabled.lower() in ["true", "yes", "1"] + docstring = data.get("x-spiri-sdk-doc", "") if docstring: for line in docstring.split("\n"): if line: default_robot_compose += f"# {line}\n" + if not enabled: + default_robot_compose += "##" default_robot_compose += f"{compose_file} {specialArgs}\n" ui.label("Compose files").classes("text-xl") diff --git a/robots/spiri-mu/camera_capture/docker-compose.yaml b/robots/spiri-mu/camera_capture/docker-compose.yaml index b27f2be..81c15ba 100644 --- a/robots/spiri-mu/camera_capture/docker-compose.yaml +++ b/robots/spiri-mu/camera_capture/docker-compose.yaml @@ -1,4 +1,5 @@ x-spiri-sdk-doc: Capture camera images for mapping +x-spiri-sdk-default-enabled: false services: camera-capture: -- 2.40.1 From f9f17d1f8b919115a0acc7726d81dd2180ac079e Mon Sep 17 00:00:00 2001 From: Alex Davies Date: Wed, 27 Nov 2024 16:57:29 -0400 Subject: [PATCH 11/20] Better failure handling and frame name for image capture --- robots/spiri-mu/camera_capture/docker-compose.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/robots/spiri-mu/camera_capture/docker-compose.yaml b/robots/spiri-mu/camera_capture/docker-compose.yaml index 81c15ba..0a9c2cc 100644 --- a/robots/spiri-mu/camera_capture/docker-compose.yaml +++ b/robots/spiri-mu/camera_capture/docker-compose.yaml @@ -8,9 +8,7 @@ services: restart: unless-stopped image: restreamio/gstreamer:2024-11-14T15-53-57Z-prod volumes: - - ${SDK_ROOT}/survey/${ROBOT_NAME}:/survey + - ${SDK_ROOT}/survey/${ROBOT_NAME}:/survey/ environment: - RMW_IMPLEMENTATION=rmw_cyclonedds_cpp - command: sh -c "rm /survey/* && gst-launch-1.0 -vc udpsrc port=$GSTREAMER_UDP_PORT close-socket=false auto-multicast=true ! application/x-rtp, payload=96 ! rtph264depay ! decodebin3 ! videoconvert ! videorate ! video/x-raw,framerate=1/2 ! jpegenc ! multifilesink location=/survey/img_"frame%d".jpg throttle-time=1" - - + command: sh -c "rm -f /survey/*; gst-launch-1.0 -vc udpsrc port=$GSTREAMER_UDP_PORT close-socket=false auto-multicast=true ! application/x-rtp, payload=96 ! rtph264depay ! decodebin3 ! videoconvert ! videorate ! video/x-raw,framerate=1/2 ! jpegenc ! multifilesink location=/survey/img_%05d.jpg throttle-time=1" -- 2.40.1 From 8c074f7beeeec95528dc29b33873c6b619fcc689 Mon Sep 17 00:00:00 2001 From: Alex Davies Date: Thu, 28 Nov 2024 12:28:19 -0400 Subject: [PATCH 12/20] Added connection for mission-coordinator --- robots/spiri-mu/core/docker-compose.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/robots/spiri-mu/core/docker-compose.yaml b/robots/spiri-mu/core/docker-compose.yaml index a152b63..8997267 100644 --- a/robots/spiri-mu/core/docker-compose.yaml +++ b/robots/spiri-mu/core/docker-compose.yaml @@ -25,6 +25,7 @@ services: --master tcp:127.0.0.1:$SERIAL0_PORT --out udpout:0.0.0.0:$MAVROS2_PORT --out udpout:0.0.0.0:$MAVROS1_PORT + --out udpout:0.0.0.0:18761 --sitl 127.0.0.1:$SITL_PORT --out udp:0.0.0.0:$GCS_PORT ipc: host -- 2.40.1 From 8f49f6cffdfee3d40a23bb322cf505a25a28879f Mon Sep 17 00:00:00 2001 From: Alex Davies Date: Fri, 29 Nov 2024 14:06:57 -0400 Subject: [PATCH 13/20] Remove gazebo standalone option --- guiTools/spiri_sdk_guitools/launcher.py | 1 - 1 file changed, 1 deletion(-) diff --git a/guiTools/spiri_sdk_guitools/launcher.py b/guiTools/spiri_sdk_guitools/launcher.py index b9fe73a..966fa2a 100644 --- a/guiTools/spiri_sdk_guitools/launcher.py +++ b/guiTools/spiri_sdk_guitools/launcher.py @@ -13,7 +13,6 @@ applications = { "rqt": ["rqt"], "rviz2": ["rviz2"], "Gazebo": ["/gz_entrypoint.sh"], - "Gazebo Standalone": "gz sim -v4".split(), # Add more applications here if needed } -- 2.40.1 From 25bf2267d93865f533141d3fd672b7068fff1548 Mon Sep 17 00:00:00 2001 From: Alex Davies Date: Fri, 29 Nov 2024 14:18:45 -0400 Subject: [PATCH 14/20] Use cycloneDDS and make world name an env var --- .env | 3 ++- guiTools/spiri_sdk_guitools/sim_drone.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.env b/.env index 5ba047f..264357f 100644 --- a/.env +++ b/.env @@ -7,6 +7,7 @@ MAVROS1_PORT=14561 FDM_PORT_IN=9002 GSTREAMER_UDP_PORT=5600 ROS_MASTER_URI="http://0.0.0.0:11311" +RMW_IMPLEMENTATION=rmw_cyclonedds_cpp ARDUPILOT_VEHICLE="-v copter -f gazebo-mu --model=JSON -L CitadelHill" @@ -16,4 +17,4 @@ DRONE_MODEL="spiri_mu" SIM_DRONE_COUNT=1 -GCS_PORT=14550 \ No newline at end of file +GCS_PORT=14550 diff --git a/guiTools/spiri_sdk_guitools/sim_drone.py b/guiTools/spiri_sdk_guitools/sim_drone.py index 5fab2e1..a3ed2b4 100644 --- a/guiTools/spiri_sdk_guitools/sim_drone.py +++ b/guiTools/spiri_sdk_guitools/sim_drone.py @@ -117,7 +117,7 @@ class Spirimu(Robot): robots.add(self) #Ros doesn't like dashes in node names self.robot_name = f"{self.robot_type}_{self.sysid}".replace("-","_") - self.world_name = "citadel_hill" + self.wold_name = os.environ.get("WORLD_NAME", "citadel_hill") @classmethod async def launch_widget(cls, robots_widget): -- 2.40.1 From a0045839cc6fd7876760b3bdba876162845bbe98 Mon Sep 17 00:00:00 2001 From: Burak Ozter Date: Wed, 4 Dec 2024 10:22:29 -0400 Subject: [PATCH 15/20] fix cached apt update layer --- guiTools/Dockerfile | 5 ++--- robots/spiri-mu/virtual_camera/Dockerfile | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/guiTools/Dockerfile b/guiTools/Dockerfile index 6cd0dd2..be3b104 100644 --- a/guiTools/Dockerfile +++ b/guiTools/Dockerfile @@ -1,7 +1,6 @@ FROM osrf/ros:jazzy-desktop-full - -RUN apt-get update -RUN apt-get -y install qterminal mesa-utils \ + +RUN apt-get update && apt-get -y install qterminal mesa-utils \ libgstreamer1.0-dev \ libgstreamer-plugins-base1.0-dev \ docker-compose \ diff --git a/robots/spiri-mu/virtual_camera/Dockerfile b/robots/spiri-mu/virtual_camera/Dockerfile index 69bb0af..4c9b43d 100644 --- a/robots/spiri-mu/virtual_camera/Dockerfile +++ b/robots/spiri-mu/virtual_camera/Dockerfile @@ -1,7 +1,6 @@ FROM git.spirirobotics.com/spiri/services-ros2-mavros:main -RUN apt-get update -RUN apt-get --yes install ros-${ROS_DISTRO}-ros-gz-bridge \ +RUN apt-get update && apt-get --yes install ros-${ROS_DISTRO}-ros-gz-bridge \ ros-${ROS_DISTRO}-ros-gz-image \ ros-${ROS_DISTRO}-compressed-image-transport \ ros-${ROS_DISTRO}-rmw-cyclonedds-cpp -- 2.40.1 From b55ec7a5ad0f41c229b12c7d444fbc972debb61c Mon Sep 17 00:00:00 2001 From: Burak Ozter Date: Wed, 4 Dec 2024 11:49:46 -0400 Subject: [PATCH 16/20] remove core folder .env file, has no effect --- robots/spiri-mu/core/.env | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 robots/spiri-mu/core/.env diff --git a/robots/spiri-mu/core/.env b/robots/spiri-mu/core/.env deleted file mode 100644 index 5ba047f..0000000 --- a/robots/spiri-mu/core/.env +++ /dev/null @@ -1,19 +0,0 @@ -DRONE_SYS_ID=1 -INSTANCE=0 -SERIAL0_PORT=5760 -SITL_PORT=5501 -MAVROS2_PORT=14560 -MAVROS1_PORT=14561 -FDM_PORT_IN=9002 -GSTREAMER_UDP_PORT=5600 -ROS_MASTER_URI="http://0.0.0.0:11311" - - -ARDUPILOT_VEHICLE="-v copter -f gazebo-mu --model=JSON -L CitadelHill" -WORLD_FILE_NAME="citadel_hill_world.sdf" -WORLD_NAME="citadel_hill" -DRONE_MODEL="spiri_mu" - - -SIM_DRONE_COUNT=1 -GCS_PORT=14550 \ No newline at end of file -- 2.40.1 From 13ecba650835aff55509983af313d1b404793dab Mon Sep 17 00:00:00 2001 From: Burak Ozter Date: Wed, 4 Dec 2024 11:50:08 -0400 Subject: [PATCH 17/20] remove unused sh file --- guiTools/spawn_drones.sh | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 guiTools/spawn_drones.sh diff --git a/guiTools/spawn_drones.sh b/guiTools/spawn_drones.sh deleted file mode 100644 index a5429c3..0000000 --- a/guiTools/spawn_drones.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -set -e #PR #6 -source /opt/ros/$ROS_DISTRO/setup.bash - -if [[ -z $SIM_DRONE_COUNT ]] -then - echo "SIM_DRONE_COUNT environment variable is not set." - exit 1 -fi - -gz sim -v -r $WORLD_FILE_NAME & -while true -do - topics=$(gz topic -l) - if [[ $topics == *"/world/$WORLD_NAME"* ]] - then - break - fi - sleep 1 -done - -cd /ardupilot_gazebo/models/$DRONE_MODEL -for (( j=0; j<$SIM_DRONE_COUNT; j++ )); -do - xacro -v gstreamer_udp_port:=$(($GSTREAMER_UDP_PORT + ($j * 10))) fdm_port_in:=$(($FDM_PORT_IN + ($j * 10))) model.xacro.sdf -o model.sdf - #! string is better than using -file option. File is not up to date in the next iteration. - value=$( Date: Wed, 4 Dec 2024 11:51:08 -0400 Subject: [PATCH 18/20] remove RMW_IMPLEMENTATION from .env which has no effect. RMW_IMPLEMENTATION is set in individual docker-compose files. --- .env | 1 - 1 file changed, 1 deletion(-) diff --git a/.env b/.env index 264357f..2f5de5f 100644 --- a/.env +++ b/.env @@ -7,7 +7,6 @@ MAVROS1_PORT=14561 FDM_PORT_IN=9002 GSTREAMER_UDP_PORT=5600 ROS_MASTER_URI="http://0.0.0.0:11311" -RMW_IMPLEMENTATION=rmw_cyclonedds_cpp ARDUPILOT_VEHICLE="-v copter -f gazebo-mu --model=JSON -L CitadelHill" -- 2.40.1 From d4a7af18c1fc42705054a1e2950c85711acdbcd8 Mon Sep 17 00:00:00 2001 From: Burak Ozter Date: Wed, 4 Dec 2024 13:19:30 -0400 Subject: [PATCH 19/20] add cyclone_dds to mavros2 service, remove all .env files which were not being used --- robots/spiri-mu/core/docker-compose.yaml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/robots/spiri-mu/core/docker-compose.yaml b/robots/spiri-mu/core/docker-compose.yaml index 8997267..5b26357 100644 --- a/robots/spiri-mu/core/docker-compose.yaml +++ b/robots/spiri-mu/core/docker-compose.yaml @@ -3,8 +3,6 @@ x-spiri-sdk-doc: | services: ardupilot: - env_file: - - .env image: git.spirirobotics.com/spiri/ardupilot:spiri-master command: - /bin/bash @@ -17,8 +15,6 @@ services: network_mode: host mavproxy: - env_file: - - .env image: git.spirirobotics.com/spiri/services-mavproxy:main command: > mavproxy.py --non-interactive @@ -33,9 +29,9 @@ services: restart: always mavros2: - env_file: - - .env image: git.spirirobotics.com/spiri/services-ros2-mavros:main + environment: + - RMW_IMPLEMENTATION=rmw_cyclonedds_cpp command: ros2 launch mavros apm.launch fcu_url:="udp://0.0.0.0:$MAVROS2_PORT@:14555" namespace:="$ROBOT_NAME" tgt_system:="$DRONE_SYS_ID" ipc: host network_mode: host @@ -58,8 +54,6 @@ services: mavros: #This service bridges our mavlink-based robot-coprosessor into ROS #In this example it connects to a simulated coprocessor. - env_file: - - .env image: git.spirirobotics.com/spiri/services-ros1-mavros:master command: rosrun mavros mavros_node __name:=spiri$DRONE_SYS_ID _fcu_url:="udp://0.0.0.0:$MAVROS1_PORT@:14559" _target_system_id:="$DRONE_SYS_ID" profiles: @@ -78,8 +72,6 @@ services: hard: 524288 ros-master: - env_file: - - .env image: git.spirirobotics.com/spiri/services-ros1-core:main command: stdbuf -o L roscore profiles: -- 2.40.1 From 21e2d99d4a9d5a14658d311b5b336e47246e7dc9 Mon Sep 17 00:00:00 2001 From: Burak Ozter Date: Wed, 4 Dec 2024 13:20:15 -0400 Subject: [PATCH 20/20] fix world_name env variable --- guiTools/spiri_sdk_guitools/sim_drone.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guiTools/spiri_sdk_guitools/sim_drone.py b/guiTools/spiri_sdk_guitools/sim_drone.py index a3ed2b4..aa2f89d 100644 --- a/guiTools/spiri_sdk_guitools/sim_drone.py +++ b/guiTools/spiri_sdk_guitools/sim_drone.py @@ -117,7 +117,7 @@ class Spirimu(Robot): robots.add(self) #Ros doesn't like dashes in node names self.robot_name = f"{self.robot_type}_{self.sysid}".replace("-","_") - self.wold_name = os.environ.get("WORLD_NAME", "citadel_hill") + # self.wold_name = os.environ.get("WORLD_NAME", "citadel_hill") @classmethod async def launch_widget(cls, robots_widget): @@ -317,7 +317,7 @@ class Spirimu(Robot): INSTANCE=str(instance), DRONE_SYS_ID=str(self.sysid), ROBOT_NAME=self.robot_name, - WORLD_NAME="citadel_hill", + WORLD_NAME=env["WORLD_NAME"], ): self.spawn_gz_model() logger.info("Starting drone stack, this may take some time") -- 2.40.1