Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev tak #176

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion common/ros_packages/airstack_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ endif()
find_package(ament_cmake REQUIRED)
find_package(std_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(diagnostic_msgs REQUIRED)
find_package(rosidl_default_generators REQUIRED)

Expand All @@ -22,10 +23,11 @@ rosidl_generate_interfaces(${PROJECT_NAME}
"msg/BeliefMapData.msg"
"msg/SearchPrior.msg"
"msg/TaskAssignment.msg"
"msg/query/TextQueryResponse.msg"
"srv/RobotCommand.srv"
"srv/TrajectoryMode.srv"
"srv/TakeoffLandingCommand.srv"
DEPENDENCIES std_msgs geometry_msgs diagnostic_msgs
DEPENDENCIES std_msgs geometry_msgs sensor_msgs diagnostic_msgs
)

if(BUILD_TESTING)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This message type is used for the response of a text query from a robot semantic query

std_msgs/Header header # Header for the message, usually contains timestamp and frame_id
string tag_name # The tag associated with the query or response
sensor_msgs/NavSatFix[] geofence # Array of GPS fixes (NavSatFix) representing the geofence
5 changes: 3 additions & 2 deletions common/ros_packages/airstack_msgs/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
<depend>std_msgs</depend>
<depend>geometry_msgs</depend>
<depend>diagnostic_msgs</depend>

<depend>sensor_msgs</depend>

<buildtool_depend>rosidl_default_generators</buildtool_depend>
<exec_depend>rosidl_default_runtime</exec_depend>
<member_of_group>rosidl_interface_packages</member_of_group>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

Expand Down
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
Loading
Loading