Skip to content

Commit

Permalink
Add ROS2 casevac and chat agent support; refactor ros2tak_tools.
Browse files Browse the repository at this point in the history
Introduced ROS2 casevac and chat agents to facilitate case evacuation and ROS-chat integration. Updated existing configurations, refactored ros2tak_tools, and added appropriate Dockerfile and Python classes. Removed deprecated setup.cfg and package.xml to improve the project structure.
  • Loading branch information
adityarauniyar committed Dec 10, 2024
1 parent 837abc2 commit d81a37d
Show file tree
Hide file tree
Showing 23 changed files with 1,788 additions and 76 deletions.
6 changes: 6 additions & 0 deletions ground_control_station/docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ TAK_SUBSCRIBER_FILEPATH=src/ros2tak_tools/scripts/tak_subscriber.py
MQTT_USERNAME= # Enter the MQTT username
MQTT_PASSWORD= # Enter the MQTT password

# Chat interface configuration -----------------------------------------
AI_AGENT_NAME=aerolens.ai (BOT)

# GSTREAMER TO ROS NODES -----------------------------------------------

Expand All @@ -30,3 +32,7 @@ CAMERA1_ROS_TOPIC=/view1/image_raw
# CAMERA 2
CAMERA2_STREAM_IP=rtsp://
CAMERA2_ROS_TOPIC=/view2/image_raw


# ROS VARIABLES -------------------------------------------------------
ROS_DOMAIN_ID=200
37 changes: 37 additions & 0 deletions ground_control_station/docker/Dockerfile.ros2casevac_agent
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Use the official ROS 2 Humble base image
FROM ros:humble

ARG ROS_WS_DIR

# Set working directory
WORKDIR ${ROS_WS_DIR}

# Update and install necessary dependencies
RUN apt-get update && apt-get install -y \
python3-pip \
ros-humble-rosbag2 \
ros-humble-rosbag2-storage-mcap \
python3-colcon-common-extensions \
&& rm -rf /var/lib/apt/lists/*

# Upgrade pip and install Python dependencies
RUN pip3 install --upgrade pip \
&& pip3 install setuptools==57.5.0 pytak pyyaml \
&& pip3 install paho-mqtt

# Source ROS 2 setup file to ensure environment variables are set
# You may want to add this to ENTRYPOINT or CMD if you're working interactively
RUN echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc

# COPY the agent code into the container
COPY ground_control_station/ros_ws/src/ros2tak_tools ${ROS_WS_DIR}/src/ros2tak_tools
COPY common/ros_packages/straps_msgs ${ROS_WS_DIR}/src/straps_msgs

# Build the ROS 2 workspace
RUN /bin/bash -c "source /opt/ros/humble/setup.bash && \
colcon build --symlink-install --packages-select straps_msgs && \
colcon build --symlink-install"

# Source the workspace setup file to ensure environment variables are set
RUN echo "source ${ROS_WS_DIR}/install/setup.bash" >> ~/.bashrc

182 changes: 182 additions & 0 deletions ground_control_station/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,185 @@ services:
- ../../common/ros_packages:/root/ros_ws/src/common:rw # common ROS packages
- ../ros_ws:/root/ros_ws:rw # gcs-specific ROS packages
- ../../common/ros_packages/fastdds.xml:/root/ros_ws/fastdds.xml:rw # fastdds.xml


####################### 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:
container_name: "mqtt"
image: eclipse-mosquitto:2.0.20
restart: always
volumes:
- ../ros_ws/src/ros2tak_tools/mosquitto/config:/mosquitto/config
- ../ros_ws/src/ros2tak_tools/mosquitto/data:/mosquitto/data
- ../ros_ws/src/ros2tak_tools/mosquitto/log:/mosquitto/log
env_file:
- .env
ports:
- "1883:1883"
healthcheck:
test: [ "CMD", "mosquitto_pub", "-h", "localhost", "-t", "healthcheck", "-m", "ping", "-u", "${MQTT_USERNAME}", "-P", "${MQTT_PASSWORD}" ]
interval: 5s
timeout: 3s
retries: 2
start_period: 5s
# network_mode: host
networks:
- airstack_network
################## ROS2COT_AGENT
ros2cot_agent:
build:
context: ../
dockerfile: docker/Dockerfile.ros2tak_tools
args:
- ROS_WS_DIR=${ROS_WS_DIR}
image: "${PROJECT_NAME}/gcs/ros2cot_agent"
container_name: "${PROJECT_NAME}-ros2cot_agent"
stdin_open: true
tty: true
restart: unless-stopped
environment:
- ROS_DOMAIN_ID=${ROS_DOMAIN_ID}
depends_on:
mqtt:
condition: service_healthy
# network_mode: host
networks:
- airstack_network
command: [ "/bin/bash", "-c", "source /opt/ros/humble/setup.bash && source $ROS_WS_DIR/install/setup.bash && ./install/ros2tak_tools/bin/ros2cot_agent --config $ROS_WS_DIR/$ROS2TAK_TOOLS_CONFIG_DIR/$ROS2TAK_TOOLS_CONFIG_FILENAME" ]

# ################### TAK_PUBLISHER
tak_publisher:
build:
context: ../
dockerfile: docker/Dockerfile.tak_publisher
args:
- ROS_WS_DIR=${ROS_WS_DIR}
image: "${PROJECT_NAME}/gcs/tak_publisher"
container_name: "${PROJECT_NAME}-tak_publisher"
stdin_open: true
tty: true
restart: unless-stopped
depends_on:
mqtt:
condition: service_healthy
# network_mode: host
networks:
- airstack_network
volumes:
- ../ros_ws/src/ros2tak_tools/:${ROS_WS_DIR}/src/ros2tak_tools/
command: [ "python3", "$TAK_PUBLISHER_FILEPATH", "--config", "$ROS2TAK_TOOLS_CONFIG_DIR/$ROS2TAK_TOOLS_CONFIG_FILENAME" ]
################### TAK_SUBSCRIBER
tak_subscriber:
build:
context: ../
dockerfile: docker/Dockerfile.tak_subscriber
args:
- ROS_WS_DIR=${ROS_WS_DIR}
image: "${PROJECT_NAME}/gcs/tak_subscriber"
container_name: "${PROJECT_NAME}-tak_subscriber"
stdin_open: true
tty: true
restart: unless-stopped
depends_on:
mqtt:
condition: service_healthy
networks:
- airstack_network
volumes:
- ../ros_ws/src/ros2tak_tools/:${ROS_WS_DIR}/src/ros2tak_tools/
command: [ "python3", "$TAK_SUBSCRIBER_FILEPATH", "--config", "$ROS2TAK_TOOLS_CONFIG_DIR/$ROS2TAK_TOOLS_CONFIG_FILENAME" ]

################## ROS2COT_AGENT
cot2planner_agent:
build:
context: ../../
dockerfile: ground_control_station/docker/Dockerfile.TAK
args:
- ROS_WS_DIR=${ROS_WS_DIR}
image: "${PROJECT_NAME}/gcs/cot2planner_agent"
container_name: "${PROJECT_NAME}-cot2planner_agent"
stdin_open: true
tty: true
restart: unless-stopped
depends_on:
mqtt:
condition: service_healthy
networks:
- airstack_network
command: [ "/bin/bash", "-c", "source /opt/ros/humble/setup.bash && source $ROS_WS_DIR/install/setup.bash && ./install/ros2tak_tools/bin/cot2planner_agent --config $ROS_WS_DIR/$ROS2TAK_TOOLS_CONFIG_DIR/$ROS2TAK_TOOLS_CONFIG_FILENAME" ]

# ################## ROS2COT_AGENT
ros2casevac_agent:
build:
context: ../../
dockerfile: ground_control_station/docker/Dockerfile.ros2casevac_agent
args:
- ROS_WS_DIR=${ROS_WS_DIR}
image: "${PROJECT_NAME}/gcs/ros2casevac_agent"
container_name: "${PROJECT_NAME}-ros2casevac_agent"
stdin_open: true
tty: true
restart: unless-stopped
depends_on:
mqtt:
condition: service_healthy
environment:
- ROS_WS_DIR=${ROS_WS_DIR}
- ROS_DOMAIN_ID=${ROS_DOMAIN_ID}
working_dir: $ROS_WS_DIR
# network_mode: host
networks:
- airstack_network
command: [ "/bin/bash", "-c", "source /opt/ros/humble/setup.bash && source $ROS_WS_DIR/install/setup.bash && ./install/ros2tak_tools/bin/ros2casevac_agent --config $ROS_WS_DIR/$ROS2TAK_TOOLS_CONFIG_DIR/$ROS2TAK_TOOLS_CONFIG_FILENAME" ]

# ################## GCS_AI_AGENT
gcs_ai_agent:
build:
context: ../../
dockerfile: ground_control_station/docker/Dockerfile.TAK
args:
- ROS_WS_DIR=${ROS_WS_DIR}
image: "${PROJECT_NAME}/gcs/gcs_ai_agent"
container_name: "${PROJECT_NAME}-gcs_ai_agent"
stdin_open: true
tty: true
restart: unless-stopped
environment:
- ROS_DOMAIN_ID=${ROS_DOMAIN_ID}
- AI_AGENT_NAME=${AI_AGENT_NAME}
- PROJECT_NAME=${PROJECT_NAME}
depends_on:
mqtt:
condition: service_healthy
# network_mode: host
networks:
- airstack_network
command: [ "/bin/bash", "-c", "source /opt/ros/humble/setup.bash && source $ROS_WS_DIR/install/setup.bash && ./install/ros2tak_tools/bin/chat2ros_agent --config $ROS_WS_DIR/$ROS2TAK_TOOLS_CONFIG_DIR/$ROS2TAK_TOOLS_CONFIG_FILENAME" ]


########### NETWORKS ###########
networks:
airstack_network:
driver: bridge
57 changes: 37 additions & 20 deletions ground_control_station/ros_ws/src/ros2tak_tools/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,29 +72,46 @@ services:
# TAK_Subscriber (below) service has more information on the ROS topics.
topic_name: planner_events # Topic name at MQTT for the subscriber service that sends COT messages subscribed from the TAK server.

chat2ros_agent:
mqtt_subcribe_topic: dsta-operator # Topic name at MQTT for the subscriber service that sends COT messages subscribed from the TAK server.
ros_query_text_topic: '/query/text' # ROS Topic name to publish the chat queries.
ros_query_response_topic: '/query/response' # ROS Topic name to publish the chat responses.
filter_name: dsta-operator

ros2casevac_agent:
# this service is used to generate ROS messages from HOSTIP:PORT to ROS topics.
# TAK_Subscriber (below) service has more information on the ROS topics.
topic_name: to_tak # MQTT topic name to send the COT messages to.
ros_casualty_meta_topic_name: '/casualty/meta' # ROS Topic name to publish the casevac messages.
ros_casualty_image_topic_name: '/casualty/image' # ROS message type for the casevac messages.

subscriber:
tak_subscriber:
# this service is used to subscribe to CoT messages from TAK server and send them to HOSTIP:PORT.
filter_messages: # Type of messages to subscribe to. Options:
- name: 'target'
# ROS Topic name to publish the target messages. Use {n} as a placeholder for the robot number.
# If provided, the topic name will be formatted with the robot number extracted from the message name.
ros_topic_name: '/target{n}/gps/gt'
ros_msg_type: NavSatFix # ROS message type for the target messages.
mqtt_topic_name: target_from_tak # Topic name at MQTT for the subscriber service that sends COT messages subscribed from the TAK server.
- name: 'iphone'
# ROS Topic name to publish the target messages. Use {n} as a placeholder for the robot number.
# If provided, the topic name will be formatted with the robot number extracted from the message name.
ros_topic_name: '/iphone{n}/gps/gt'
ros_msg_type: NavSatFix # ROS message type for the target messages.
mqtt_topic_name: iphone_from_tak # Topic name at MQTT for the subscriber service that sends COT messages subscribed from the TAK server.
- name: 'base'
ros_topic_name: '/basestation/gps'
ros_msg_type: NavSatFix # ROS message type for the target messages.
mqtt_topic_name: base_from_tak # Topic name at MQTT for the subscriber service that sends COT messages subscribed from the TAK server.
- name: 'planner'
ros_topic_name: '/planner/planconfig' # ROS Topic name to publish the shapes messages.
ros_msg_type: MarkerArray # ROS message type for the shapes messages.
mqtt_topic_name: planner_events # Topic name at MQTT for the subscriber service that sends COT messages subscribed from the TAK server.
- name: 'target'
# ROS Topic name to publish the target messages. Use {n} as a placeholder for the robot number.
# If provided, the topic name will be formatted with the robot number extracted from the message name.
ros_topic_name: '/target{n}/gps/gt'
ros_msg_type: NavSatFix # ROS message type for the target messages.
mqtt_topic_name: target_from_tak # Topic name at MQTT for the subscriber service that sends COT messages subscribed from the TAK server.
- name: 'iphone'
# ROS Topic name to publish the target messages. Use {n} as a placeholder for the robot number.
# If provided, the topic name will be formatted with the robot number extracted from the message name.
ros_topic_name: '/iphone{n}/gps/gt'
ros_msg_type: NavSatFix # ROS message type for the target messages.
mqtt_topic_name: iphone_from_tak # Topic name at MQTT for the subscriber service that sends COT messages subscribed from the TAK server.
- name: 'base'
ros_topic_name: '/basestation/gps'
ros_msg_type: NavSatFix # ROS message type for the target messages.
mqtt_topic_name: base_from_tak # Topic name at MQTT for the subscriber service that sends COT messages subscribed from the TAK server.
- name: 'planner'
ros_topic_name: '/planner/planconfig' # ROS Topic name to publish the shapes messages.
ros_msg_type: MarkerArray # ROS message type for the shapes messages.
mqtt_topic_name: dsta-operator # Topic name at MQTT for the subscriber service that sends COT messages subscribed from the TAK server.
- name: 'dsta-operator'
ros_topic_name: 'NA' # ROS Topic name to publish the shapes messages.
ros_msg_type: NA # ROS message type for the shapes messages.
mqtt_topic_name: dsta-operator # Topic name at MQTT for the subscriber service that sends COT messages subscribed from the TAK server.
# target: Target messages
# planner: Planner messages
25 changes: 0 additions & 25 deletions ground_control_station/ros_ws/src/ros2tak_tools/package.xml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Metadata-Version: 2.1
Name: ros2tak_tools
Version: 0.0.0
Summary: TODO: Package description
Maintainer: mission-operator
Maintainer-email: [email protected]
License: TODO: License declaration
Requires-Dist: setuptools
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
README.md
package.xml
setup.py
resource/ros2tak_tools
ros2tak_tools/Casualty.py
ros2tak_tools/__init__.py
ros2tak_tools/chat2ros_agent.py
ros2tak_tools/cot2planner_agent.py
ros2tak_tools/ros2casevac_agent.py
ros2tak_tools/ros2cot_agent.py
ros2tak_tools.egg-info/PKG-INFO
ros2tak_tools.egg-info/SOURCES.txt
ros2tak_tools.egg-info/dependency_links.txt
ros2tak_tools.egg-info/entry_points.txt
ros2tak_tools.egg-info/requires.txt
ros2tak_tools.egg-info/top_level.txt
ros2tak_tools.egg-info/zip-safe
tak_helper/__init__.py
tak_helper/create_cot_msgs.py
tak_helper/tak_publisher.py
tak_helper/tak_subscriber.py
test/test_copyright.py
test/test_flake8.py
test/test_pep257.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[console_scripts]
chat2ros_agent = ros2tak_tools.chat2ros_agent:main
cot2planner_agent = ros2tak_tools.cot2planner_agent:main
cot2ros_agent = ros2tak_tools.cot2ros_agent:main
ros2casevac_agent = ros2tak_tools.ros2casevac_agent:main
ros2cot_agent = ros2tak_tools.ros2cot_agent:main
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setuptools
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ros2tak_tools
tak_helper
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading

0 comments on commit d81a37d

Please sign in to comment.