Compare commits
2 Commits
a5207c6b28
...
4b253db946
Author | SHA1 | Date |
---|---|---|
Alex Davies | 4b253db946 | |
Alex Davies | 5bad26fe35 |
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
@ -348,7 +371,7 @@ class Spirimu(Robot):
|
|||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
out, err = ros2_gz_create_proc.communicate(timeout=15)
|
||||
out, err = ros2_gz_create_proc.communicate(timeout=3)
|
||||
ros2_gz_create_proc.kill()
|
||||
return
|
||||
|
||||
|
@ -379,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()
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
x-spiri-sdk-doc: |
|
||||
Runs the core services for a simulated Spiri Mu
|
||||
|
||||
services:
|
||||
ardupilot:
|
||||
env_file:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue