diff --git a/ground_control_station/docker/.env b/ground_control_station/docker/.env index ce071aa08..97dc4f7b5 100644 --- a/ground_control_station/docker/.env +++ b/ground_control_station/docker/.env @@ -19,3 +19,14 @@ TAK_SUBSCRIBER_FILEPATH=src/ros2tak_tools/scripts/tak_subscriber.py MQTT_USERNAME= # Enter the MQTT username MQTT_PASSWORD= # Enter the MQTT password + + +# GSTREAMER TO ROS NODES ----------------------------------------------- + +# CAMERA 1 +CAMERA1_STREAM_IP=rtsp://10.4.1.33:554/vio +CAMERA1_ROS_TOPIC=/view1/image_raw + +# CAMERA 2 +CAMERA2_STREAM_IP=rtsp:// +CAMERA2_ROS_TOPIC=/view2/image_raw diff --git a/ground_control_station/docker/Dockerfile.gst-ros-bridge b/ground_control_station/docker/Dockerfile.gst-ros-bridge new file mode 100644 index 000000000..ddc6e2ad2 --- /dev/null +++ b/ground_control_station/docker/Dockerfile.gst-ros-bridge @@ -0,0 +1,72 @@ +FROM nvidia/cuda:12.4.1-devel-ubuntu22.04 + +# Install humble +RUN apt-get update && apt-get install -y locales && \ + locale-gen en_US en_US.UTF-8 && \ + update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install -y software-properties-common && \ + apt-add-repository universe + +RUN apt-get update && \ + apt-get install -y curl + +RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key \ + -o /usr/share/keyrings/ros-archive-keyring.gpg && \ + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null + +RUN apt-get update && apt-get install -y \ + ros-dev-tools \ + ros-humble-ros-base \ + ros-humble-image-view + +# Utilities +RUN apt-get update && apt-get install -y \ + tmux \ + vim \ + wget + +# Install DIVOTrack dependencies +RUN apt-get update && apt-get install -y \ + python3-pip \ + python3-venv + +# Install ros-gst-bridge +RUN apt-get update && apt-get install -y \ + libgstreamer1.0-dev \ + libgstreamer-plugins-base1.0-dev \ + libgstreamer-plugins-bad1.0-dev \ + gstreamer1.0-plugins-base \ + gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-bad \ + gstreamer1.0-plugins-ugly \ + gstreamer1.0-libav \ + gstreamer1.0-tools \ + gstreamer1.0-x \ + gstreamer1.0-alsa +RUN mkdir -p /ros_ws/src +WORKDIR /ros_ws +RUN git clone https://github.com/BrettRD/ros-gst-bridge.git src/ros-gst-bridge +RUN /bin/bash -c "source /opt/ros/humble/setup.bash && \ + rosdep init && \ + rosdep update && \ + rosdep install --from-paths /ros_ws/src/ --ignore-src -r -y && \ + colcon build" + +RUN apt-get update && apt-get install -y \ + libnvidia-decode-525-server \ + libnvidia-encode-525-server + +# Disable shared memory for ROS +COPY resources/fastrtps-profile.xml /fastrtps-profile.xml +ENV FASTRTPS_DEFAULT_PROFILES_FILE=/fastrtps-profile.xml + +RUN echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc +RUN echo "source /ros_ws/install/setup.bash" >> ~/.bashrc + +# Entrypoint +CMD ["/bin/bash"] + diff --git a/ground_control_station/docker/docker-compose.yaml b/ground_control_station/docker/docker-compose.yaml index 92b71f6eb..1416b82cd 100644 --- a/ground_control_station/docker/docker-compose.yaml +++ b/ground_control_station/docker/docker-compose.yaml @@ -43,6 +43,28 @@ services: - ../ros_ws:/root/ros_ws:rw # gcs-specific ROS packages +####################### GSTREAMER TO ROS TOPICS ###################### + gst-ros-bridge-topic1: + container_name: "${PROJECT_NAME}-gst_ros_bridge1" + image: "${PROJECT_NAME}/gcs/gst-ros-bridge" + build: + context: . + dockerfile: Dockerfile.gst-ros-bridge + command: > + /bin/bash -c 'source /ros_ws/install/setup.bash && gst-launch-1.0 --gst-plugin-path=/ros_ws/install/gst_bridge/lib/gst_bridge/ + rtspsrc location="${CAMERA1_STREAM_IP}" latency=0 ! + rtph265depay ! h265parse ! avdec_h265 ! videoconvert ! + rosimagesink ros-topic="${CAMERA1_ROS_TOPIC}"' + environment: + - DISPLAY=${DISPLAY} + - DOCKER_BUILDKIT=0 + - CAMERA1_STREAM_IP=${CAMERA1_STREAM_IP} + - CAMERA1_ROS_TOPIC=${CAMERA1_ROS_TOPIC} + volumes: + - /tmp/.X11-unix:/tmp/.X11-unix + network_mode: host + + ####################### ROS2TAK TOOLS ###################### ############### MQTT for the GCS mqtt: @@ -74,7 +96,8 @@ services: dockerfile: docker/Dockerfile.ros2cot_agent args: - ROS_WS_DIR=${ROS_WS_DIR} - container_name: "${PROJECT_NAME}_ros2cot_agent" + image: "${PROJECT_NAME}/gcs/ros2cot_agent" + container_name: "${PROJECT_NAME}-ros2cot_agent" stdin_open: true tty: true restart: unless-stopped @@ -98,7 +121,8 @@ services: dockerfile: docker/Dockerfile.tak_publisher args: - ROS_WS_DIR=${ROS_WS_DIR} - container_name: "${PROJECT_NAME}_tak_publisher" + image: "${PROJECT_NAME}/gcs/tak_publisher" + container_name: "${PROJECT_NAME}-tak_publisher" stdin_open: true tty: true restart: unless-stopped @@ -123,7 +147,8 @@ services: dockerfile: docker/Dockerfile.tak_subscriber args: - ROS_WS_DIR=${ROS_WS_DIR} - container_name: "${PROJECT_NAME}_tak_subscriber" + image: "${PROJECT_NAME}/gcs/tak_subscriber" + container_name: "${PROJECT_NAME}-tak_subscriber" stdin_open: true tty: true restart: unless-stopped @@ -149,7 +174,8 @@ services: dockerfile: ground_control_station/docker/Dockerfile.cot2planner_agent args: - ROS_WS_DIR=${ROS_WS_DIR} - container_name: "${PROJECT_NAME}_cot2planner_agent" + image: "${PROJECT_NAME}/gcs/cot2planner_agent" + container_name: "${PROJECT_NAME}-cot2planner_agent" stdin_open: true tty: true restart: unless-stopped diff --git a/ground_control_station/docker/resources/fastrtps-profile.xml b/ground_control_station/docker/resources/fastrtps-profile.xml new file mode 100644 index 000000000..edacf5020 --- /dev/null +++ b/ground_control_station/docker/resources/fastrtps-profile.xml @@ -0,0 +1,19 @@ + + + + + CustomUdpTransport + UDPv4 + + + + + + + CustomUdpTransport + + + false + + +