diff --git a/docker-compose.yml b/docker-compose.yml index b070297..4490905 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,7 +28,8 @@ services: #Auto reload on code changes - ./guiTools/spiri_sdk_guitools/:/app/spiri_sdk_guitools/ # Enable launching the SDK from the SDK - - ./:/app/sdk + # - ./:/app/sdk + - ./robots:/robots - /var/run/docker.sock:/var/run/docker.sock devices: # Provide access to GPU devices @@ -41,7 +42,6 @@ services: 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 - profiles: [ui] deploy: resources: reservations: @@ -50,102 +50,3 @@ services: device_ids: - nvidia.com/gpu=all - ardupilot: - env_file: - - .env - image: git.spirirobotics.com/spiri/ardupilot:spiri-master - command: - - /bin/bash - - -c - - | - ./Tools/autotest/sim_vehicle.py $ARDUPILOT_VEHICLE --no-rebuild \ - --no-mavproxy --enable-dds --sysid $DRONE_SYS_ID -I$INSTANCE - profiles: - - uav-sim - stdin_open: true - tty: true - network_mode: host - - mavproxy: - env_file: - - .env - image: git.spirirobotics.com/spiri/services-mavproxy:main - command: > - mavproxy.py --non-interactive - --master tcp:127.0.0.1:$SERIAL0_PORT - --out udpout:0.0.0.0:$MAVROS2_PORT - --out udpout:0.0.0.0:$MAVROS1_PORT - --sitl 127.0.0.1:$SITL_PORT - --out udp:0.0.0.0:$GCS_PORT - profiles: - - uav-sim - ipc: host - network_mode: host - restart: always - - mavros2: - env_file: - - .env - image: git.spirirobotics.com/spiri/services-ros2-mavros:main - command: ros2 launch mavros apm.launch fcu_url:="udp://0.0.0.0:$MAVROS2_PORT@:14555" namespace:="spiri$DRONE_SYS_ID" tgt_system:="$DRONE_SYS_ID" - profiles: - - uav-sim - ipc: host - network_mode: host - restart: always - depends_on: - ardupilot: - condition: service_started - mavproxy: - condition: service_started - deploy: - resources: - limits: - # cpus: '0.01' - memory: 200M - ulimits: - nofile: - soft: 1024 - hard: 524288 - 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: - - uav-sim - ipc: host - network_mode: host - restart: always - deploy: - resources: - limits: - # cpus: '0.01' - memory: 200M - ulimits: - nofile: - soft: 1024 - hard: 524288 - - ros-master: - env_file: - - .env - image: git.spirirobotics.com/spiri/services-ros1-core:main - command: stdbuf -o L roscore - profiles: - - ros-master - ipc: host - network_mode: host - restart: always - deploy: - resources: - limits: - memory: 1G - # Madness, setting a low ulimit here fixes memory leaks - # https://answers.ros.org/question/336963/rosout-high-memory-usage/ - ulimits: - nofile: - soft: 1024 - hard: 524288 diff --git a/guiTools/spiri_sdk_guitools/launcher.py b/guiTools/spiri_sdk_guitools/launcher.py index 45eae63..3f87e6a 100644 --- a/guiTools/spiri_sdk_guitools/launcher.py +++ b/guiTools/spiri_sdk_guitools/launcher.py @@ -46,7 +46,7 @@ async def main(): with ui.tab_panel(tab_robots): new_robot_widget = ui.element().classes("w-1/2") with ui.element().classes("w-1/2"): - ui.label("Debug") + ui.label("Debug").classes("text-xl") def cleanup_all_containers(): #Find all containers that start with spiri-sdk containers = docker_client.containers.list(all=True) @@ -59,16 +59,16 @@ async def main(): ui.button("Cleanup all containers", on_click=cleanup_all_containers) ui.separator() - ui.label("Current robots") + ui.label("Current robots").classes("text-3xl") robots_widget = ui.element().classes("w-full") #Add a new robot with new_robot_widget: - ui.label("Add new robot") + 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') - ui.textarea(value="./sdk/docker-compose.yml", label="Compose files (comma or newline seperated)").bind_value(newRobotParams, 'compose_files') + ui.textarea(value="/robots/spiri-mu/core/docker-compose.yaml", label="Compose files (comma or newline seperated)").bind_value(newRobotParams, 'compose_files') async def new_robot(): robot = Robot(**newRobotParams) asyncio.tasks.create_task(robot.ui(robots_widget)) diff --git a/guiTools/spiri_sdk_guitools/sim_drone.py b/guiTools/spiri_sdk_guitools/sim_drone.py index c7dfadb..947ea4b 100644 --- a/guiTools/spiri_sdk_guitools/sim_drone.py +++ b/guiTools/spiri_sdk_guitools/sim_drone.py @@ -82,8 +82,8 @@ class Robot: if container not in docker_elements: docker_elements[container] = ui.element().classes("w-full") with docker_elements[container]: - ui.label().bind_text(container_status, container) - logelement = ui.expansion("Logs").style('margin: 10px;').classes('w-full') + ui.label().bind_text(container_status, container).classes("text-lg") + logelement = ui.expansion("Logs").style('margin: 10px;').classes('w-full outline outline-1') asyncio.create_task(container_logs(container, logelement)) #Check for containers that have been removed removed = set(docker_elements.keys()) - set(self.containers()) @@ -98,7 +98,7 @@ class Robot: with element: self.robot_ui = ui.element().classes("w-full outline p-4") with self.robot_ui: - ui.label(f"{self.robot_type}") + ui.label(f"{self.robot_type} {self.sysid}").classes("text-2xl") ui.label(f"""Sysid: {self.sysid}""") ui.button("Start", on_click=self.start).classes("m-2") ui.button("Stop", on_click=self.async_stop).classes("m-2") diff --git a/robots/spiri-mu/core/.env b/robots/spiri-mu/core/.env new file mode 100644 index 0000000..5ba047f --- /dev/null +++ b/robots/spiri-mu/core/.env @@ -0,0 +1,19 @@ +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 diff --git a/robots/spiri-mu/core/docker-compose.yaml b/robots/spiri-mu/core/docker-compose.yaml new file mode 100644 index 0000000..ca0348d --- /dev/null +++ b/robots/spiri-mu/core/docker-compose.yaml @@ -0,0 +1,95 @@ +services: + ardupilot: + env_file: + - .env + image: git.spirirobotics.com/spiri/ardupilot:spiri-master + command: + - /bin/bash + - -c + - | + ./Tools/autotest/sim_vehicle.py $ARDUPILOT_VEHICLE --no-rebuild \ + --no-mavproxy --enable-dds --sysid $DRONE_SYS_ID -I$INSTANCE + stdin_open: true + tty: true + network_mode: host + + mavproxy: + env_file: + - .env + image: git.spirirobotics.com/spiri/services-mavproxy:main + command: > + mavproxy.py --non-interactive + --master tcp:127.0.0.1:$SERIAL0_PORT + --out udpout:0.0.0.0:$MAVROS2_PORT + --out udpout:0.0.0.0:$MAVROS1_PORT + --sitl 127.0.0.1:$SITL_PORT + --out udp:0.0.0.0:$GCS_PORT + ipc: host + network_mode: host + restart: always + + mavros2: + env_file: + - .env + image: git.spirirobotics.com/spiri/services-ros2-mavros:main + command: ros2 launch mavros apm.launch fcu_url:="udp://0.0.0.0:$MAVROS2_PORT@:14555" namespace:="spiri$DRONE_SYS_ID" tgt_system:="$DRONE_SYS_ID" + ipc: host + network_mode: host + restart: always + depends_on: + ardupilot: + condition: service_started + mavproxy: + condition: service_started + deploy: + resources: + limits: + # cpus: '0.01' + memory: 200M + ulimits: + nofile: + soft: 1024 + hard: 524288 + + 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: + - ros1 + ipc: host + network_mode: host + restart: always + deploy: + resources: + limits: + # cpus: '0.01' + memory: 200M + ulimits: + nofile: + soft: 1024 + hard: 524288 + + ros-master: + env_file: + - .env + image: git.spirirobotics.com/spiri/services-ros1-core:main + command: stdbuf -o L roscore + profiles: + - ros1-master + ipc: host + network_mode: host + restart: always + deploy: + resources: + limits: + memory: 1G + # Madness, setting a low ulimit here fixes memory leaks + # https://answers.ros.org/question/336963/rosout-high-memory-usage/ + ulimits: + nofile: + soft: 1024 + hard: 524288