From e6d8d5832a346bb348016c16426da36935287d53 Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Wed, 16 Oct 2024 01:51:12 +0000 Subject: [PATCH 1/4] fixes to watod and tfs --- src/gazebo/launch/env.urdf | 139 +++++++++++++++----------------- src/gazebo/launch/sim.launch.py | 2 +- watod | 2 +- 3 files changed, 69 insertions(+), 74 deletions(-) diff --git a/src/gazebo/launch/env.urdf b/src/gazebo/launch/env.urdf index 758d43b..bb09ed5 100644 --- a/src/gazebo/launch/env.urdf +++ b/src/gazebo/launch/env.urdf @@ -1,29 +1,28 @@ - - - - - - - 0.0 0.0 1.0 1 - 0.0 0.0 1.0 1 - 0.0 0.0 1.0 1 - - - - - - - - - + + + + + - - - - - + + + + + + + 0.0 0.0 1.0 1 + 0.0 0.0 1.0 1 + 0.0 0.0 1.0 1 + + + + + + + + @@ -38,12 +37,11 @@ - - - - - - + + + + + @@ -57,12 +55,12 @@ - - - - - + + + + + @@ -77,11 +75,11 @@ - - - - - + + + + + @@ -96,11 +94,11 @@ - - - - - + + + + + @@ -115,11 +113,11 @@ - - - - - + + + + + @@ -132,15 +130,13 @@ 0.0 0.0 1.0 1 - - - - - - - + + + + + @@ -154,13 +150,12 @@ - - - - - - + + + + + @@ -175,11 +170,11 @@ - - - - - + + + + + @@ -194,11 +189,11 @@ - - - - - + + + + + diff --git a/src/gazebo/launch/sim.launch.py b/src/gazebo/launch/sim.launch.py index 36409c1..a0ffc42 100644 --- a/src/gazebo/launch/sim.launch.py +++ b/src/gazebo/launch/sim.launch.py @@ -32,7 +32,7 @@ def generate_launch_description(): output='screen', remappings=[ ('/model/robot/pose', '/tf'), - ('/model/robot/pose_static', '/tf') + ('/model/robot/pose_static', '/tf_static') ] ) diff --git a/watod b/watod index add498a..f4fa0b9 100755 --- a/watod +++ b/watod @@ -37,7 +37,7 @@ function run_compose { PROFILES="$(source $PROFILES_DIR/.env && printf -- "-f profiles/docker-compose.%s.yaml " ${ACTIVE_PROFILES[@]})" fi - DOCKER_BUILDKIT=${DOCKER_BUILDKIT:-1} docker-compose ${PROFILES[@]} "$@" + DOCKER_BUILDKIT=${DOCKER_BUILDKIT:-1} docker compose ${PROFILES[@]} "$@" } # in case you need help From 1e4e37dc7452bb8477c14dfaebee0037ebdeb18b Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Wed, 16 Oct 2024 21:55:08 +0000 Subject: [PATCH 2/4] packaging gazebo and updating dockerfiles --- .vscode/settings.json | 3 + .../wato_asd_training_foxglove_config .json | 2 +- docker/.bashrc | 9 - docker/gazebo/gazeboserver.Dockerfile | 59 +- .../vis_tools/foxglove.Dockerfile | 38 - docker/robot/control.Dockerfile | 30 - docker/robot/nav.Dockerfile | 30 - docker/robot/occupancy.Dockerfile | 30 - docker/robot/robot.Dockerfile | 51 ++ docker/ros_entrypoint.sh | 7 - docker/samples/cpp/aggregator.Dockerfile | 30 - docker/samples/cpp/producer.Dockerfile | 30 - docker/samples/cpp/transformer.Dockerfile | 30 - docker/samples/cpp_aggregator.Dockerfile | 49 ++ docker/samples/cpp_producer.Dockerfile | 49 ++ docker/samples/cpp_transformer.Dockerfile | 49 ++ docker/samples/py_aggregator.Dockerfile | 49 ++ docker/samples/py_producer.Dockerfile | 49 ++ docker/samples/py_transformer.Dockerfile | 49 ++ docker/samples/python/aggregator.Dockerfile | 30 - docker/samples/python/producer.Dockerfile | 29 - docker/samples/python/transformer.Dockerfile | 31 - docker/vis_tools/foxglove.Dockerfile | 64 ++ docker/wato_ros_entrypoint.sh | 5 +- .../docker-compose.gazebo.yaml | 1 + modules/docker-compose.robot.yaml | 21 + .../docker-compose.samples.yaml | 12 - .../docker-compose.vis_tools.yaml | 2 +- profiles/docker-compose.robot.yaml | 40 - profiles/seccomp_profile.json | 830 ------------------ src/gazebo/CMakeLists.txt | 9 + src/gazebo/launch/sim.ign | 6 - src/gazebo/launch/sim.launch.py | 8 +- src/gazebo/package.xml | 15 + src/robot/bringup_robot/CMakeLists.txt | 9 + .../bringup_robot/launch/robot.launch.py | 72 ++ src/robot/bringup_robot/package.xml | 19 + src/robot/control/CMakeLists.txt | 7 - src/robot/control/launch/control.launch.py | 20 - src/robot/control/package.xml | 1 - .../{occupancy => costmap}/CMakeLists.txt | 24 +- .../include/costmap_core.hpp} | 8 +- src/robot/costmap/include/costmap_node.hpp | 19 + src/robot/{occupancy => costmap}/package.xml | 3 +- src/robot/costmap/src/costmap_core.cpp | 8 + src/robot/costmap/src/costmap_node.cpp | 16 + src/robot/nav/CMakeLists.txt | 8 +- src/robot/nav/launch/nav.launch.py | 20 - src/robot/nav/package.xml | 1 - .../occupancy/include/occupancy_node.hpp | 19 - .../occupancy/launch/aggregator.launch.py | 20 - .../occupancy/launch/occupancy.launch.py | 20 - src/robot/occupancy/src/occupancy_core.cpp | 8 - src/robot/occupancy/src/occupancy_node.cpp | 16 - src/samples/sample_msgs/CMakeLists.txt | 26 + src/samples/sample_msgs/msg/Filtered.msg | 5 + src/samples/sample_msgs/msg/FilteredArray.msg | 1 + src/samples/sample_msgs/msg/Metadata.msg | 7 + src/samples/sample_msgs/msg/Unfiltered.msg | 3 + src/samples/sample_msgs/package.xml | 20 + watod | 134 +-- watod-config.sh | 29 +- watod_scripts/watod-completion.bash | 677 ++++++++++++++ {scripts => watod_scripts}/watod-setup-env.sh | 74 +- 64 files changed, 1491 insertions(+), 1549 deletions(-) create mode 100644 .vscode/settings.json delete mode 100755 docker/.bashrc delete mode 100644 docker/infrastructure/vis_tools/foxglove.Dockerfile delete mode 100644 docker/robot/control.Dockerfile delete mode 100644 docker/robot/nav.Dockerfile delete mode 100644 docker/robot/occupancy.Dockerfile create mode 100644 docker/robot/robot.Dockerfile delete mode 100755 docker/ros_entrypoint.sh delete mode 100644 docker/samples/cpp/aggregator.Dockerfile delete mode 100644 docker/samples/cpp/producer.Dockerfile delete mode 100644 docker/samples/cpp/transformer.Dockerfile create mode 100644 docker/samples/cpp_aggregator.Dockerfile create mode 100644 docker/samples/cpp_producer.Dockerfile create mode 100644 docker/samples/cpp_transformer.Dockerfile create mode 100644 docker/samples/py_aggregator.Dockerfile create mode 100644 docker/samples/py_producer.Dockerfile create mode 100644 docker/samples/py_transformer.Dockerfile delete mode 100644 docker/samples/python/aggregator.Dockerfile delete mode 100644 docker/samples/python/producer.Dockerfile delete mode 100644 docker/samples/python/transformer.Dockerfile create mode 100644 docker/vis_tools/foxglove.Dockerfile rename {profiles => modules}/docker-compose.gazebo.yaml (90%) create mode 100644 modules/docker-compose.robot.yaml rename {profiles => modules}/docker-compose.samples.yaml (84%) rename {profiles => modules}/docker-compose.vis_tools.yaml (91%) delete mode 100644 profiles/docker-compose.robot.yaml delete mode 100644 profiles/seccomp_profile.json create mode 100644 src/gazebo/CMakeLists.txt create mode 100644 src/gazebo/package.xml create mode 100644 src/robot/bringup_robot/CMakeLists.txt create mode 100644 src/robot/bringup_robot/launch/robot.launch.py create mode 100644 src/robot/bringup_robot/package.xml delete mode 100755 src/robot/control/launch/control.launch.py rename src/robot/{occupancy => costmap}/CMakeLists.txt (63%) rename src/robot/{occupancy/include/occupancy_core.hpp => costmap/include/costmap_core.hpp} (65%) create mode 100644 src/robot/costmap/include/costmap_node.hpp rename src/robot/{occupancy => costmap}/package.xml (92%) create mode 100644 src/robot/costmap/src/costmap_core.cpp create mode 100644 src/robot/costmap/src/costmap_node.cpp delete mode 100755 src/robot/nav/launch/nav.launch.py delete mode 100644 src/robot/occupancy/include/occupancy_node.hpp delete mode 100644 src/robot/occupancy/launch/aggregator.launch.py delete mode 100755 src/robot/occupancy/launch/occupancy.launch.py delete mode 100644 src/robot/occupancy/src/occupancy_core.cpp delete mode 100644 src/robot/occupancy/src/occupancy_node.cpp create mode 100644 src/samples/sample_msgs/CMakeLists.txt create mode 100644 src/samples/sample_msgs/msg/Filtered.msg create mode 100644 src/samples/sample_msgs/msg/FilteredArray.msg create mode 100644 src/samples/sample_msgs/msg/Metadata.msg create mode 100644 src/samples/sample_msgs/msg/Unfiltered.msg create mode 100644 src/samples/sample_msgs/package.xml create mode 100644 watod_scripts/watod-completion.bash rename {scripts => watod_scripts}/watod-setup-env.sh (64%) mode change 100755 => 100644 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..9ddf6b2 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cmake.ignoreCMakeListsMissing": true +} \ No newline at end of file diff --git a/config/wato_asd_training_foxglove_config .json b/config/wato_asd_training_foxglove_config .json index 4964140..12dfa19 100644 --- a/config/wato_asd_training_foxglove_config .json +++ b/config/wato_asd_training_foxglove_config .json @@ -95,7 +95,7 @@ "/camera": { "visible": false }, - "/occupancy": { + "/costmap": { "visible": false, "colorMode": "costmap" }, diff --git a/docker/.bashrc b/docker/.bashrc deleted file mode 100755 index f201e0e..0000000 --- a/docker/.bashrc +++ /dev/null @@ -1,9 +0,0 @@ -# After building a ROS2 workspace certain environment variables need to -# be set to find packages and load libraries. This is accomplished by sourcing -# the generated setup file. To avoid manually running this command everytime a -# container is brought up, this command is automatically executed when the -# .bashrc is sourced. -source /root/ament_ws/install/setup.bash - -alias clw="rm -rf build/ && rm -rf install/" -alias dbd="colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo && source install/setup.bash" \ No newline at end of file diff --git a/docker/gazebo/gazeboserver.Dockerfile b/docker/gazebo/gazeboserver.Dockerfile index 3af8ebf..c5d3593 100644 --- a/docker/gazebo/gazeboserver.Dockerfile +++ b/docker/gazebo/gazeboserver.Dockerfile @@ -1,8 +1,22 @@ -# ================= Dependencies =================== -FROM ros:humble AS base +ARG BASE_IMAGE=ghcr.io/watonomous/base:humble-ubuntu22.04 -RUN apt-get update && apt-get install -y curl && \ - rm -rf /var/lib/apt/lists/* +################################ Source ################################ +FROM ${BASE_IMAGE} as source + +WORKDIR ${AMENT_WS}/src + +# Copy in source code +COPY src/gazebo gazebo + +# Scan for rosdeps +RUN apt-get -qq update && rosdep update && \ + rosdep install --from-paths . --ignore-src -r -s \ + | grep 'apt-get install' \ + | awk '{print $3}' \ + | sort > /tmp/colcon_install_list + +################################# Dependencies ################################ +FROM ${BASE_IMAGE} as dependencies # RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A4B469963BF863CC RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y @@ -15,24 +29,31 @@ RUN apt-get -y install ros-${ROS_DISTRO}-ros-gz ignition-fortress RUN apt-get -y install ros-humble-velodyne-gazebo-plugins RUN echo $GAZEBO_PLUGIN_PATH=/opt/ros/humble/lib -ENV DEBIAN_FRONTEND noninteractive -RUN sudo chsh -s /bin/bash -ENV SHELL=/bin/bash - -# ================= Repositories =================== -FROM base as repo +# Install Rosdep requirements +COPY --from=source /tmp/colcon_install_list /tmp/colcon_install_list +RUN apt-fast install -qq -y --no-install-recommends $(cat /tmp/colcon_install_list) -WORKDIR /root +# Copy in source code from source stage +WORKDIR ${AMENT_WS} +COPY --from=source ${AMENT_WS}/src src -ENV DEBIAN_FRONTEND interactive +# Dependency Cleanup +WORKDIR / +RUN apt-get -qq autoremove -y && apt-get -qq autoclean && apt-get -qq clean && \ + rm -rf /root/* /root/.ros /tmp/* /var/lib/apt/lists/* /usr/share/doc/* -COPY docker/wato_ros_entrypoint.sh /root/wato_ros_entrypoint.sh -COPY docker/ros_entrypoint.sh /root/ros_entrypoint.sh -COPY docker/.bashrc /root/.bashrc +################################ Build ################################ +FROM dependencies as build -ENTRYPOINT ["/root/ros_entrypoint.sh"] +# Build ROS2 packages +WORKDIR ${AMENT_WS} +RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ + colcon build \ + --cmake-args -DCMAKE_BUILD_TYPE=Release --install-base ${WATONOMOUS_INSTALL} -# CMD ["sleep", "infinity"] -# CMD ["ign", "launch", "launch/sim.ign"] +# Source and Build Artifact Cleanup +RUN rm -rf src/* build/* devel/* install/* log/* -CMD ["ros2", "launch", "src/gazebo/launch/sim.launch.py"] +# Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash +COPY docker/wato_ros_entrypoint.sh ${AMENT_WS}/wato_ros_entrypoint.sh +ENTRYPOINT ["./wato_ros_entrypoint.sh"] diff --git a/docker/infrastructure/vis_tools/foxglove.Dockerfile b/docker/infrastructure/vis_tools/foxglove.Dockerfile deleted file mode 100644 index a8fd44d..0000000 --- a/docker/infrastructure/vis_tools/foxglove.Dockerfile +++ /dev/null @@ -1,38 +0,0 @@ -# ================= Dependencies =================== -FROM ros:humble AS base - -RUN apt-get update && apt-get install -y curl ros-humble-ros2bag ros-humble-rosbag2* ros-humble-foxglove-msgs&& \ - rm -rf /var/lib/apt/lists/* - -# Set up apt repo -RUN apt-get update && apt-get install -y lsb-release software-properties-common apt-transport-https && \ - apt-add-repository universe - -# Install Dependencies -RUN apt-get update && \ - apt-get install -y \ - ros-$ROS_DISTRO-foxglove-bridge \ - ros-$ROS_DISTRO-rosbridge-server \ - ros-$ROS_DISTRO-topic-tools - -ENV DEBIAN_FRONTEND noninteractive -RUN sudo chsh -s /bin/bash -ENV SHELL=/bin/bash - -# ================= Repositories =================== -FROM base as repo - -RUN mkdir -p ~/ament_ws/src -WORKDIR /root/ament_ws/src - -WORKDIR /root/ament_ws -RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ - rosdep update && \ - rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y && \ - colcon build \ - --cmake-args -DCMAKE_BUILD_TYPE=Release - -# Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash -COPY docker/wato_ros_entrypoint.sh /root/wato_ros_entrypoint.sh -COPY docker/.bashrc /root/.bashrc -ENTRYPOINT ["/root/wato_ros_entrypoint.sh"] \ No newline at end of file diff --git a/docker/robot/control.Dockerfile b/docker/robot/control.Dockerfile deleted file mode 100644 index f38c7d9..0000000 --- a/docker/robot/control.Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -# ================= Dependencies =================== -FROM ros:humble AS base - -# ADD DEPENDENCIES HERE - -ENV DEBIAN_FRONTEND noninteractive -RUN sudo chsh -s /bin/bash -ENV SHELL=/bin/bash - -# ================= Repositories =================== -FROM base as repo - -RUN mkdir -p ~/ament_ws/src -WORKDIR /root/ament_ws/src - -COPY src/robot/control control -COPY src/wato_msgs/sample_msgs sample_msgs - -WORKDIR /root/ament_ws -RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ - rosdep update && \ - rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y && \ - colcon build \ - --cmake-args -DCMAKE_BUILD_TYPE=Release - -# Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash -COPY docker/wato_ros_entrypoint.sh /root/wato_ros_entrypoint.sh -COPY docker/.bashrc /root/.bashrc -ENTRYPOINT ["/root/wato_ros_entrypoint.sh"] -CMD ["ros2", "launch", "control", "control.launch.py"] diff --git a/docker/robot/nav.Dockerfile b/docker/robot/nav.Dockerfile deleted file mode 100644 index 4bbaba9..0000000 --- a/docker/robot/nav.Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -# ================= Dependencies =================== -FROM ros:humble AS base - -# ADD DEPENDENCIES HERE - -ENV DEBIAN_FRONTEND noninteractive -RUN sudo chsh -s /bin/bash -ENV SHELL=/bin/bash - -# ================= Repositories =================== -FROM base as repo - -RUN mkdir -p ~/ament_ws/src -WORKDIR /root/ament_ws/src - -COPY src/robot/nav nav -COPY src/wato_msgs/sample_msgs sample_msgs - -WORKDIR /root/ament_ws -RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ - rosdep update && \ - rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y && \ - colcon build \ - --cmake-args -DCMAKE_BUILD_TYPE=Release - -# Entrypoint will run before any CMD on launch. Sources ~/ament_ws/install/setup.bash -COPY docker/wato_ros_entrypoint.sh /root/wato_ros_entrypoint.sh -COPY docker/.bashrc /root/.bashrc -ENTRYPOINT ["/root/wato_ros_entrypoint.sh"] -CMD ["ros2", "launch", "nav", "nav.launch.py"] diff --git a/docker/robot/occupancy.Dockerfile b/docker/robot/occupancy.Dockerfile deleted file mode 100644 index 2a3d9d6..0000000 --- a/docker/robot/occupancy.Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -# ================= Dependencies =================== -FROM ros:humble AS base - -# ADD DEPENDENCIES HERE - -ENV DEBIAN_FRONTEND noninteractive -RUN sudo chsh -s /bin/bash -ENV SHELL=/bin/bash - -# ================= Repositories =================== -FROM base as repo - -RUN mkdir -p ~/ament_ws/src -WORKDIR /root/ament_ws/src - -COPY src/robot/occupancy occupancy -COPY src/wato_msgs/sample_msgs sample_msgs - -WORKDIR /root/ament_ws -RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ - rosdep update && \ - rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y && \ - colcon build \ - --cmake-args -DCMAKE_BUILD_TYPE=Release - -# Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash -COPY docker/wato_ros_entrypoint.sh /root/wato_ros_entrypoint.sh -COPY docker/.bashrc /root/.bashrc -ENTRYPOINT ["/root/wato_ros_entrypoint.sh"] -CMD ["ros2", "launch", "occupancy", "occupancy.launch.py"] diff --git a/docker/robot/robot.Dockerfile b/docker/robot/robot.Dockerfile new file mode 100644 index 0000000..e1b1d72 --- /dev/null +++ b/docker/robot/robot.Dockerfile @@ -0,0 +1,51 @@ +ARG BASE_IMAGE=ghcr.io/watonomous/robot_base/base:humble-ubuntu22.04 + +################################ Source ################################ +FROM ${BASE_IMAGE} as source + +WORKDIR ${AMENT_WS}/src + +# Copy in source code +COPY src/robot/costmap costmap +COPY src/robot/nav nav +COPY src/robot/control control +COPY src/robot/bringup_robot bringup_robot + +# Scan for rosdeps +RUN apt-get -qq update && rosdep update && \ + rosdep install --from-paths . --ignore-src -r -s \ + | grep 'apt-get install' \ + | awk '{print $3}' \ + | sort > /tmp/colcon_install_list + +################################# Dependencies ################################ +FROM ${BASE_IMAGE} as dependencies + +# Install Rosdep requirements +COPY --from=source /tmp/colcon_install_list /tmp/colcon_install_list +RUN apt-fast install -qq -y --no-install-recommends $(cat /tmp/colcon_install_list) + +# Copy in source code from source stage +WORKDIR ${AMENT_WS} +COPY --from=source ${AMENT_WS}/src src + +# Dependency Cleanup +WORKDIR / +RUN apt-get -qq autoremove -y && apt-get -qq autoclean && apt-get -qq clean && \ + rm -rf /root/* /root/.ros /tmp/* /var/lib/apt/lists/* /usr/share/doc/* + +################################ Build ################################ +FROM dependencies as build + +# Build ROS2 packages +WORKDIR ${AMENT_WS} +RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ + colcon build \ + --cmake-args -DCMAKE_BUILD_TYPE=Release --install-base ${WATONOMOUS_INSTALL} + +# Source and Build Artifact Cleanup +RUN rm -rf src/* build/* devel/* install/* log/* + +# Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash +COPY docker/wato_ros_entrypoint.sh ${AMENT_WS}/wato_ros_entrypoint.sh +ENTRYPOINT ["./wato_ros_entrypoint.sh"] diff --git a/docker/ros_entrypoint.sh b/docker/ros_entrypoint.sh deleted file mode 100755 index 46836eb..0000000 --- a/docker/ros_entrypoint.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -e - -# setup ROS2 environment -source /opt/ros/humble/setup.bash - -exec "$@" \ No newline at end of file diff --git a/docker/samples/cpp/aggregator.Dockerfile b/docker/samples/cpp/aggregator.Dockerfile deleted file mode 100644 index afa3f7c..0000000 --- a/docker/samples/cpp/aggregator.Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -# ================= Dependencies =================== -FROM ros:humble AS base - -# ADD DEPENDENCIES HERE - -ENV DEBIAN_FRONTEND noninteractive -RUN sudo chsh -s /bin/bash -ENV SHELL=/bin/bash - -# ================= Repositories =================== -FROM base as repo - -RUN mkdir -p ~/ament_ws/src -WORKDIR /root/ament_ws/src - -COPY src/samples/cpp/aggregator aggregator -COPY src/wato_msgs/sample_msgs sample_msgs - -WORKDIR /root/ament_ws -RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ - rosdep update && \ - rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y && \ - colcon build \ - --cmake-args -DCMAKE_BUILD_TYPE=Release - -# Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash -COPY docker/wato_ros_entrypoint.sh /root/wato_ros_entrypoint.sh -COPY docker/.bashrc /root/.bashrc -ENTRYPOINT ["/root/wato_ros_entrypoint.sh"] -CMD ["ros2", "launch", "aggregator", "aggregator.launch.py"] diff --git a/docker/samples/cpp/producer.Dockerfile b/docker/samples/cpp/producer.Dockerfile deleted file mode 100644 index 461287f..0000000 --- a/docker/samples/cpp/producer.Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -# ================= Dependencies =================== -FROM ros:humble AS base - -# ADD DEPENDENCIES HERE - -ENV DEBIAN_FRONTEND noninteractive -RUN sudo chsh -s /bin/bash -ENV SHELL=/bin/bash - -# ================= Repositories =================== -FROM base as repo - -RUN mkdir -p ~/ament_ws/src -WORKDIR /root/ament_ws/src - -COPY src/samples/cpp/producer producer -COPY src/wato_msgs/sample_msgs sample_msgs - -WORKDIR /root/ament_ws -RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ - rosdep update && \ - rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y && \ - colcon build \ - --cmake-args -DCMAKE_BUILD_TYPE=Release - -# Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash -COPY docker/wato_ros_entrypoint.sh /root/wato_ros_entrypoint.sh -COPY docker/.bashrc /root/.bashrc -ENTRYPOINT ["/root/wato_ros_entrypoint.sh"] -CMD ["ros2", "launch", "producer", "producer.launch.py"] diff --git a/docker/samples/cpp/transformer.Dockerfile b/docker/samples/cpp/transformer.Dockerfile deleted file mode 100644 index e6883e2..0000000 --- a/docker/samples/cpp/transformer.Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -# ================= Dependencies =================== -FROM ros:humble AS base - -# ADD DEPENDENCIES HERE - -ENV DEBIAN_FRONTEND noninteractive -RUN sudo chsh -s /bin/bash -ENV SHELL=/bin/bash - -# ================= Repositories =================== -FROM base as repo - -RUN mkdir -p ~/ament_ws/src -WORKDIR /root/ament_ws/src - -COPY src/samples/cpp/transformer transformer -COPY src/wato_msgs/sample_msgs sample_msgs - -WORKDIR /root/ament_ws -RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ - rosdep update && \ - rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y && \ - colcon build \ - --cmake-args -DCMAKE_BUILD_TYPE=Release - -# Entrypoint will run before any CMD on launch. Sources ~/ament_ws/install/setup.bash -COPY docker/wato_ros_entrypoint.sh /root/wato_ros_entrypoint.sh -COPY docker/.bashrc /root/.bashrc -ENTRYPOINT ["/root/wato_ros_entrypoint.sh"] -CMD ["ros2", "launch", "transformer", "transformer.launch.py"] \ No newline at end of file diff --git a/docker/samples/cpp_aggregator.Dockerfile b/docker/samples/cpp_aggregator.Dockerfile new file mode 100644 index 0000000..c27c9a8 --- /dev/null +++ b/docker/samples/cpp_aggregator.Dockerfile @@ -0,0 +1,49 @@ +ARG BASE_IMAGE=ghcr.io/watonomous/robot_base/base:humble-ubuntu22.04 + +################################ Source ################################ +FROM ${BASE_IMAGE} as source + +WORKDIR ${AMENT_WS}/src + +# Copy in source code +COPY src/samples/cpp/aggregator aggregator +COPY src/wato_msgs/sample_msgs sample_msgs + +# Scan for rosdeps +RUN apt-get -qq update && rosdep update && \ + rosdep install --from-paths . --ignore-src -r -s \ + | grep 'apt-get install' \ + | awk '{print $3}' \ + | sort > /tmp/colcon_install_list + +################################# Dependencies ################################ +FROM ${BASE_IMAGE} as dependencies + +# Install Rosdep requirements +COPY --from=source /tmp/colcon_install_list /tmp/colcon_install_list +RUN apt-fast install -qq -y --no-install-recommends $(cat /tmp/colcon_install_list) + +# Copy in source code from source stage +WORKDIR ${AMENT_WS} +COPY --from=source ${AMENT_WS}/src src + +# Dependency Cleanup +WORKDIR / +RUN apt-get -qq autoremove -y && apt-get -qq autoclean && apt-get -qq clean && \ + rm -rf /root/* /root/.ros /tmp/* /var/lib/apt/lists/* /usr/share/doc/* + +################################ Build ################################ +FROM dependencies as build + +# Build ROS2 packages +WORKDIR ${AMENT_WS} +RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ + colcon build \ + --cmake-args -DCMAKE_BUILD_TYPE=Release --install-base ${WATONOMOUS_INSTALL} + +# Source and Build Artifact Cleanup +RUN rm -rf src/* build/* devel/* install/* log/* + +# Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash +COPY docker/wato_ros_entrypoint.sh ${AMENT_WS}/wato_ros_entrypoint.sh +ENTRYPOINT ["./wato_ros_entrypoint.sh"] diff --git a/docker/samples/cpp_producer.Dockerfile b/docker/samples/cpp_producer.Dockerfile new file mode 100644 index 0000000..bfd56a6 --- /dev/null +++ b/docker/samples/cpp_producer.Dockerfile @@ -0,0 +1,49 @@ +ARG BASE_IMAGE=ghcr.io/watonomous/robot_base/base:humble-ubuntu22.04 + +################################ Source ################################ +FROM ${BASE_IMAGE} as source + +WORKDIR ${AMENT_WS}/src + +# Copy in source code +COPY src/samples/cpp/producer producer +COPY src/wato_msgs/sample_msgs sample_msgs + +# Scan for rosdeps +RUN apt-get -qq update && rosdep update && \ + rosdep install --from-paths . --ignore-src -r -s \ + | grep 'apt-get install' \ + | awk '{print $3}' \ + | sort > /tmp/colcon_install_list + +################################# Dependencies ################################ +FROM ${BASE_IMAGE} as dependencies + +# Install Rosdep requirements +COPY --from=source /tmp/colcon_install_list /tmp/colcon_install_list +RUN apt-fast install -qq -y --no-install-recommends $(cat /tmp/colcon_install_list) + +# Copy in source code from source stage +WORKDIR ${AMENT_WS} +COPY --from=source ${AMENT_WS}/src src + +# Dependency Cleanup +WORKDIR / +RUN apt-get -qq autoremove -y && apt-get -qq autoclean && apt-get -qq clean && \ + rm -rf /root/* /root/.ros /tmp/* /var/lib/apt/lists/* /usr/share/doc/* + +################################ Build ################################ +FROM dependencies as build + +# Build ROS2 packages +WORKDIR ${AMENT_WS} +RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ + colcon build \ + --cmake-args -DCMAKE_BUILD_TYPE=Release --install-base ${WATONOMOUS_INSTALL} + +# Source and Build Artifact Cleanup +RUN rm -rf src/* build/* devel/* install/* log/* + +# Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash +COPY docker/wato_ros_entrypoint.sh ${AMENT_WS}/wato_ros_entrypoint.sh +ENTRYPOINT ["./wato_ros_entrypoint.sh"] diff --git a/docker/samples/cpp_transformer.Dockerfile b/docker/samples/cpp_transformer.Dockerfile new file mode 100644 index 0000000..25ddf87 --- /dev/null +++ b/docker/samples/cpp_transformer.Dockerfile @@ -0,0 +1,49 @@ +ARG BASE_IMAGE=ghcr.io/watonomous/robot_base/base:humble-ubuntu22.04 + +################################ Source ################################ +FROM ${BASE_IMAGE} as source + +WORKDIR ${AMENT_WS}/src + +# Copy in source code +COPY src/samples/cpp/transformer transformer +COPY src/wato_msgs/sample_msgs sample_msgs + +# Scan for rosdeps +RUN apt-get -qq update && rosdep update && \ + rosdep install --from-paths . --ignore-src -r -s \ + | grep 'apt-get install' \ + | awk '{print $3}' \ + | sort > /tmp/colcon_install_list + +################################# Dependencies ################################ +FROM ${BASE_IMAGE} as dependencies + +# Install Rosdep requirements +COPY --from=source /tmp/colcon_install_list /tmp/colcon_install_list +RUN apt-fast install -qq -y --no-install-recommends $(cat /tmp/colcon_install_list) + +# Copy in source code from source stage +WORKDIR ${AMENT_WS} +COPY --from=source ${AMENT_WS}/src src + +# Dependency Cleanup +WORKDIR / +RUN apt-get -qq autoremove -y && apt-get -qq autoclean && apt-get -qq clean && \ + rm -rf /root/* /root/.ros /tmp/* /var/lib/apt/lists/* /usr/share/doc/* + +################################ Build ################################ +FROM dependencies as build + +# Build ROS2 packages +WORKDIR ${AMENT_WS} +RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ + colcon build \ + --cmake-args -DCMAKE_BUILD_TYPE=Release --install-base ${WATONOMOUS_INSTALL} + +# Source and Build Artifact Cleanup +RUN rm -rf src/* build/* devel/* install/* log/* + +# Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash +COPY docker/wato_ros_entrypoint.sh ${AMENT_WS}/wato_ros_entrypoint.sh +ENTRYPOINT ["./wato_ros_entrypoint.sh"] diff --git a/docker/samples/py_aggregator.Dockerfile b/docker/samples/py_aggregator.Dockerfile new file mode 100644 index 0000000..64d2d0a --- /dev/null +++ b/docker/samples/py_aggregator.Dockerfile @@ -0,0 +1,49 @@ +ARG BASE_IMAGE=ghcr.io/watonomous/robot_base/base:humble-ubuntu22.04 + +################################ Source ################################ +FROM ${BASE_IMAGE} as source + +WORKDIR ${AMENT_WS}/src + +# Copy in source code +COPY src/samples/python/aggregator aggregator +COPY src/wato_msgs/sample_msgs sample_msgs + +# Scan for rosdeps +RUN apt-get -qq update && rosdep update && \ + rosdep install --from-paths . --ignore-src -r -s \ + | grep 'apt-get install' \ + | awk '{print $3}' \ + | sort > /tmp/colcon_install_list + +################################# Dependencies ################################ +FROM ${BASE_IMAGE} as dependencies + +# Install Rosdep requirements +COPY --from=source /tmp/colcon_install_list /tmp/colcon_install_list +RUN apt-fast install -qq -y --no-install-recommends $(cat /tmp/colcon_install_list) + +# Copy in source code from source stage +WORKDIR ${AMENT_WS} +COPY --from=source ${AMENT_WS}/src src + +# Dependency Cleanup +WORKDIR / +RUN apt-get -qq autoremove -y && apt-get -qq autoclean && apt-get -qq clean && \ + rm -rf /root/* /root/.ros /tmp/* /var/lib/apt/lists/* /usr/share/doc/* + +################################ Build ################################ +FROM dependencies as build + +# Build ROS2 packages +WORKDIR ${AMENT_WS} +RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ + colcon build \ + --cmake-args -DCMAKE_BUILD_TYPE=Release --install-base ${WATONOMOUS_INSTALL} + +# Source and Build Artifact Cleanup +RUN rm -rf src/* build/* devel/* install/* log/* + +# Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash +COPY docker/wato_ros_entrypoint.sh ${AMENT_WS}/wato_ros_entrypoint.sh +ENTRYPOINT ["./wato_ros_entrypoint.sh"] diff --git a/docker/samples/py_producer.Dockerfile b/docker/samples/py_producer.Dockerfile new file mode 100644 index 0000000..725f2e7 --- /dev/null +++ b/docker/samples/py_producer.Dockerfile @@ -0,0 +1,49 @@ +ARG BASE_IMAGE=ghcr.io/watonomous/robot_base/base:humble-ubuntu22.04 + +################################ Source ################################ +FROM ${BASE_IMAGE} as source + +WORKDIR ${AMENT_WS}/src + +# Copy in source code +COPY src/samples/python/producer producer +COPY src/wato_msgs/sample_msgs sample_msgs + +# Scan for rosdeps +RUN apt-get -qq update && rosdep update && \ + rosdep install --from-paths . --ignore-src -r -s \ + | grep 'apt-get install' \ + | awk '{print $3}' \ + | sort > /tmp/colcon_install_list + +################################# Dependencies ################################ +FROM ${BASE_IMAGE} as dependencies + +# Install Rosdep requirements +COPY --from=source /tmp/colcon_install_list /tmp/colcon_install_list +RUN apt-fast install -qq -y --no-install-recommends $(cat /tmp/colcon_install_list) + +# Copy in source code from source stage +WORKDIR ${AMENT_WS} +COPY --from=source ${AMENT_WS}/src src + +# Dependency Cleanup +WORKDIR / +RUN apt-get -qq autoremove -y && apt-get -qq autoclean && apt-get -qq clean && \ + rm -rf /root/* /root/.ros /tmp/* /var/lib/apt/lists/* /usr/share/doc/* + +################################ Build ################################ +FROM dependencies as build + +# Build ROS2 packages +WORKDIR ${AMENT_WS} +RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ + colcon build \ + --cmake-args -DCMAKE_BUILD_TYPE=Release --install-base ${WATONOMOUS_INSTALL} + +# Source and Build Artifact Cleanup +RUN rm -rf src/* build/* devel/* install/* log/* + +# Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash +COPY docker/wato_ros_entrypoint.sh ${AMENT_WS}/wato_ros_entrypoint.sh +ENTRYPOINT ["./wato_ros_entrypoint.sh"] diff --git a/docker/samples/py_transformer.Dockerfile b/docker/samples/py_transformer.Dockerfile new file mode 100644 index 0000000..2303ec7 --- /dev/null +++ b/docker/samples/py_transformer.Dockerfile @@ -0,0 +1,49 @@ +ARG BASE_IMAGE=ghcr.io/watonomous/robot_base/base:humble-ubuntu22.04 + +################################ Source ################################ +FROM ${BASE_IMAGE} as source + +WORKDIR ${AMENT_WS}/src + +# Copy in source code +COPY src/samples/python/transformer transformer +COPY src/wato_msgs/sample_msgs sample_msgs + +# Scan for rosdeps +RUN apt-get -qq update && rosdep update && \ + rosdep install --from-paths . --ignore-src -r -s \ + | grep 'apt-get install' \ + | awk '{print $3}' \ + | sort > /tmp/colcon_install_list + +################################# Dependencies ################################ +FROM ${BASE_IMAGE} as dependencies + +# Install Rosdep requirements +COPY --from=source /tmp/colcon_install_list /tmp/colcon_install_list +RUN apt-fast install -qq -y --no-install-recommends $(cat /tmp/colcon_install_list) + +# Copy in source code from source stage +WORKDIR ${AMENT_WS} +COPY --from=source ${AMENT_WS}/src src + +# Dependency Cleanup +WORKDIR / +RUN apt-get -qq autoremove -y && apt-get -qq autoclean && apt-get -qq clean && \ + rm -rf /root/* /root/.ros /tmp/* /var/lib/apt/lists/* /usr/share/doc/* + +################################ Build ################################ +FROM dependencies as build + +# Build ROS2 packages +WORKDIR ${AMENT_WS} +RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ + colcon build \ + --cmake-args -DCMAKE_BUILD_TYPE=Release --install-base ${WATONOMOUS_INSTALL} + +# Source and Build Artifact Cleanup +RUN rm -rf src/* build/* devel/* install/* log/* + +# Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash +COPY docker/wato_ros_entrypoint.sh ${AMENT_WS}/wato_ros_entrypoint.sh +ENTRYPOINT ["./wato_ros_entrypoint.sh"] diff --git a/docker/samples/python/aggregator.Dockerfile b/docker/samples/python/aggregator.Dockerfile deleted file mode 100644 index 79446b7..0000000 --- a/docker/samples/python/aggregator.Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -# ================= Dependencies =================== -FROM ros:humble AS base - -# ADD DEPENDENCIES HERE - -ENV DEBIAN_FRONTEND noninteractive -RUN sudo chsh -s /bin/bash -ENV SHELL=/bin/bash - -# ================= Repositories =================== -FROM base as repo - -RUN mkdir -p ~/ament_ws/src -WORKDIR /root/ament_ws/src - -COPY src/samples/python/aggregator aggregator -COPY src/wato_msgs/sample_msgs sample_msgs - -WORKDIR /root/ament_ws -RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ - rosdep update && \ - rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y && \ - colcon build \ - --cmake-args -DCMAKE_BUILD_TYPE=Release - -# Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash -COPY docker/wato_ros_entrypoint.sh /root/wato_ros_entrypoint.sh -COPY docker/.bashrc /root/.bashrc -ENTRYPOINT ["/root/wato_ros_entrypoint.sh"] -CMD ["ros2", "launch", "aggregator", "aggregator.launch.py"] diff --git a/docker/samples/python/producer.Dockerfile b/docker/samples/python/producer.Dockerfile deleted file mode 100644 index 9c19a17..0000000 --- a/docker/samples/python/producer.Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM ros:humble AS base - -# ADD DEPENDENCIES HERE - -ENV DEBIAN_FRONTEND noninteractive -RUN sudo chsh -s /bin/bash -ENV SHELL=/bin/bash - -# ================= Repositories =================== -FROM base as repo - -RUN mkdir -p ~/ament_ws/src -WORKDIR /root/ament_ws/src - -COPY src/samples/python/producer producer -COPY src/wato_msgs/sample_msgs sample_msgs - -WORKDIR /root/ament_ws -RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ - rosdep update && \ - rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y && \ - colcon build \ - --cmake-args -DCMAKE_BUILD_TYPE=Release - -# Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash -COPY docker/wato_ros_entrypoint.sh /root/wato_ros_entrypoint.sh -COPY docker/.bashrc /root/.bashrc -ENTRYPOINT ["/root/wato_ros_entrypoint.sh"] -CMD ["ros2", "launch", "producer", "producer.launch.py"] \ No newline at end of file diff --git a/docker/samples/python/transformer.Dockerfile b/docker/samples/python/transformer.Dockerfile deleted file mode 100644 index 5e5322c..0000000 --- a/docker/samples/python/transformer.Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ - -# ================= Dependencies =================== -FROM ros:humble AS base - -# ADD DEPENDENCIES HERE - -ENV DEBIAN_FRONTEND noninteractive -RUN sudo chsh -s /bin/bash -ENV SHELL=/bin/bash - -# ================= Repositories =================== -FROM base as repo - -RUN mkdir -p ~/ament_ws/src -WORKDIR /root/ament_ws/src - -COPY src/samples/python/transformer transformer -COPY src/wato_msgs/sample_msgs sample_msgs - -WORKDIR /root/ament_ws -RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ - rosdep update && \ - rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y && \ - colcon build \ - --cmake-args -DCMAKE_BUILD_TYPE=Release - -# Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash -COPY docker/wato_ros_entrypoint.sh /root/wato_ros_entrypoint.sh -COPY docker/.bashrc /root/.bashrc -ENTRYPOINT ["/root/wato_ros_entrypoint.sh"] -CMD ["ros2", "launch", "transformer", "transformer.launch.py"] \ No newline at end of file diff --git a/docker/vis_tools/foxglove.Dockerfile b/docker/vis_tools/foxglove.Dockerfile new file mode 100644 index 0000000..36ec593 --- /dev/null +++ b/docker/vis_tools/foxglove.Dockerfile @@ -0,0 +1,64 @@ +ARG BASE_IMAGE=ghcr.io/watonomous/robot_base/base:humble-ubuntu22.04 + +################################ Source ################################ +FROM ${BASE_IMAGE} as source + +WORKDIR ${AMENT_WS}/src + +# Copy in source code +COPY src/wato_msgs wato_msgs + +# Scan for rosdeps +RUN apt-get -qq update && rosdep update && \ + rosdep install --from-paths . --ignore-src -r -s \ + | grep 'apt-get install' \ + | awk '{print $3}' \ + | sort > /tmp/colcon_install_list + +################################# Dependencies ################################ +FROM ${BASE_IMAGE} as dependencies + +# Install Foxglove Deps +RUN apt-get update && apt-get install -y curl ros-humble-ros2bag ros-humble-rosbag2* ros-humble-foxglove-msgs&& \ + rm -rf /var/lib/apt/lists/* + +# Set up apt repo +RUN apt-get update && apt-get install -y lsb-release software-properties-common apt-transport-https && \ + apt-add-repository universe + +# Install Dependencies +RUN apt-get update && \ + apt-get install -y \ + ros-$ROS_DISTRO-foxglove-bridge \ + ros-$ROS_DISTRO-rosbridge-server \ + ros-$ROS_DISTRO-topic-tools \ + ros-$ROS_DISTRO-vision-msgs + +# Install Rosdep requirements +COPY --from=source /tmp/colcon_install_list /tmp/colcon_install_list +RUN apt-fast install -qq -y --no-install-recommends $(cat /tmp/colcon_install_list) + +# Copy in source code from source stage +WORKDIR ${AMENT_WS} +COPY --from=source ${AMENT_WS}/src src + +# Dependency Cleanup +WORKDIR / +RUN apt-get -qq autoremove -y && apt-get -qq autoclean && apt-get -qq clean && \ + rm -rf /root/* /root/.ros /tmp/* /var/lib/apt/lists/* /usr/share/doc/* + +################################ Build ################################ +FROM dependencies as build + +# Build ROS2 packages +WORKDIR ${AMENT_WS} +RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ + colcon build \ + --cmake-args -DCMAKE_BUILD_TYPE=Release --install-base ${WATONOMOUS_INSTALL} + +# Source and Build Artifact Cleanup +RUN rm -rf src/* build/* devel/* install/* log/* + +# Entrypoint will run before any CMD on launch. Sources ~/opt//setup.bash and ~/ament_ws/install/setup.bash +COPY docker/wato_ros_entrypoint.sh ${AMENT_WS}/wato_ros_entrypoint.sh +ENTRYPOINT ["./wato_ros_entrypoint.sh"] diff --git a/docker/wato_ros_entrypoint.sh b/docker/wato_ros_entrypoint.sh index f5e3e40..df53dae 100755 --- a/docker/wato_ros_entrypoint.sh +++ b/docker/wato_ros_entrypoint.sh @@ -2,6 +2,5 @@ set -e # setup ROS2 environment -source /root/ament_ws/install/setup.bash - -exec "$@" \ No newline at end of file +source /opt/watonomous/setup.bash +exec "$@" diff --git a/profiles/docker-compose.gazebo.yaml b/modules/docker-compose.gazebo.yaml similarity index 90% rename from profiles/docker-compose.gazebo.yaml rename to modules/docker-compose.gazebo.yaml index 7a5e99b..175bf25 100644 --- a/profiles/docker-compose.gazebo.yaml +++ b/modules/docker-compose.gazebo.yaml @@ -12,6 +12,7 @@ services: tty: true ports: - "${GAZEBO_PORT:?}:9002" + command: /bin/bash -c "ros2 launch gazebo sim.launch.py" volumes: - ../src/gazebo/launch:/root/src/gazebo/launch deploy: diff --git a/modules/docker-compose.robot.yaml b/modules/docker-compose.robot.yaml new file mode 100644 index 0000000..d05d5a8 --- /dev/null +++ b/modules/docker-compose.robot.yaml @@ -0,0 +1,21 @@ +version: "3.8" +services: + robot: + build: + context: .. + dockerfile: docker/robot/robot.Dockerfile + cache_from: + - "${ROBOT_COSTMAP_IMAGE:?}:${TAG}" + - "${ROBOT_COSTMAP_IMAGE:?}:main" + image: "${ROBOT_COSTMAP_IMAGE:?}:${TAG}" + command: /bin/bash -c "ros2 launch bringup_robot robot.launch.py" + + # robot_dev: + # extends: + # service: robot + # build: + # target: develop + # image: "${ROBOT_COSTMAP_IMAGE:?}:dev_${TAG}" + # command: tail -F anything + # volumes: + # - ${MONO_DIR}/src/robot:/root/ament_ws/src diff --git a/profiles/docker-compose.samples.yaml b/modules/docker-compose.samples.yaml similarity index 84% rename from profiles/docker-compose.samples.yaml rename to modules/docker-compose.samples.yaml index 45bb8b7..ed06ef6 100644 --- a/profiles/docker-compose.samples.yaml +++ b/modules/docker-compose.samples.yaml @@ -8,8 +8,6 @@ services: # - "${SAMPLES_CPP_AGGREGATOR_IMAGE:?}:${TAG}" # - "${SAMPLES_CPP_AGGREGATOR_IMAGE:?}:main" # image: "${SAMPLES_CPP_AGGREGATOR_IMAGE:?}:${TAG}" - # security_opt: - # - seccomp:${PROFILES_DIR}/seccomp_profile.json # volumes: # - ${MONO_DIR}/src/samples/cpp/aggregator:/root/ament_ws/src/aggregator @@ -21,8 +19,6 @@ services: - "${SAMPLES_PYTHON_AGGREGATOR_IMAGE:?}:${TAG}" - "${SAMPLES_PYTHON_AGGREGATOR_IMAGE:?}:main" image: "${SAMPLES_PYTHON_AGGREGATOR_IMAGE:?}:${TAG}" - security_opt: - - seccomp:${PROFILES_DIR}/seccomp_profile.json volumes: - ${MONO_DIR}/src/samples/python/aggregator:/root/ament_ws/src/aggregator @@ -34,8 +30,6 @@ services: - "${SAMPLES_CPP_PRODUCER_IMAGE:?}:${TAG}" - "${SAMPLES_CPP_PRODUCER_IMAGE:?}:main" image: "${SAMPLES_CPP_PRODUCER_IMAGE:?}:${TAG}" - security_opt: - - seccomp:${PROFILES_DIR}/seccomp_profile.json volumes: - ${MONO_DIR}/src/samples/cpp/producer:/root/ament_ws/src/producer @@ -47,8 +41,6 @@ services: # - "${SAMPLES_PYTHON_PRODUCER_IMAGE:?}:${TAG}" # - "${SAMPLES_PYTHON_PRODUCER_IMAGE:?}:main" # image: "${SAMPLES_PYTHON_PRODUCER_IMAGE:?}:${TAG}" - # security_opt: - # - seccomp:${PROFILES_DIR}/seccomp_profile.json # volumes: # - ${MONO_DIR}/src/samples/python/producer:/root/ament_ws/src/producer @@ -60,8 +52,6 @@ services: - "${SAMPLES_CPP_TRANSFORMER_IMAGE:?}:${TAG}" - "${SAMPLES_CPP_TRANSFORMER_IMAGE:?}:main" image: "${SAMPLES_CPP_TRANSFORMER_IMAGE:?}:${TAG}" - security_opt: - - seccomp:${PROFILES_DIR}/seccomp_profile.json volumes: - ${MONO_DIR}/src/samples/cpp/transformer:/root/ament_ws/src/transformer @@ -73,7 +63,5 @@ services: # - "${SAMPLES_PYTHON_TRANSFORMER_IMAGE:?}:${TAG}" # - "${SAMPLES_PYTHON_TRANSFORMER_IMAGE:?}:main" # image: "${SAMPLES_PYTHON_TRANSFORMER_IMAGE:?}:${TAG}" - # security_opt: - # - seccomp:${PROFILES_DIR}/seccomp_profile.json # volumes: # - ${MONO_DIR}/src/samples/python/transformer:/root/ament_ws/src/transformer diff --git a/profiles/docker-compose.vis_tools.yaml b/modules/docker-compose.vis_tools.yaml similarity index 91% rename from profiles/docker-compose.vis_tools.yaml rename to modules/docker-compose.vis_tools.yaml index 5bdd398..b46f01c 100644 --- a/profiles/docker-compose.vis_tools.yaml +++ b/modules/docker-compose.vis_tools.yaml @@ -3,7 +3,7 @@ services: foxglove: build: context: .. - dockerfile: docker/infrastructure/vis_tools/foxglove.Dockerfile + dockerfile: docker/vis_tools/foxglove.Dockerfile cache_from: - "${INFRASTRUCTURE_FOXGLOVE_IMAGE:?}:${TAG}" - "${INFRASTRUCTURE_FOXGLOVE_IMAGE:?}:main" diff --git a/profiles/docker-compose.robot.yaml b/profiles/docker-compose.robot.yaml deleted file mode 100644 index b158dd8..0000000 --- a/profiles/docker-compose.robot.yaml +++ /dev/null @@ -1,40 +0,0 @@ -version: "3.8" -services: - occupancy: - build: - context: .. - dockerfile: docker/robot/occupancy.Dockerfile - cache_from: - - "${ROBOT_OCCUPANCY_IMAGE:?}:${TAG}" - - "${ROBOT_OCCUPANCY_IMAGE:?}:main" - image: "${ROBOT_OCCUPANCY_IMAGE:?}:${TAG}" - security_opt: - - seccomp:${PROFILES_DIR}/seccomp_profile.json - volumes: - - ${MONO_DIR}/src/robot/occupancy:/root/ament_ws/src/occupancy - - nav: - build: - context: .. - dockerfile: docker/robot/nav.Dockerfile - cache_from: - - "${ROBOT_NAV_IMAGE:?}:${TAG}" - - "${ROBOT_NAV_IMAGE:?}:main" - image: "${ROBOT_NAV_IMAGE:?}:${TAG}" - security_opt: - - seccomp:${PROFILES_DIR}/seccomp_profile.json - volumes: - - ${MONO_DIR}/src/robot/nav:/root/ament_ws/src/nav - - control: - build: - context: .. - dockerfile: docker/robot/control.Dockerfile - cache_from: - - "${ROBOT_CONTROL_IMAGE:?}:${TAG}" - - "${ROBOT_CONTROL_IMAGE:?}:main" - image: "${ROBOT_CONTROL_IMAGE:?}:${TAG}" - security_opt: - - seccomp:${PROFILES_DIR}/seccomp_profile.json - volumes: - - ${MONO_DIR}/src/robot/control:/root/ament_ws/src/control diff --git a/profiles/seccomp_profile.json b/profiles/seccomp_profile.json deleted file mode 100644 index b5fc195..0000000 --- a/profiles/seccomp_profile.json +++ /dev/null @@ -1,830 +0,0 @@ -{ - "defaultAction": "SCMP_ACT_ERRNO", - "defaultErrnoRet": 1, - "archMap": [ - { - "architecture": "SCMP_ARCH_X86_64", - "subArchitectures": [ - "SCMP_ARCH_X86", - "SCMP_ARCH_X32" - ] - }, - { - "architecture": "SCMP_ARCH_AARCH64", - "subArchitectures": [ - "SCMP_ARCH_ARM" - ] - }, - { - "architecture": "SCMP_ARCH_MIPS64", - "subArchitectures": [ - "SCMP_ARCH_MIPS", - "SCMP_ARCH_MIPS64N32" - ] - }, - { - "architecture": "SCMP_ARCH_MIPS64N32", - "subArchitectures": [ - "SCMP_ARCH_MIPS", - "SCMP_ARCH_MIPS64" - ] - }, - { - "architecture": "SCMP_ARCH_MIPSEL64", - "subArchitectures": [ - "SCMP_ARCH_MIPSEL", - "SCMP_ARCH_MIPSEL64N32" - ] - }, - { - "architecture": "SCMP_ARCH_MIPSEL64N32", - "subArchitectures": [ - "SCMP_ARCH_MIPSEL", - "SCMP_ARCH_MIPSEL64" - ] - }, - { - "architecture": "SCMP_ARCH_S390X", - "subArchitectures": [ - "SCMP_ARCH_S390" - ] - }, - { - "architecture": "SCMP_ARCH_RISCV64", - "subArchitectures": null - } - ], - "syscalls": [ - { - "names": [ - "accept", - "accept4", - "access", - "adjtimex", - "alarm", - "bind", - "brk", - "capget", - "capset", - "chdir", - "chmod", - "chown", - "chown32", - "clock_adjtime", - "clock_adjtime64", - "clock_getres", - "clock_getres_time64", - "clock_gettime", - "clock_gettime64", - "clock_nanosleep", - "clock_nanosleep_time64", - "clone3", - "close", - "close_range", - "connect", - "copy_file_range", - "creat", - "dup", - "dup2", - "dup3", - "epoll_create", - "epoll_create1", - "epoll_ctl", - "epoll_ctl_old", - "epoll_pwait", - "epoll_pwait2", - "epoll_wait", - "epoll_wait_old", - "eventfd", - "eventfd2", - "execve", - "execveat", - "exit", - "exit_group", - "faccessat", - "faccessat2", - "fadvise64", - "fadvise64_64", - "fallocate", - "fanotify_mark", - "fchdir", - "fchmod", - "fchmodat", - "fchown", - "fchown32", - "fchownat", - "fcntl", - "fcntl64", - "fdatasync", - "fgetxattr", - "flistxattr", - "flock", - "fork", - "fremovexattr", - "fsetxattr", - "fstat", - "fstat64", - "fstatat64", - "fstatfs", - "fstatfs64", - "fsync", - "ftruncate", - "ftruncate64", - "futex", - "futex_time64", - "futex_waitv", - "futimesat", - "getcpu", - "getcwd", - "getdents", - "getdents64", - "getegid", - "getegid32", - "geteuid", - "geteuid32", - "getgid", - "getgid32", - "getgroups", - "getgroups32", - "getitimer", - "getpeername", - "getpgid", - "getpgrp", - "getpid", - "getppid", - "getpriority", - "getrandom", - "getresgid", - "getresgid32", - "getresuid", - "getresuid32", - "getrlimit", - "get_robust_list", - "getrusage", - "getsid", - "getsockname", - "getsockopt", - "get_thread_area", - "gettid", - "gettimeofday", - "getuid", - "getuid32", - "getxattr", - "inotify_add_watch", - "inotify_init", - "inotify_init1", - "inotify_rm_watch", - "io_cancel", - "ioctl", - "io_destroy", - "io_getevents", - "io_pgetevents", - "io_pgetevents_time64", - "ioprio_get", - "ioprio_set", - "io_setup", - "io_submit", - "io_uring_enter", - "io_uring_register", - "io_uring_setup", - "ipc", - "kill", - "landlock_add_rule", - "landlock_create_ruleset", - "landlock_restrict_self", - "lchown", - "lchown32", - "lgetxattr", - "link", - "linkat", - "listen", - "listxattr", - "llistxattr", - "_llseek", - "lremovexattr", - "lseek", - "lsetxattr", - "lstat", - "lstat64", - "madvise", - "membarrier", - "memfd_create", - "memfd_secret", - "mincore", - "mkdir", - "mkdirat", - "mknod", - "mknodat", - "mlock", - "mlock2", - "mlockall", - "mmap", - "mmap2", - "mprotect", - "mq_getsetattr", - "mq_notify", - "mq_open", - "mq_timedreceive", - "mq_timedreceive_time64", - "mq_timedsend", - "mq_timedsend_time64", - "mq_unlink", - "mremap", - "msgctl", - "msgget", - "msgrcv", - "msgsnd", - "msync", - "munlock", - "munlockall", - "munmap", - "nanosleep", - "newfstatat", - "_newselect", - "open", - "openat", - "openat2", - "pause", - "pidfd_open", - "pidfd_send_signal", - "pipe", - "pipe2", - "pkey_alloc", - "pkey_free", - "pkey_mprotect", - "poll", - "ppoll", - "ppoll_time64", - "prctl", - "pread64", - "preadv", - "preadv2", - "prlimit64", - "process_mrelease", - "pselect6", - "pselect6_time64", - "pwrite64", - "pwritev", - "pwritev2", - "read", - "readahead", - "readlink", - "readlinkat", - "readv", - "recv", - "recvfrom", - "recvmmsg", - "recvmmsg_time64", - "recvmsg", - "remap_file_pages", - "removexattr", - "rename", - "renameat", - "renameat2", - "restart_syscall", - "rmdir", - "rseq", - "rt_sigaction", - "rt_sigpending", - "rt_sigprocmask", - "rt_sigqueueinfo", - "rt_sigreturn", - "rt_sigsuspend", - "rt_sigtimedwait", - "rt_sigtimedwait_time64", - "rt_tgsigqueueinfo", - "sched_getaffinity", - "sched_getattr", - "sched_getparam", - "sched_get_priority_max", - "sched_get_priority_min", - "sched_getscheduler", - "sched_rr_get_interval", - "sched_rr_get_interval_time64", - "sched_setaffinity", - "sched_setattr", - "sched_setparam", - "sched_setscheduler", - "sched_yield", - "seccomp", - "select", - "semctl", - "semget", - "semop", - "semtimedop", - "semtimedop_time64", - "send", - "sendfile", - "sendfile64", - "sendmmsg", - "sendmsg", - "sendto", - "setfsgid", - "setfsgid32", - "setfsuid", - "setfsuid32", - "setgid", - "setgid32", - "setgroups", - "setgroups32", - "setitimer", - "setpgid", - "setpriority", - "setregid", - "setregid32", - "setresgid", - "setresgid32", - "setresuid", - "setresuid32", - "setreuid", - "setreuid32", - "setrlimit", - "set_robust_list", - "setsid", - "setsockopt", - "set_thread_area", - "set_tid_address", - "setuid", - "setuid32", - "setxattr", - "shmat", - "shmctl", - "shmdt", - "shmget", - "shutdown", - "sigaltstack", - "signalfd", - "signalfd4", - "sigprocmask", - "sigreturn", - "socketcall", - "socketpair", - "splice", - "stat", - "stat64", - "statfs", - "statfs64", - "statx", - "symlink", - "symlinkat", - "sync", - "sync_file_range", - "syncfs", - "sysinfo", - "tee", - "tgkill", - "time", - "timer_create", - "timer_delete", - "timer_getoverrun", - "timer_gettime", - "timer_gettime64", - "timer_settime", - "timer_settime64", - "timerfd_create", - "timerfd_gettime", - "timerfd_gettime64", - "timerfd_settime", - "timerfd_settime64", - "times", - "tkill", - "truncate", - "truncate64", - "ugetrlimit", - "umask", - "uname", - "unlink", - "unlinkat", - "utime", - "utimensat", - "utimensat_time64", - "utimes", - "vfork", - "vmsplice", - "wait4", - "waitid", - "waitpid", - "write", - "writev" - ], - "action": "SCMP_ACT_ALLOW" - }, - { - "names": [ - "process_vm_readv", - "process_vm_writev", - "ptrace" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "minKernel": "4.8" - } - }, - { - "names": [ - "socket" - ], - "action": "SCMP_ACT_ALLOW", - "args": [ - { - "index": 0, - "value": 40, - "op": "SCMP_CMP_NE" - } - ] - }, - { - "names": [ - "personality" - ], - "action": "SCMP_ACT_ALLOW", - "args": [ - { - "index": 0, - "value": 0, - "op": "SCMP_CMP_EQ" - } - ] - }, - { - "names": [ - "personality" - ], - "action": "SCMP_ACT_ALLOW", - "args": [ - { - "index": 0, - "value": 8, - "op": "SCMP_CMP_EQ" - } - ] - }, - { - "names": [ - "personality" - ], - "action": "SCMP_ACT_ALLOW", - "args": [ - { - "index": 0, - "value": 131072, - "op": "SCMP_CMP_EQ" - } - ] - }, - { - "names": [ - "personality" - ], - "action": "SCMP_ACT_ALLOW", - "args": [ - { - "index": 0, - "value": 131080, - "op": "SCMP_CMP_EQ" - } - ] - }, - { - "names": [ - "personality" - ], - "action": "SCMP_ACT_ALLOW", - "args": [ - { - "index": 0, - "value": 4294967295, - "op": "SCMP_CMP_EQ" - } - ] - }, - { - "names": [ - "sync_file_range2", - "swapcontext" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "arches": [ - "ppc64le" - ] - } - }, - { - "names": [ - "arm_fadvise64_64", - "arm_sync_file_range", - "sync_file_range2", - "breakpoint", - "cacheflush", - "set_tls" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "arches": [ - "arm", - "arm64" - ] - } - }, - { - "names": [ - "arch_prctl" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "arches": [ - "amd64", - "x32" - ] - } - }, - { - "names": [ - "modify_ldt" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "arches": [ - "amd64", - "x32", - "x86" - ] - } - }, - { - "names": [ - "s390_pci_mmio_read", - "s390_pci_mmio_write", - "s390_runtime_instr" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "arches": [ - "s390", - "s390x" - ] - } - }, - { - "names": [ - "riscv_flush_icache" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "arches": [ - "riscv64" - ] - } - }, - { - "names": [ - "open_by_handle_at" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "caps": [ - "CAP_DAC_READ_SEARCH" - ] - } - }, - { - "names": [ - "bpf", - "clone", - "clone3", - "fanotify_init", - "fsconfig", - "fsmount", - "fsopen", - "fspick", - "lookup_dcookie", - "mount", - "mount_setattr", - "move_mount", - "name_to_handle_at", - "open_tree", - "perf_event_open", - "quotactl", - "quotactl_fd", - "setdomainname", - "sethostname", - "setns", - "syslog", - "umount", - "umount2", - "unshare" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "caps": [ - "CAP_SYS_ADMIN" - ] - } - }, - { - "names": [ - "clone" - ], - "action": "SCMP_ACT_ALLOW", - "args": [ - { - "index": 0, - "value": 2114060288, - "op": "SCMP_CMP_MASKED_EQ" - } - ], - "excludes": { - "caps": [ - "CAP_SYS_ADMIN" - ], - "arches": [ - "s390", - "s390x" - ] - } - }, - { - "names": [ - "clone" - ], - "action": "SCMP_ACT_ALLOW", - "args": [ - { - "index": 1, - "value": 2114060288, - "op": "SCMP_CMP_MASKED_EQ" - } - ], - "comment": "s390 parameter ordering for clone is different", - "includes": { - "arches": [ - "s390", - "s390x" - ] - }, - "excludes": { - "caps": [ - "CAP_SYS_ADMIN" - ] - } - }, - { - "names": [ - "clone3" - ], - "action": "SCMP_ACT_ERRNO", - "errnoRet": 38, - "excludes": { - "caps": [ - "CAP_SYS_ADMIN" - ] - } - }, - { - "names": [ - "reboot" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "caps": [ - "CAP_SYS_BOOT" - ] - } - }, - { - "names": [ - "chroot" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "caps": [ - "CAP_SYS_CHROOT" - ] - } - }, - { - "names": [ - "delete_module", - "init_module", - "finit_module" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "caps": [ - "CAP_SYS_MODULE" - ] - } - }, - { - "names": [ - "acct" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "caps": [ - "CAP_SYS_PACCT" - ] - } - }, - { - "names": [ - "kcmp", - "pidfd_getfd", - "process_madvise", - "process_vm_readv", - "process_vm_writev", - "ptrace" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "caps": [ - "CAP_SYS_PTRACE" - ] - } - }, - { - "names": [ - "iopl", - "ioperm" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "caps": [ - "CAP_SYS_RAWIO" - ] - } - }, - { - "names": [ - "settimeofday", - "stime", - "clock_settime", - "clock_settime64" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "caps": [ - "CAP_SYS_TIME" - ] - } - }, - { - "names": [ - "vhangup" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "caps": [ - "CAP_SYS_TTY_CONFIG" - ] - } - }, - { - "names": [ - "get_mempolicy", - "mbind", - "set_mempolicy" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "caps": [ - "CAP_SYS_NICE" - ] - } - }, - { - "names": [ - "syslog" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "caps": [ - "CAP_SYSLOG" - ] - } - }, - { - "names": [ - "bpf" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "caps": [ - "CAP_BPF" - ] - } - }, - { - "names": [ - "perf_event_open" - ], - "action": "SCMP_ACT_ALLOW", - "includes": { - "caps": [ - "CAP_PERFMON" - ] - } - } - ] -} \ No newline at end of file diff --git a/src/gazebo/CMakeLists.txt b/src/gazebo/CMakeLists.txt new file mode 100644 index 0000000..473bca9 --- /dev/null +++ b/src/gazebo/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.5) +project(gazebo) + +find_package(ament_cmake REQUIRED) + +install(DIRECTORY launch + DESTINATION share/${PROJECT_NAME}) + +ament_package() diff --git a/src/gazebo/launch/sim.ign b/src/gazebo/launch/sim.ign index 42cf072..14eba17 100644 --- a/src/gazebo/launch/sim.ign +++ b/src/gazebo/launch/sim.ign @@ -1,11 +1,5 @@ - - ign gazebo -s -v 4 -r src/gazebo/launch/robot_env.sdf - - 30 diff --git a/src/gazebo/launch/sim.launch.py b/src/gazebo/launch/sim.launch.py index a0ffc42..162dd47 100644 --- a/src/gazebo/launch/sim.launch.py +++ b/src/gazebo/launch/sim.launch.py @@ -13,7 +13,12 @@ def generate_launch_description(): - gz_sim = ExecuteProcess(cmd=['ign', 'launch', '-v 4', 'src/gazebo/launch/sim.ign']) + gazebo_pkg_prefix = get_package_share_directory('gazebo') + gazebo_sim_ign = os.path.join(gazebo_pkg_prefix, 'launch', 'sim.ign') + sdf_file_path = os.path.join(gazebo_pkg_prefix, 'launch', 'robot_env.sdf') + + gz_sim = ExecuteProcess(cmd=['ign', 'launch', '-v 4', f'{gazebo_sim_ign}']) + gz_sim_server = ExecuteProcess(cmd=['ign', 'gazebo', '-s', '-v 4', '-r', f'{sdf_file_path}']) # Bridge bridge = Node( @@ -38,5 +43,6 @@ def generate_launch_description(): return LaunchDescription([ gz_sim, + gz_sim_server, bridge ]) \ No newline at end of file diff --git a/src/gazebo/package.xml b/src/gazebo/package.xml new file mode 100644 index 0000000..c9c4694 --- /dev/null +++ b/src/gazebo/package.xml @@ -0,0 +1,15 @@ + + + gazebo + 0.0.0 + Gazebo package for launching asd training sim + TODO + + Eddy Zhou + + ament_cmake + + + ament_cmake + + \ No newline at end of file diff --git a/src/robot/bringup_robot/CMakeLists.txt b/src/robot/bringup_robot/CMakeLists.txt new file mode 100644 index 0000000..bb4484d --- /dev/null +++ b/src/robot/bringup_robot/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.5) +project(bringup_robot) + +find_package(ament_cmake REQUIRED) + +install(DIRECTORY launch + DESTINATION share/${PROJECT_NAME}) + +ament_package() diff --git a/src/robot/bringup_robot/launch/robot.launch.py b/src/robot/bringup_robot/launch/robot.launch.py new file mode 100644 index 0000000..30488c6 --- /dev/null +++ b/src/robot/bringup_robot/launch/robot.launch.py @@ -0,0 +1,72 @@ +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument +from launch.substitutions import LaunchConfiguration +from launch_ros.actions import Node + +import os + +def generate_launch_description(): + #################### Costmap Node ##################### + costmap_pkg_prefix = get_package_share_directory('costmap') + costmap_param_file = os.path.join( + costmap_pkg_prefix, 'config', 'params.yaml') + + costmap_param = DeclareLaunchArgument( + 'costmap_param_file', + default_value=costmap_param_file, + description='Path to config file for producer node' + ) + costmap_node = Node( + package='costmap', + name='costmap_node', + executable='costmap_node', + parameters=[LaunchConfiguration('costmap_param_file')], + ) + + ##################### Nav Node ##################### + nav_pkg_prefix = get_package_share_directory('nav') + nav_param_file = os.path.join( + nav_pkg_prefix, 'config', 'params.yaml') + + nav_param = DeclareLaunchArgument( + 'nav_param_file', + default_value=nav_param_file, + description='Path to config file for producer node' + ) + nav_node = Node( + package='nav', + name='nav_node', + executable='nav_node', + parameters=[LaunchConfiguration('nav_param_file')], + ) + + ##################### Control Node ##################### + control_pkg_prefix = get_package_share_directory('control') + control_param_file = os.path.join( + control_pkg_prefix, 'config', 'params.yaml') + + control_param = DeclareLaunchArgument( + 'control_param_file', + default_value=control_param_file, + description='Path to config file for producer node' + ) + control_node = Node( + package='control', + name='control_node', + executable='control_node', + parameters=[LaunchConfiguration('control_param_file')], + ) + + ##################### Add to Launch Description ##################### + ld = LaunchDescription() + + ld.add_action(costmap_param) + ld.add_action(nav_param) + ld.add_action(control_param) + + ld.add_action(costmap_node) + ld.add_action(nav_node) + ld.add_action(control_node) + + return ld diff --git a/src/robot/bringup_robot/package.xml b/src/robot/bringup_robot/package.xml new file mode 100644 index 0000000..d866551 --- /dev/null +++ b/src/robot/bringup_robot/package.xml @@ -0,0 +1,19 @@ + + + bringup_robot + 0.0.0 + Bringup Robot package for launching the robot + + Eddy Zhou + TODO + + ament_cmake + + costmap + nav + control + + + ament_cmake + + \ No newline at end of file diff --git a/src/robot/control/CMakeLists.txt b/src/robot/control/CMakeLists.txt index 827a2b3..4e0334d 100644 --- a/src/robot/control/CMakeLists.txt +++ b/src/robot/control/CMakeLists.txt @@ -13,7 +13,6 @@ endif() # Search for dependencies required for building this package find_package(ament_cmake REQUIRED) # ROS2 build tool find_package(rclcpp REQUIRED) # ROS2 C++ package -find_package(sample_msgs REQUIRED) # Custom package containing ROS2 messages find_package(geometry_msgs REQUIRED) find_package(tf2 REQUIRED) find_package(tf2_ros REQUIRED) @@ -35,7 +34,6 @@ target_include_directories(control_lib # Add ROS2 dependencies required by package ament_target_dependencies(control_lib rclcpp - sample_msgs geometry_msgs tf2 tf2_ros @@ -52,9 +50,4 @@ install(TARGETS control_node DESTINATION lib/${PROJECT_NAME}) -# Copy launch files to installation location -install(DIRECTORY - launch - DESTINATION share/${PROJECT_NAME}) - ament_package() \ No newline at end of file diff --git a/src/robot/control/launch/control.launch.py b/src/robot/control/launch/control.launch.py deleted file mode 100755 index 36e4745..0000000 --- a/src/robot/control/launch/control.launch.py +++ /dev/null @@ -1,20 +0,0 @@ -from ament_index_python.packages import get_package_share_directory -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument -from launch.substitutions import LaunchConfiguration -from launch_ros.actions import Node - -import os - -def generate_launch_description(): - """Launch transformer node.""" - transformer_pkg_prefix = get_package_share_directory('control') - - node = Node( - package='control', - executable='control_node' - ) - - return LaunchDescription([ - node - ]) diff --git a/src/robot/control/package.xml b/src/robot/control/package.xml index 434289c..d8c00b6 100644 --- a/src/robot/control/package.xml +++ b/src/robot/control/package.xml @@ -10,7 +10,6 @@ ament_cmake rclcpp - sample_msgs geometry_msgs tf2 tf2_ros diff --git a/src/robot/occupancy/CMakeLists.txt b/src/robot/costmap/CMakeLists.txt similarity index 63% rename from src/robot/occupancy/CMakeLists.txt rename to src/robot/costmap/CMakeLists.txt index a000701..5f41f09 100644 --- a/src/robot/occupancy/CMakeLists.txt +++ b/src/robot/costmap/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10) -project(occupancy) +project(costmap) # Set compiler to use C++ 17 standard if(NOT CMAKE_CXX_STANDARD) @@ -13,34 +13,28 @@ endif() # Search for dependencies required for building this package find_package(ament_cmake REQUIRED) # ROS2 build tool find_package(rclcpp REQUIRED) # ROS2 C++ package -find_package(sample_msgs REQUIRED) # Custom package containing ROS2 messages # Compiles source files into a library # A library is not executed, instead other executables can link # against it to access defined methods and classes. # We build a library so that the methods defined can be used by # both the unit test and ROS2 node executables. -add_library(occupancy_lib - src/occupancy_core.cpp) +add_library(costmap_lib + src/costmap_core.cpp) # Indicate to compiler where to search for header files -target_include_directories(occupancy_lib +target_include_directories(costmap_lib PUBLIC include) # Add ROS2 dependencies required by package -ament_target_dependencies(occupancy_lib rclcpp sample_msgs) +ament_target_dependencies(costmap_lib rclcpp) # Create ROS2 node executable from source files -add_executable(occupancy_node src/occupancy_node.cpp) -# Link to the previously built library to access occupancy classes and methods -target_link_libraries(occupancy_node occupancy_lib) +add_executable(costmap_node src/costmap_node.cpp) +# Link to the previously built library to access costmap classes and methods +target_link_libraries(costmap_node costmap_lib) # Copy executable to installation location install(TARGETS - occupancy_node + costmap_node DESTINATION lib/${PROJECT_NAME}) -# Copy launch files to installation location -install(DIRECTORY - launch - DESTINATION share/${PROJECT_NAME}) - ament_package() diff --git a/src/robot/occupancy/include/occupancy_core.hpp b/src/robot/costmap/include/costmap_core.hpp similarity index 65% rename from src/robot/occupancy/include/occupancy_core.hpp rename to src/robot/costmap/include/costmap_core.hpp index 12d3519..b8111e0 100644 --- a/src/robot/occupancy/include/occupancy_core.hpp +++ b/src/robot/costmap/include/costmap_core.hpp @@ -1,5 +1,5 @@ -#ifndef OCCUPANCY_CORE_HPP_ -#define OCCUPANCY_CORE_HPP_ +#ifndef COSTMAP_CORE_HPP_ +#define COSTMAP_CORE_HPP_ #include "rclcpp/rclcpp.hpp" @@ -10,9 +10,9 @@ namespace robot * Implementation of the internal logic used by the Aggregator Node to * calculate the operating frequency of topics. */ -class OccupancyCore { +class CostmapCore { public: - explicit OccupancyCore(); + explicit CostmapCore(); }; diff --git a/src/robot/costmap/include/costmap_node.hpp b/src/robot/costmap/include/costmap_node.hpp new file mode 100644 index 0000000..5ff3555 --- /dev/null +++ b/src/robot/costmap/include/costmap_node.hpp @@ -0,0 +1,19 @@ +#ifndef COSTMAP_NODE_HPP_ +#define COSTMAP_NODE_HPP_ + +#include "rclcpp/rclcpp.hpp" + +#include "costmap_core.hpp" + +class CostmapNode : public rclcpp::Node { + public: + /** + * Costmap node constructor. + */ + CostmapNode(); + + private: + robot::CostmapCore costmap_; +}; + +#endif diff --git a/src/robot/occupancy/package.xml b/src/robot/costmap/package.xml similarity index 92% rename from src/robot/occupancy/package.xml rename to src/robot/costmap/package.xml index bee7fe4..a30a46b 100644 --- a/src/robot/occupancy/package.xml +++ b/src/robot/costmap/package.xml @@ -1,6 +1,6 @@ - occupancy + costmap 0.0.0 A sample ROS package for pubsub communication @@ -10,7 +10,6 @@ ament_cmake rclcpp - sample_msgs ament_lint_auto ament_lint_common diff --git a/src/robot/costmap/src/costmap_core.cpp b/src/robot/costmap/src/costmap_core.cpp new file mode 100644 index 0000000..9b74565 --- /dev/null +++ b/src/robot/costmap/src/costmap_core.cpp @@ -0,0 +1,8 @@ +#include + +#include "costmap_core.hpp" + +namespace robot +{ + CostmapCore::CostmapCore() {} +} diff --git a/src/robot/costmap/src/costmap_node.cpp b/src/robot/costmap/src/costmap_node.cpp new file mode 100644 index 0000000..95c509e --- /dev/null +++ b/src/robot/costmap/src/costmap_node.cpp @@ -0,0 +1,16 @@ +#include +#include + +#include "costmap_node.hpp" + +CostmapNode::CostmapNode() : Node("costmap"), costmap_(robot::CostmapCore()) { + +} + +int main(int argc, char ** argv) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} diff --git a/src/robot/nav/CMakeLists.txt b/src/robot/nav/CMakeLists.txt index 5e16080..aa6cdf7 100644 --- a/src/robot/nav/CMakeLists.txt +++ b/src/robot/nav/CMakeLists.txt @@ -13,7 +13,6 @@ endif() # Search for dependencies required for building this package find_package(ament_cmake REQUIRED) # ROS2 build tool find_package(rclcpp REQUIRED) # ROS2 C++ package -find_package(sample_msgs REQUIRED) # Custom package containing ROS2 messages # Compiles source files into a library # A library is not executed, instead other executables can link @@ -26,7 +25,7 @@ add_library(nav_lib target_include_directories(nav_lib PUBLIC include) # Add ROS2 dependencies required by package -ament_target_dependencies(nav_lib rclcpp sample_msgs) +ament_target_dependencies(nav_lib rclcpp) # Create ROS2 node executable from source files add_executable(nav_node src/nav_node.cpp) @@ -38,9 +37,4 @@ install(TARGETS nav_node DESTINATION lib/${PROJECT_NAME}) -# Copy launch files to installation location -install(DIRECTORY - launch - DESTINATION share/${PROJECT_NAME}) - ament_package() diff --git a/src/robot/nav/launch/nav.launch.py b/src/robot/nav/launch/nav.launch.py deleted file mode 100755 index 24536ab..0000000 --- a/src/robot/nav/launch/nav.launch.py +++ /dev/null @@ -1,20 +0,0 @@ -from ament_index_python.packages import get_package_share_directory -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument -from launch.substitutions import LaunchConfiguration -from launch_ros.actions import Node - -import os - -def generate_launch_description(): - """Launch transformer node.""" - transformer_pkg_prefix = get_package_share_directory('nav') - - node = Node( - package='nav', - executable='nav_node' - ) - - return LaunchDescription([ - node - ]) diff --git a/src/robot/nav/package.xml b/src/robot/nav/package.xml index 14f27cd..bb72be9 100644 --- a/src/robot/nav/package.xml +++ b/src/robot/nav/package.xml @@ -10,7 +10,6 @@ ament_cmake rclcpp - sample_msgs ament_lint_auto ament_lint_common diff --git a/src/robot/occupancy/include/occupancy_node.hpp b/src/robot/occupancy/include/occupancy_node.hpp deleted file mode 100644 index 6f86530..0000000 --- a/src/robot/occupancy/include/occupancy_node.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef OCCUPANCY_NODE_HPP_ -#define OCCUPANCY_NODE_HPP_ - -#include "rclcpp/rclcpp.hpp" - -#include "occupancy_core.hpp" - -class OccupancyNode : public rclcpp::Node { - public: - /** - * Occupancy node constructor. - */ - OccupancyNode(); - - private: - robot::OccupancyCore occupancy_; -}; - -#endif diff --git a/src/robot/occupancy/launch/aggregator.launch.py b/src/robot/occupancy/launch/aggregator.launch.py deleted file mode 100644 index a628649..0000000 --- a/src/robot/occupancy/launch/aggregator.launch.py +++ /dev/null @@ -1,20 +0,0 @@ -from ament_index_python.packages import get_package_share_directory -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument -from launch.substitutions import LaunchConfiguration -from launch_ros.actions import Node - -import os - -def generate_launch_description(): - """Launch transformer node.""" - transformer_pkg_prefix = get_package_share_directory('occupancy') - - node = Node( - package='occupancy', - executable='occupancy_node' - ) - - return LaunchDescription([ - node - ]) diff --git a/src/robot/occupancy/launch/occupancy.launch.py b/src/robot/occupancy/launch/occupancy.launch.py deleted file mode 100755 index a628649..0000000 --- a/src/robot/occupancy/launch/occupancy.launch.py +++ /dev/null @@ -1,20 +0,0 @@ -from ament_index_python.packages import get_package_share_directory -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument -from launch.substitutions import LaunchConfiguration -from launch_ros.actions import Node - -import os - -def generate_launch_description(): - """Launch transformer node.""" - transformer_pkg_prefix = get_package_share_directory('occupancy') - - node = Node( - package='occupancy', - executable='occupancy_node' - ) - - return LaunchDescription([ - node - ]) diff --git a/src/robot/occupancy/src/occupancy_core.cpp b/src/robot/occupancy/src/occupancy_core.cpp deleted file mode 100644 index 345bebc..0000000 --- a/src/robot/occupancy/src/occupancy_core.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include - -#include "occupancy_core.hpp" - -namespace robot -{ - OccupancyCore::OccupancyCore() {} -} diff --git a/src/robot/occupancy/src/occupancy_node.cpp b/src/robot/occupancy/src/occupancy_node.cpp deleted file mode 100644 index 07e35df..0000000 --- a/src/robot/occupancy/src/occupancy_node.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -#include "occupancy_node.hpp" - -OccupancyNode::OccupancyNode() : Node("occupancy"), occupancy_(robot::OccupancyCore()) { - -} - -int main(int argc, char ** argv) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} diff --git a/src/samples/sample_msgs/CMakeLists.txt b/src/samples/sample_msgs/CMakeLists.txt new file mode 100644 index 0000000..008fc0e --- /dev/null +++ b/src/samples/sample_msgs/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.10) +project(sample_msgs) + +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 17) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) +find_package(rosidl_default_generators REQUIRED) +find_package(std_msgs REQUIRED) + +set(msg_files + msg/Filtered.msg + msg/FilteredArray.msg + msg/Unfiltered.msg + msg/Metadata.msg) +rosidl_generate_interfaces(sample_msgs + ${msg_files} + DEPENDENCIES std_msgs) + +ament_export_dependencies(rosidl_default_runtime) +ament_package() \ No newline at end of file diff --git a/src/samples/sample_msgs/msg/Filtered.msg b/src/samples/sample_msgs/msg/Filtered.msg new file mode 100644 index 0000000..ed9c238 --- /dev/null +++ b/src/samples/sample_msgs/msg/Filtered.msg @@ -0,0 +1,5 @@ +float32 pos_x +float32 pos_y +float32 pos_z +Metadata metadata +int64 timestamp \ No newline at end of file diff --git a/src/samples/sample_msgs/msg/FilteredArray.msg b/src/samples/sample_msgs/msg/FilteredArray.msg new file mode 100644 index 0000000..eded53e --- /dev/null +++ b/src/samples/sample_msgs/msg/FilteredArray.msg @@ -0,0 +1 @@ +Filtered[] packets \ No newline at end of file diff --git a/src/samples/sample_msgs/msg/Metadata.msg b/src/samples/sample_msgs/msg/Metadata.msg new file mode 100644 index 0000000..4facd8a --- /dev/null +++ b/src/samples/sample_msgs/msg/Metadata.msg @@ -0,0 +1,7 @@ +int8 DEFAULT = 0 +int8 DICTIONARY = 1 +int8 RUN_LENGTH = 2 + +int8 version +int8 compression_method +int16 creation_date \ No newline at end of file diff --git a/src/samples/sample_msgs/msg/Unfiltered.msg b/src/samples/sample_msgs/msg/Unfiltered.msg new file mode 100644 index 0000000..6a21ed0 --- /dev/null +++ b/src/samples/sample_msgs/msg/Unfiltered.msg @@ -0,0 +1,3 @@ +string data +int64 timestamp +bool valid \ No newline at end of file diff --git a/src/samples/sample_msgs/package.xml b/src/samples/sample_msgs/package.xml new file mode 100644 index 0000000..d2b2b37 --- /dev/null +++ b/src/samples/sample_msgs/package.xml @@ -0,0 +1,20 @@ + + + sample_msgs + 0.0.0 + Sample ROS messages + + watouser + TODO + + ament_cmake + std_msgs + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + + ament_cmake + + \ No newline at end of file diff --git a/watod b/watod index f4fa0b9..7d28200 100755 --- a/watod +++ b/watod @@ -3,28 +3,19 @@ set -e programname="$(basename "$(test -L "$0" && readlink "$0" || echo "$0")")" MONO_DIR="$(dirname "$(realpath "$0")")" -PROFILES_DIR="$MONO_DIR/profiles" +MODULES_DIR="$MONO_DIR/modules" ANSIBLE_TMP_DIR=/tmp/ansible-tmp-$USER function usage { echo "Usage: $programname [OPTIONS]... [COMMAND]..." - echo "Executes docker-compose COMMAND in the the monorepo with appropriate environment variables." - echo " launch_autonomous launch the can_interface for autonomous mode" + echo "Executes \"docker compose COMMAND\" in the the monorepo with appropriate environment variables." echo " -v --verbose verbose mode. Currently, prints .env variables" - echo " -lp --local-ports displays ports exposed by applications and shows the" - echo " ssh local port forwarding commands for each VNC Server found" - echo " if a docker-compose command is specified, it will be run in the background." echo " -t --terminal [service_name] open a bash terminal into the desired service (eg: perception)." - echo " -a --all run COMMAND with all profiles enabled. Profiles are defined in ./profiles/." - echo " -np don't run fix-permissions.sh, makes permissions consistent across all systems" - echo " so that docker caching doesn't break." echo "" echo "Examples:" - echo " watod up start containers (docker-compose up)" - echo " watod down stop and remove containers (docker-compose down)" - echo " watod ps [--services] list containers in the current project and show their current status (docker-compose ps)" - echo " watod --all pull pull all new containers from the GitLab container registry (docker-compose pull)" - echo " watod --all build build all new containers using Dockerfiles in docker/ (docker-compose build)" + echo " watod up start containers (docker compose up)" + echo " watod down stop and remove containers (docker compose down)" + echo " watod ps [--services] list containers in the current project and show their current status (docker compose ps)" echo " watod -t perception open a bash terminal into the perception container." echo "" echo " More Info on Docker Compose: https://docs.docker.com/compose/reference/overview/" @@ -33,11 +24,12 @@ function usage { function run_compose { cd $MONO_DIR - if [ ! -z "$(source $PROFILES_DIR/.env && echo $ACTIVE_PROFILES)" ] && [ -z "$PROFILES" ]; then - PROFILES="$(source $PROFILES_DIR/.env && printf -- "-f profiles/docker-compose.%s.yaml " ${ACTIVE_PROFILES[@]})" + if [ ! -z "$(source $MODULES_DIR/.env && echo $ACTIVE_MODULES)" ] && [ -z "$MODULES" ]; then + MODULES="$(source $MODULES_DIR/.env && printf -- " -f $MODULES_DIR/docker-compose.%s.yaml" ${ACTIVE_MODULES[@]})" fi + echo "Running docker compose ${MODULES[@]} $@" - DOCKER_BUILDKIT=${DOCKER_BUILDKIT:-1} docker compose ${PROFILES[@]} "$@" + DOCKER_BUILDKIT=${DOCKER_BUILDKIT:-1} docker compose ${MODULES[@]} "$@" } # in case you need help @@ -49,13 +41,6 @@ if [ $# == 0 ]; then usage fi -# generate .env file from scripts/watod-setup-env.sh -if [ ! -z $VERBOSE ]; then # if we want to see all verbose coming from setting up env - cd $MONO_DIR && bash scripts/watod-setup-env.sh -else - cd $MONO_DIR && bash scripts/watod-setup-env.sh &> /dev/null -fi - # run options COMPOSE_CMD="" while [[ $# -gt 0 ]] ; do @@ -65,10 +50,6 @@ while [[ $# -gt 0 ]] ; do VERBOSE=1 shift # past argument ;; - -lp|--local-ports) - PRINT_LOCAL_PORTS=1 - shift - ;; -t|--terminal) START_TERMINAL=1 shift @@ -79,26 +60,6 @@ while [[ $# -gt 0 ]] ; do fi shift ;; - -a|--all) - PROFILE_BLACKLIST="$(source $PROFILES_DIR/.env && echo $PROFILE_BLACKLIST)" - # Find all the profiles - PROFILES=$(ls $PROFILES_DIR) - # Remove profiles in the blacklist - for TO_REMOVE in ${PROFILE_BLACKLIST[@]}; do - PROFILES="${PROFILES//"docker-compose.$TO_REMOVE.yaml"/}" - done - # format properly for docker-compose - PROFILES=$(printf -- "-f profiles/%s " $PROFILES) - shift - ;; - -np) - NO_FIX_PERMISSIONS=1 - shift - ;; - launch_autonomous) - LAUNCH_AUTONOMOUS=1 - shift - ;; -h|--help) # in case you got this far, but still need help :) usage ;; @@ -112,72 +73,37 @@ if [[ $# -gt 0 ]]; then COMPOSE_CMD="${COMPOSE_CMD} $@" fi -# launch autonomy on the car -if [ ! -z $LAUNCH_AUTONOMOUS ]; then - echo "============================================================ " - echo "WARNING: You are about to enter autonomous mode. " - echo "" - echo "Make sure that you are running the autonomous pipeline and have " - echo "verified the output of the /feedback_desired_output rostopic. " - echo "Turn on the car and put car in drive with the brake off. " - echo "Press twice to exit autonomous mode " - echo "" - read -p "Press to continue" - - # Run actual CAN devices, not VCAN - echo "CAN_DEBUG=False" >> "$PROFILES_DIR/.env" - PROFILES="-f profiles/docker-compose.can_interface.yaml" - - run_compose up can_interface - exit 0 +# Allow for local overrides of any of the below parameters (prioritized your local config) +if [ -f "$MONO_DIR/watod-config.local.sh" ]; then + source "$MONO_DIR/watod-config.local.sh" +elif [ -f "$MONO_DIR/watod-config.sh" ]; then + source "$MONO_DIR/watod-config.sh" fi -if [ ! -z $PRINT_LOCAL_PORTS ]; then - # get list of services to traverse - SERVICE_LIST="$(run_compose ps --services | sort)" - - # fixes hostnames for VMs so that by default $HOSTNAME is the first element - # in the array, which often is the domain name that can be accessed - # externally - read -ra HOSTNAME <<< $(hostname -A) - echo "=========================================================================" - echo "Ports exposed by running containers:" - echo "=========================================================================" - LOCAL_FORWARD_ALL="" - - PORTS_STRING="" - for SERVICE in $SERVICE_LIST; do - ENV_VARS="$(run_compose exec "$SERVICE" env || true)" - VNC_PORT=$(echo "$ENV_VARS" | grep ^VNC_PORT= | cut -d '=' -f2) - VNC_PORT=${VNC_PORT:0:5} # Strip unncessary characters +# Change docker-compose override according to mode of operation +MODE_OF_OPERATION=${MODE_OF_OPERATION:-"deploy"} +if [ $MODE_OF_OPERATION == "deploy" ]; then + MODULES_DIR="$MONO_DIR/modules" +elif [ $MODE_OF_OPERATION == "develop" ]; then + MODULES_DIR="$MONO_DIR/modules/dev_overrides" +else + MODULES_DIR="$MONO_DIR/modules" +fi - if [ ! -z $VNC_PORT ]; then - echo "$SERVICE service exposes a VNC Server at $HOSTNAME:$VNC_PORT" - - LOCAL_FORWARD="-L ${VNC_PORT}:localhost:${VNC_PORT}" - LOCAL_FORWARD_ALL="${LOCAL_FORWARD_ALL} $LOCAL_FORWARD" - PORTS_STRING="${PORTS_STRING},${VNC_PORT}:${SERVICE}_VNC" - echo " To forward it locally, run" - echo " ssh$LOCAL_FORWARD $USER@$HOSTNAME" - echo " on your local machine attach to VNC at localhost:${VNC_PORT}" - echo - fi - done - - echo "=========================================================================" - echo "To forward all ports locally:" - echo "ssh $LOCAL_FORWARD_ALL $USER@$HOSTNAME" - echo "=========================================================================" +# generate .env file from watod_scripts/watod-setup-env.sh +if [ ! -z $VERBOSE ]; then # if we want to see all verbose coming from setting up env + cd $MONO_DIR && . ./watod_scripts/watod-setup-env.sh +else + cd $MONO_DIR && . ./watod_scripts/watod-setup-env.sh &> /dev/null fi if [ ! -z "$COMPOSE_CMD" ]; then ADDITIONAL_ARGS="" - # If we are starting a terminal, run docker-compose up with the -d argument + # If we are starting a terminal, run docker compose up with the -d argument if [ ! -z "$START_TERMINAL" ] && [[ ! " ${COMPOSE_CMD[@]} " =~ " -d " ]] && [[ " ${COMPOSE_CMD[@]} " =~ " up " ]]; then ADDITIONAL_ARGS="-d" fi - echo "Running docker-compose$COMPOSE_CMD $ADDITIONAL_ARGS:" - + echo "hi" run_compose ${COMPOSE_CMD[@]} ${ADDITIONAL_ARGS} fi diff --git a/watod-config.sh b/watod-config.sh index e583b4d..1ae6fa2 100755 --- a/watod-config.sh +++ b/watod-config.sh @@ -1,6 +1,13 @@ ## ----------------------- watod Configuration File Override ---------------------------- -## ACTIVE PROFILES CONFIGURATION -## List of active profiles to run, defined in docker-compose.yaml. + +## +## HINT: You can copy the contents of this file to a watod-config.local.sh +## file that is untrackable by git and readable by watod. +## + +## ----------------------- watod Configuration File Override ---------------------------- +## ACTIVE Modules CONFIGURATION +## List of active modules to run, defined in docker-compose.yaml. ## ## Possible values: ## - vis_tools : starts tools for data visualization (foxglove) @@ -8,15 +15,23 @@ ## - robot : starts up robot nodes ## - samples : starts up sample nodes for reference -# ACTIVE_PROFILES="" +# ACTIVE_MODULES="" +################################# MODE OF OPERATION ################################# +## Possible modes of operation when running watod. +## Possible values: +## - deploy (default) : runs production-grade containers (non-editable) +## - develop : runs developer containers (editable) -## Name to append to docker containers. DEFAULT = +# MODE_OF_OPERATION="" +############################## ADVANCED CONFIGURATIONS ############################## +## Name to append to docker containers. DEFAULT = "" # COMPOSE_PROJECT_NAME="" - ## Tag to use. Images are formatted as : with forward slashes replaced with dashes. -## DEFAULT = - +## DEFAULT = "" # TAG="" + +# Docker Registry to pull/push images. DEFAULT = "ghcr.io/watonomous/wato_monorepo" +# REGISTRY_URL="" \ No newline at end of file diff --git a/watod_scripts/watod-completion.bash b/watod_scripts/watod-completion.bash new file mode 100644 index 0000000..2b18a28 --- /dev/null +++ b/watod_scripts/watod-completion.bash @@ -0,0 +1,677 @@ +#!/bin/bash +# +# bash completion for watod +# +# This work is based on the completion for the docker command. +# Source: https://raw.githubusercontent.com/docker/compose/1.28.5/contrib/completion/bash/docker-compose +# +# This script provides completion of: +# - commands and their options +# - service names +# - filepaths +# +# To enable the completions either: +# - place this file in /etc/bash_completion.d +# or +# - copy this file to e.g. ~/.docker-compose-completion.sh and add the line +# below to your .bashrc after bash completion features are loaded +# . ~/.docker-compose-completion.sh + +__docker_compose_previous_extglob_setting=$(shopt -p extglob) +shopt -s extglob + +__docker_compose_q() { + watod -np 2>/dev/null "${top_level_options[@]}" "$@" | awk '{if(NR>1)print}' +} + +# Transforms a multiline list of strings into a single line string +# with the words separated by "|". +__docker_compose_to_alternatives() { + local parts=( $1 ) + local IFS='|' + echo "${parts[*]}" +} + +# Transforms a multiline list of options into an extglob pattern +# suitable for use in case statements. +__docker_compose_to_extglob() { + local extglob=$( __docker_compose_to_alternatives "$1" ) + echo "@($extglob)" +} + +# Determines whether the option passed as the first argument exist on +# the commandline. The option may be a pattern, e.g. `--force|-f`. +__docker_compose_has_option() { + local pattern="$1" + for (( i=2; i < $cword; ++i)); do + if [[ ${words[$i]} =~ ^($pattern)$ ]] ; then + return 0 + fi + done + return 1 +} + +# Returns `key` if we are currently completing the value of a map option (`key=value`) +# which matches the extglob passed in as an argument. +# This function is needed for key-specific completions. +__docker_compose_map_key_of_current_option() { + local glob="$1" + + local key glob_pos + if [ "$cur" = "=" ] ; then # key= case + key="$prev" + glob_pos=$((cword - 2)) + elif [[ $cur == *=* ]] ; then # key=value case (OSX) + key=${cur%=*} + glob_pos=$((cword - 1)) + elif [ "$prev" = "=" ] ; then + key=${words[$cword - 2]} # key=value case + glob_pos=$((cword - 3)) + else + return + fi + + [ "${words[$glob_pos]}" = "=" ] && ((glob_pos--)) # --option=key=value syntax + + [[ ${words[$glob_pos]} == @($glob) ]] && echo "$key" +} + +# suppress trailing whitespace +__docker_compose_nospace() { + # compopt is not available in ancient bash versions + type compopt &>/dev/null && compopt -o nospace +} + + +# Outputs a list of all defined services, regardless of their running state. +# Arguments for `docker-compose ps` may be passed in order to filter the service list, +# e.g. `status=running`. +__docker_compose_services() { + __docker_compose_q ps --services "$@" +} + +# Applies completion of services based on the current value of `$cur`. +# Arguments for `docker-compose ps` may be passed in order to filter the service list, +# see `__docker_compose_services`. +__docker_compose_complete_services() { + COMPREPLY=( $(compgen -W "$(__docker_compose_services "$@")" -- "$cur") ) +} + +# The services for which at least one running container exists +__docker_compose_complete_running_services() { + local names=$(__docker_compose_services --filter status=running) + COMPREPLY=( $(compgen -W "$names" -- "$cur") ) +} + + +_docker_compose_build() { + case "$prev" in + --build-arg) + COMPREPLY=( $( compgen -e -- "$cur" ) ) + __docker_compose_nospace + return + ;; + --memory|-m) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--build-arg --compress --force-rm --help --memory -m --no-cache --no-rm --pull --parallel -q --quiet" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_services --filter source=build + ;; + esac +} + + +_docker_compose_config() { + case "$prev" in + --hash) + if [[ $cur == \\* ]] ; then + COMPREPLY=( '\*' ) + else + COMPREPLY=( $(compgen -W "$(__docker_compose_services) \\\* " -- "$cur") ) + fi + return + ;; + esac + + COMPREPLY=( $( compgen -W "--hash --help --no-interpolate --quiet -q --resolve-image-digests --services --volumes" -- "$cur" ) ) +} + + +_docker_compose_create() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--build --force-recreate --help --no-build --no-recreate" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_services + ;; + esac +} + + +_docker_compose_docker_compose() { + case "$prev" in + --tlscacert|--tlscert|--tlskey) + _filedir + return + ;; + --file|-f) + _filedir "y?(a)ml" + return + ;; + --ansi) + COMPREPLY=( $( compgen -W "never always auto" -- "$cur" ) ) + return + ;; + --log-level) + COMPREPLY=( $( compgen -W "debug info warning error critical" -- "$cur" ) ) + return + ;; + --project-directory) + _filedir -d + return + ;; + --env-file) + _filedir + return + ;; + --terminal|-t) + __docker_compose_complete_running_services + return + ;; + $(__docker_compose_to_extglob "$daemon_options_with_args") ) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "$daemon_boolean_options $daemon_options_with_args $top_level_options_with_args --help -h --no-ansi --verbose --version -v" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) ) + ;; + esac +} + + +_docker_compose_down() { + case "$prev" in + --rmi) + COMPREPLY=( $( compgen -W "all local" -- "$cur" ) ) + return + ;; + --timeout|-t) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --rmi --timeout -t --volumes -v --remove-orphans" -- "$cur" ) ) + ;; + esac +} + + +_docker_compose_events() { + case "$prev" in + --json) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --json" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_services + ;; + esac +} + + +_docker_compose_exec() { + case "$prev" in + --index|--user|-u|--workdir|-w) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "-d --detach --help --index --privileged -T --user -u --workdir -w" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_running_services + ;; + esac +} + + +_docker_compose_help() { + COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) ) +} + +_docker_compose_images() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --quiet -q" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_services + ;; + esac +} + +_docker_compose_kill() { + case "$prev" in + -s) + COMPREPLY=( $( compgen -W "SIGHUP SIGINT SIGKILL SIGUSR1 SIGUSR2" -- "$(echo $cur | tr '[:lower:]' '[:upper:]')" ) ) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help -s" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_running_services + ;; + esac +} + + +_docker_compose_logs() { + case "$prev" in + --tail) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--follow -f --help --no-color --no-log-prefix --tail --timestamps -t" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_services + ;; + esac +} + + +_docker_compose_pause() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_running_services + ;; + esac +} + + +_docker_compose_port() { + case "$prev" in + --protocol) + COMPREPLY=( $( compgen -W "tcp udp" -- "$cur" ) ) + return; + ;; + --index) + return; + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --index --protocol" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_services + ;; + esac +} + + +_docker_compose_ps() { + local key=$(__docker_compose_map_key_of_current_option '--filter') + case "$key" in + source) + COMPREPLY=( $( compgen -W "build image" -- "${cur##*=}" ) ) + return + ;; + status) + COMPREPLY=( $( compgen -W "paused restarting running stopped" -- "${cur##*=}" ) ) + return + ;; + esac + + case "$prev" in + --filter) + COMPREPLY=( $( compgen -W "source status" -S "=" -- "$cur" ) ) + __docker_compose_nospace + return; + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--all -a --filter --help --quiet -q --services" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_services + ;; + esac +} + + +_docker_compose_pull() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --ignore-pull-failures --include-deps --no-parallel --quiet -q" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_services --filter source=image + ;; + esac +} + + +_docker_compose_push() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --ignore-push-failures" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_services + ;; + esac +} + + +_docker_compose_restart() { + case "$prev" in + --timeout|-t) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --timeout -t" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_running_services + ;; + esac +} + + +_docker_compose_rm() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--force -f --help --stop -s -v" -- "$cur" ) ) + ;; + *) + if __docker_compose_has_option "--stop|-s" ; then + __docker_compose_complete_services + else + __docker_compose_complete_services --filter status=stopped + fi + ;; + esac +} + + +_docker_compose_run() { + case "$prev" in + -e) + COMPREPLY=( $( compgen -e -- "$cur" ) ) + __docker_compose_nospace + return + ;; + --entrypoint|--label|-l|--name|--user|-u|--volume|-v|--workdir|-w) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--detach -d --entrypoint -e --help --label -l --name --no-deps --publish -p --rm --service-ports -T --use-aliases --user -u --volume -v --workdir -w" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_services + ;; + esac +} + + +_docker_compose_scale() { + case "$prev" in + =) + COMPREPLY=("$cur") + return + ;; + --timeout|-t) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --timeout -t" -- "$cur" ) ) + ;; + *) + COMPREPLY=( $(compgen -S "=" -W "$(__docker_compose_services)" -- "$cur") ) + __docker_compose_nospace + ;; + esac +} + + +_docker_compose_start() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_services --filter status=stopped + ;; + esac +} + + +_docker_compose_stop() { + case "$prev" in + --timeout|-t) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help --timeout -t" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_running_services + ;; + esac +} + + +_docker_compose_top() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_running_services + ;; + esac +} + + +_docker_compose_unpause() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_services --filter status=paused + ;; + esac +} + + +_docker_compose_up() { + case "$prev" in + =) + COMPREPLY=("$cur") + return + ;; + --exit-code-from) + __docker_compose_complete_services + return + ;; + --scale) + COMPREPLY=( $(compgen -S "=" -W "$(__docker_compose_services)" -- "$cur") ) + __docker_compose_nospace + return + ;; + --timeout|-t) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--abort-on-container-exit --always-recreate-deps --attach-dependencies --build -d --detach --exit-code-from --force-recreate --help --no-build --no-color --no-deps --no-log-prefix --no-recreate --no-start --renew-anon-volumes -V --remove-orphans --scale --timeout -t" -- "$cur" ) ) + ;; + *) + __docker_compose_complete_services + ;; + esac +} + + +_docker_compose_version() { + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--short" -- "$cur" ) ) + ;; + esac +} + + +_docker_compose() { + local previous_extglob_setting=$(shopt -p extglob) + shopt -s extglob + + local commands=( + build + config + create + down + events + exec + help + images + kill + logs + pause + port + ps + pull + push + restart + rm + run + scale + start + stop + top + unpause + up + version + ) + + # Options for the docker daemon that have to be passed to secondary calls to + # docker-compose executed by this script. + local daemon_boolean_options=" + --skip-hostname-check + --tls + --tlsverify + " + local daemon_options_with_args=" + --context -c + --env-file + --file -f + --host -H + --project-directory + --project-name -p + --tlscacert + --tlscert + --tlskey + " + + # These options are require special treatment when searching the command. + local top_level_options_with_args=" + --ansi + --log-level + --terminal -t + " + + COMPREPLY=() + local cur prev words cword + _get_comp_words_by_ref -n : cur prev words cword + + # search subcommand and invoke its handler. + # special treatment of some top-level options + local command='docker_compose' + local top_level_options=() + local counter=1 + + while [ $counter -lt $cword ]; do + case "${words[$counter]}" in + $(__docker_compose_to_extglob "$daemon_boolean_options") ) + local opt=${words[counter]} + top_level_options+=($opt) + ;; + $(__docker_compose_to_extglob "$daemon_options_with_args") ) + local opt=${words[counter]} + local arg=${words[++counter]} + top_level_options+=($opt $arg) + ;; + $(__docker_compose_to_extglob "$top_level_options_with_args") ) + (( counter++ )) + ;; + -*) + ;; + *) + command="${words[$counter]}" + break + ;; + esac + (( counter++ )) + done + + local completions_func=_docker_compose_${command//-/_} + declare -F $completions_func >/dev/null && $completions_func + + eval "$previous_extglob_setting" + return 0 +} + +eval "$__docker_compose_previous_extglob_setting" +unset __docker_compose_previous_extglob_setting + +complete -F _docker_compose watod diff --git a/scripts/watod-setup-env.sh b/watod_scripts/watod-setup-env.sh old mode 100755 new mode 100644 similarity index 64% rename from scripts/watod-setup-env.sh rename to watod_scripts/watod-setup-env.sh index 0913ec7..81e5069 --- a/scripts/watod-setup-env.sh +++ b/watod_scripts/watod-setup-env.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e # This script generates a .env file to be used with docker-compose # To override any of the variables in this script, create watod-config.sh @@ -10,17 +11,7 @@ if [ -f /.dockerenv ]; then exit 1 fi -MONO_DIR="$(dirname "$(realpath "$0")")" -# moves us one level out to the root monorepo directory -MONO_DIR=${MONO_DIR%/*} - -PROFILES_DIR="$MONO_DIR/profiles" - -# Allow for local overrides of any of the below parameters -if [ -f "$MONO_DIR/watod-config.sh" ]; then - source "$MONO_DIR/watod-config.sh" -fi - +# Retrieve git branch if ! [ -x "$(command -v git)" ]; then echo 'Error: git is not installed.' >&2 else @@ -28,6 +19,7 @@ else fi ## ----------------------- Configuration (Subject to Override) ---------------------------- + COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME:-watod_$USER} # Tag to use. Images as formatted as :- with forward slashes replaced @@ -41,12 +33,16 @@ TAG=${TAG/\//-} # - vis_tools : starts visualization tools (vnc and foxglove) # - production : configs for all containers required in production # - samples : starts sample ROS2 pubsub nodes -ACTIVE_PROFILES=${ACTIVE_PROFILES:-""} +ACTIVE_MODULES=${ACTIVE_MODULES:-""} + +# Docker Registry to pull/push images +REGISTRY_URL=${REGISTRY_URL:-"ghcr.io/watonomous/wato_monorepo"} -# List of profiles to IGNORE when using the --all flag -PROFILE_BLACKLIST=${PROFILE_BLACKLIST:-""} +REGISTRY=$(echo "$REGISTRY_URL" | sed 's|^\(.*\)/.*$|\1|') +REPOSITORY=$(echo "$REGISTRY_URL" | sed 's|^.*/\(.*\)$|\1|') ## --------------------------- Images ------------------------------- +# NOTE: ALL IMAGE NAMES MUCH BE IN THE FORMAT OF _ # ROS2 C++ Samples SAMPLES_CPP_AGGREGATOR_IMAGE=${SAMPLES_CPP_AGGREGATOR_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_monorepo/samples_cpp_aggregator"} @@ -61,54 +57,50 @@ SAMPLES_PYTHON_TRANSFORMER_IMAGE=${SAMPLES_PYTHON_TRANSFORMER_IMAGE:-"git.uwater # ASD Training Images GAZEBO_SERVER_IMAGE=${GAZEBO_SERVER_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_asd_training/gazebo_server"} INFRASTRUCTURE_FOXGLOVE_IMAGE=${INFRASTRUCTURE_FOXGLOVE_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_asd_training/infrastructure_foxglove"} -ROBOT_OCCUPANCY_IMAGE=${ROBOT_OCCUPANCY_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_monorepo/robot_occupancy"} +ROBOT_COSTMAP_IMAGE=${ROBOT_COSTMAP_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_monorepo/robot_costmap"} ROBOT_NAV_IMAGE=${ROBOT_NAV_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_monorepo/robot_nav"} ROBOT_CONTROL_IMAGE=${ROBOT_CONTROL_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_monorepo/robot_control"} ## --------------------------- Ports ------------------------------ BASE_PORT=${BASE_PORT:-$(($(id -u)*20))} -GUI_TOOLS_VNC_PORT=${GUI_TOOLS_VNC_PORT:-$((BASE_PORT++))} FOXGLOVE_BRIDGE_PORT=${FOXGLOVE_BRIDGE_PORT:-$((BASE_PORT++))} GAZEBO_PORT=${GAZEBO_PORT:-$((BASE_PORT++))} ## -------------------- Environment Variables ------------------------- # General -echo "# Auto-generated by ${BASH_SOURCE[0]}. Please do not edit." > "$PROFILES_DIR/.env" +echo "$MODULES_DIR" +echo "# Auto-generated by ${BASH_SOURCE[0]}. Edit at own risk." > "$MODULES_DIR/.env" -echo "PROFILES_DIR=$PROFILES_DIR" >> "$PROFILES_DIR/.env" -echo "MONO_DIR=$MONO_DIR" >> "$PROFILES_DIR/.env" +echo "MODULES_DIR=$MODULES_DIR" >> "$MODULES_DIR/.env" +echo "MONO_DIR=$MONO_DIR" >> "$MODULES_DIR/.env" -echo "ACTIVE_PROFILES=\"$ACTIVE_PROFILES\"" >> "$PROFILES_DIR/.env" -echo "PROFILE_BLACKLIST=\"$PROFILE_BLACKLIST\"" >> "$PROFILES_DIR/.env" +echo "ACTIVE_MODULES=\"$ACTIVE_MODULES\"" >> "$MODULES_DIR/.env" -echo "COMPOSE_DOCKER_CLI_BUILD=1" >> "$PROFILES_DIR/.env" -echo "COMPOSE_PROJECT_NAME=$COMPOSE_PROJECT_NAME" >> "$PROFILES_DIR/.env" +echo "COMPOSE_DOCKER_CLI_BUILD=1" >> "$MODULES_DIR/.env" +echo "COMPOSE_PROJECT_NAME=$COMPOSE_PROJECT_NAME" >> "$MODULES_DIR/.env" -echo "TAG=$TAG" >> "$PROFILES_DIR/.env" -echo "TARGET_STAGE=$TARGET_STAGE" >> "$PROFILES_DIR/.env" +echo "TAG=$TAG" >> "$MODULES_DIR/.env" # Ports -echo "BASE_PORT=$BASE_PORT" >> "$PROFILES_DIR/.env" -echo "FOXGLOVE_BRIDGE_PORT=$FOXGLOVE_BRIDGE_PORT" >> "$PROFILES_DIR/.env" -echo "GAZEBO_PORT=$GAZEBO_PORT" >> "$PROFILES_DIR/.env" +echo "BASE_PORT=$BASE_PORT" >> "$MODULES_DIR/.env" +echo "FOXGLOVE_BRIDGE_PORT=$FOXGLOVE_BRIDGE_PORT" >> "$MODULES_DIR/.env" +echo "GAZEBO_PORT=$GAZEBO_PORT" >> "$MODULES_DIR/.env" # ROS2 C++ Samples -echo "SAMPLES_CPP_AGGREGATOR_IMAGE=$SAMPLES_CPP_AGGREGATOR_IMAGE" >> "$PROFILES_DIR/.env" -echo "SAMPLES_CPP_PRODUCER_IMAGE=$SAMPLES_CPP_PRODUCER_IMAGE" >> "$PROFILES_DIR/.env" -echo "SAMPLES_CPP_TRANSFORMER_IMAGE=$SAMPLES_CPP_TRANSFORMER_IMAGE" >> "$PROFILES_DIR/.env" +echo "SAMPLES_CPP_AGGREGATOR_IMAGE=$SAMPLES_CPP_AGGREGATOR_IMAGE" >> "$MODULES_DIR/.env" +echo "SAMPLES_CPP_PRODUCER_IMAGE=$SAMPLES_CPP_PRODUCER_IMAGE" >> "$MODULES_DIR/.env" +echo "SAMPLES_CPP_TRANSFORMER_IMAGE=$SAMPLES_CPP_TRANSFORMER_IMAGE" >> "$MODULES_DIR/.env" # ROS2 Python Samples -echo "SAMPLES_PYTHON_AGGREGATOR_IMAGE=$SAMPLES_PYTHON_AGGREGATOR_IMAGE" >> "$PROFILES_DIR/.env" -echo "SAMPLES_PYTHON_PRODUCER_IMAGE=$SAMPLES_PYTHON_PRODUCER_IMAGE" >> "$PROFILES_DIR/.env" -echo "SAMPLES_PYTHON_TRANSFORMER_IMAGE=$SAMPLES_PYTHON_TRANSFORMER_IMAGE" >> "$PROFILES_DIR/.env" +echo "SAMPLES_PYTHON_AGGREGATOR_IMAGE=$SAMPLES_PYTHON_AGGREGATOR_IMAGE" >> "$MODULES_DIR/.env" +echo "SAMPLES_PYTHON_PRODUCER_IMAGE=$SAMPLES_PYTHON_PRODUCER_IMAGE" >> "$MODULES_DIR/.env" +echo "SAMPLES_PYTHON_TRANSFORMER_IMAGE=$SAMPLES_PYTHON_TRANSFORMER_IMAGE" >> "$MODULES_DIR/.env" # ASD Training Images -echo "GAZEBO_SERVER_IMAGE=$GAZEBO_SERVER_IMAGE" >> "$PROFILES_DIR/.env" -echo "INFRASTRUCTURE_FOXGLOVE_IMAGE=$INFRASTRUCTURE_FOXGLOVE_IMAGE" >> "$PROFILES_DIR/.env" -echo "ROBOT_OCCUPANCY_IMAGE=$ROBOT_OCCUPANCY_IMAGE" >> "$PROFILES_DIR/.env" -echo "ROBOT_NAV_IMAGE=$ROBOT_NAV_IMAGE" >> "$PROFILES_DIR/.env" -echo "ROBOT_CONTROL_IMAGE=$ROBOT_CONTROL_IMAGE" >> "$PROFILES_DIR/.env" - -cat $PROFILES_DIR/.env \ No newline at end of file +echo "GAZEBO_SERVER_IMAGE=$GAZEBO_SERVER_IMAGE" >> "$MODULES_DIR/.env" +echo "INFRASTRUCTURE_FOXGLOVE_IMAGE=$INFRASTRUCTURE_FOXGLOVE_IMAGE" >> "$MODULES_DIR/.env" +echo "ROBOT_COSTMAP_IMAGE=$ROBOT_COSTMAP_IMAGE" >> "$MODULES_DIR/.env" +echo "ROBOT_NAV_IMAGE=$ROBOT_NAV_IMAGE" >> "$MODULES_DIR/.env" +echo "ROBOT_CONTROL_IMAGE=$ROBOT_CONTROL_IMAGE" >> "$MODULES_DIR/.env" From 61037bd7e16472eb4cfad3d38ef7cc1a40b389b3 Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Thu, 17 Oct 2024 03:07:43 +0000 Subject: [PATCH 3/4] develop mode within the training repo --- .vscode/settings.json | 3 - modules/docker-compose.gazebo.yaml | 2 +- modules/docker-compose.robot.yaml | 28 ++++----- modules/docker-compose.samples.yaml | 88 +++++++++++++++++++-------- modules/docker-compose.vis_tools.yaml | 4 +- src/samples/README.md | 6 +- watod | 13 +--- watod-config.sh | 4 +- watod_scripts/watod-setup-env.sh | 38 ++++-------- 9 files changed, 98 insertions(+), 88 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 9ddf6b2..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "cmake.ignoreCMakeListsMissing": true -} \ No newline at end of file diff --git a/modules/docker-compose.gazebo.yaml b/modules/docker-compose.gazebo.yaml index 175bf25..38b40a4 100644 --- a/modules/docker-compose.gazebo.yaml +++ b/modules/docker-compose.gazebo.yaml @@ -1,4 +1,3 @@ -version: "3.9" services: gazeboserver: build: @@ -12,6 +11,7 @@ services: tty: true ports: - "${GAZEBO_PORT:?}:9002" + profiles: [deploy, develop] command: /bin/bash -c "ros2 launch gazebo sim.launch.py" volumes: - ../src/gazebo/launch:/root/src/gazebo/launch diff --git a/modules/docker-compose.robot.yaml b/modules/docker-compose.robot.yaml index d05d5a8..2d52cf8 100644 --- a/modules/docker-compose.robot.yaml +++ b/modules/docker-compose.robot.yaml @@ -1,21 +1,21 @@ -version: "3.8" services: robot: - build: + build: &robot_build context: .. dockerfile: docker/robot/robot.Dockerfile cache_from: - - "${ROBOT_COSTMAP_IMAGE:?}:${TAG}" - - "${ROBOT_COSTMAP_IMAGE:?}:main" - image: "${ROBOT_COSTMAP_IMAGE:?}:${TAG}" + - "${ROBOT_IMAGE:?}:${TAG}" + - "${ROBOT_IMAGE:?}:main" + image: "${ROBOT_IMAGE:?}:${TAG}" + profiles: + - deploy command: /bin/bash -c "ros2 launch bringup_robot robot.launch.py" - # robot_dev: - # extends: - # service: robot - # build: - # target: develop - # image: "${ROBOT_COSTMAP_IMAGE:?}:dev_${TAG}" - # command: tail -F anything - # volumes: - # - ${MONO_DIR}/src/robot:/root/ament_ws/src + robot_dev: + build: *robot_build + image: "${ROBOT_IMAGE:?}:dev_${TAG}" + command: tail -F anything + profiles: + - develop + volumes: + - ${MONO_DIR}/src/robot:/root/ament_ws/src diff --git a/modules/docker-compose.samples.yaml b/modules/docker-compose.samples.yaml index ed06ef6..35c27ac 100644 --- a/modules/docker-compose.samples.yaml +++ b/modules/docker-compose.samples.yaml @@ -1,67 +1,105 @@ -version: "3.8" services: # aggregator: # C++ - # build: + # build: &aggregator_build # context: .. # dockerfile: docker/samples/cpp/aggregator.Dockerfile # cache_from: - # - "${SAMPLES_CPP_AGGREGATOR_IMAGE:?}:${TAG}" - # - "${SAMPLES_CPP_AGGREGATOR_IMAGE:?}:main" - # image: "${SAMPLES_CPP_AGGREGATOR_IMAGE:?}:${TAG}" + # - "${SAMPLES_AGGREGATOR_IMAGE:?}:${TAG}" + # - "${SAMPLES_AGGREGATOR_IMAGE:?}:main" + # image: "${SAMPLES_AGGREGATOR_IMAGE:?}:${TAG}" + # profiles: [deploy] + # command: /bin/bash -c "ros2 launch aggregator aggregator.launch.py" # volumes: # - ${MONO_DIR}/src/samples/cpp/aggregator:/root/ament_ws/src/aggregator aggregator: # PYTHON - build: + build: &aggregator_build context: .. dockerfile: docker/samples/python/aggregator.Dockerfile cache_from: - - "${SAMPLES_PYTHON_AGGREGATOR_IMAGE:?}:${TAG}" - - "${SAMPLES_PYTHON_AGGREGATOR_IMAGE:?}:main" - image: "${SAMPLES_PYTHON_AGGREGATOR_IMAGE:?}:${TAG}" + - "${SAMPLES_AGGREGATOR_IMAGE:?}:${TAG}" + - "${SAMPLES_AGGREGATOR_IMAGE:?}:main" + image: "${SAMPLES_AGGREGATOR_IMAGE:?}:${TAG}" + profiles: [deploy] + command: /bin/bash -c "ros2 launch aggregator aggregator.launch.py" volumes: - ${MONO_DIR}/src/samples/python/aggregator:/root/ament_ws/src/aggregator producer: # C++ - build: + build: &producer_build context: .. dockerfile: docker/samples/cpp/producer.Dockerfile cache_from: - - "${SAMPLES_CPP_PRODUCER_IMAGE:?}:${TAG}" - - "${SAMPLES_CPP_PRODUCER_IMAGE:?}:main" - image: "${SAMPLES_CPP_PRODUCER_IMAGE:?}:${TAG}" + - "${SAMPLES_PRODUCER_IMAGE:?}:${TAG}" + - "${SAMPLES_PRODUCER_IMAGE:?}:main" + image: "${SAMPLES_PRODUCER_IMAGE:?}:${TAG}" + profiles: [deploy] + command: /bin/bash -c "ros2 launch producer producer.launch.py" volumes: - ${MONO_DIR}/src/samples/cpp/producer:/root/ament_ws/src/producer # producer: # PYTHON - # build: + # build: &producer_build # context: .. # dockerfile: docker/samples/python/producer.Dockerfile # cache_from: - # - "${SAMPLES_PYTHON_PRODUCER_IMAGE:?}:${TAG}" - # - "${SAMPLES_PYTHON_PRODUCER_IMAGE:?}:main" - # image: "${SAMPLES_PYTHON_PRODUCER_IMAGE:?}:${TAG}" + # - "${SAMPLES_PRODUCER_IMAGE:?}:${TAG}" + # - "${SAMPLES_PRODUCER_IMAGE:?}:main" + # image: "${SAMPLES_PRODUCER_IMAGE:?}:${TAG}" + # profiles: [deploy] + # command: /bin/bash -c "ros2 launch producer producer.launch.py" # volumes: # - ${MONO_DIR}/src/samples/python/producer:/root/ament_ws/src/producer transformer: # C++ - build: + build: &transformer_build context: .. dockerfile: docker/samples/cpp/transformer.Dockerfile cache_from: - - "${SAMPLES_CPP_TRANSFORMER_IMAGE:?}:${TAG}" - - "${SAMPLES_CPP_TRANSFORMER_IMAGE:?}:main" - image: "${SAMPLES_CPP_TRANSFORMER_IMAGE:?}:${TAG}" + - "${SAMPLES_TRANSFORMER_IMAGE:?}:${TAG}" + - "${SAMPLES_TRANSFORMER_IMAGE:?}:main" + image: "${SAMPLES_TRANSFORMER_IMAGE:?}:${TAG}" + profiles: [deploy] + command: /bin/bash -c "ros2 launch transformer transformer.launch.py" volumes: - ${MONO_DIR}/src/samples/cpp/transformer:/root/ament_ws/src/transformer # transformer: # PYTHON - # build: + # build: &transformer_build # context: .. # dockerfile: docker/samples/python/transformer.Dockerfile # cache_from: - # - "${SAMPLES_PYTHON_TRANSFORMER_IMAGE:?}:${TAG}" - # - "${SAMPLES_PYTHON_TRANSFORMER_IMAGE:?}:main" - # image: "${SAMPLES_PYTHON_TRANSFORMER_IMAGE:?}:${TAG}" + # - "${SAMPLES_TRANSFORMER_IMAGE:?}:${TAG}" + # - "${SAMPLES_TRANSFORMER_IMAGE:?}:main" + # image: "${SAMPLES_TRANSFORMER_IMAGE:?}:${TAG}" + # profiles: [deploy] + # command: /bin/bash -c "ros2 launch transformer transformer.launch.py" # volumes: # - ${MONO_DIR}/src/samples/python/transformer:/root/ament_ws/src/transformer + + aggregator_dev: + build: *aggregator_build + image: "${SAMPLES_AGGREGATOR_IMAGE}:dev_${TAG}" + command: tail -F anything + profiles: [develop] + volumes: + - ${MONO_DIR}/src/samples/python/aggregator:/root/ament_ws/src/python/aggregator + - ${MONO_DIR}/src/samples/cpp/aggregator:/root/ament_ws/src/cpp/aggregator + + producer_dev: + build: *producer_build + image: "${SAMPLES_PRODUCER_IMAGE}:dev_${TAG}" + command: tail -F anything + profiles: [develop] + volumes: + - ${MONO_DIR}/src/samples/python/producer:/root/ament_ws/src/python/producer + - ${MONO_DIR}/src/samples/cpp/producer:/root/ament_ws/src/cpp/producer + + transformer_dev: + build: *transformer_build + image: "${SAMPLES_TRANSFORMER_IMAGE}:dev_${TAG}" + command: tail -F anything + profiles: [develop] + volumes: + - ${MONO_DIR}/src/samples/python/transformer:/root/ament_ws/src/python/transformer + - ${MONO_DIR}/src/samples/cpp/transformer:/root/ament_ws/src/cpp/transformer diff --git a/modules/docker-compose.vis_tools.yaml b/modules/docker-compose.vis_tools.yaml index b46f01c..1341930 100644 --- a/modules/docker-compose.vis_tools.yaml +++ b/modules/docker-compose.vis_tools.yaml @@ -1,4 +1,3 @@ -version: "3.8" services: foxglove: build: @@ -8,8 +7,7 @@ services: - "${INFRASTRUCTURE_FOXGLOVE_IMAGE:?}:${TAG}" - "${INFRASTRUCTURE_FOXGLOVE_IMAGE:?}:main" image: "${INFRASTRUCTURE_FOXGLOVE_IMAGE:?}:${TAG}" + profiles: [deploy, develop] command: ["ros2", "launch", "foxglove_bridge", "foxglove_bridge_launch.xml", "port:=${FOXGLOVE_BRIDGE_PORT:?}"] - #command: ["ros2", "launch", "foxglove_bridge", "foxglove_bridge_launch.xml", "port:=8765", "send_buffer_limit:=1000", "min_qos_depth:=5", "use_compression:=true"] - # command: bash -c "ros2 run topic_tools relay /tf /tf_new & ros2 launch rosbridge_server rosbridge_websocket_launch.xml && fg" ports: - "${FOXGLOVE_BRIDGE_PORT:?}:${FOXGLOVE_BRIDGE_PORT:?}" diff --git a/src/samples/README.md b/src/samples/README.md index f4291b4..74d3363 100644 --- a/src/samples/README.md +++ b/src/samples/README.md @@ -34,7 +34,7 @@ To configure watod, update `watod-config.local.sh` to include the samples profil #!/bin/bash from watod-config.sh -ACTIVE_PROFILES="samples" +ACTIVE_MODULES="samples" ``` Then bring up the containers with, @@ -43,9 +43,9 @@ watod up ``` ### C++ and Python Samples -In the [Samples Profile](../../profiles/docker-compose.samples.yaml), you'll see that some of the services are commented out. The Python and C++ nodes are functionally equivalent. That is, if you were to switch out any of the C++ nodes with Python nodes by commenting and uncommenting their respective service, then the overall ROS2 communication pipeline will not change. +In the [Samples Module](../../modules/docker-compose.samples.yaml), you'll see that some of the services are commented out. The Python and C++ nodes are functionally equivalent. That is, if you were to switch out any of the C++ nodes with Python nodes by commenting and uncommenting their respective service, then the overall ROS2 communication pipeline will not change. -Editing the profiles of the monorepo can be important during development, especially when you don't want to run the entire profile. +Editing the modules of the monorepo can be important during development, especially when you don't want to run the entire profile. ### Development The development workflow in ROS2 is similar to ROS, however, it uses a different set diff --git a/watod b/watod index 7d28200..31f11be 100755 --- a/watod +++ b/watod @@ -27,9 +27,9 @@ function run_compose { if [ ! -z "$(source $MODULES_DIR/.env && echo $ACTIVE_MODULES)" ] && [ -z "$MODULES" ]; then MODULES="$(source $MODULES_DIR/.env && printf -- " -f $MODULES_DIR/docker-compose.%s.yaml" ${ACTIVE_MODULES[@]})" fi - echo "Running docker compose ${MODULES[@]} $@" + echo "Running docker compose --profile ${MODE_OF_OPERATION}${MODULES[@]} $@" - DOCKER_BUILDKIT=${DOCKER_BUILDKIT:-1} docker compose ${MODULES[@]} "$@" + DOCKER_BUILDKIT=${DOCKER_BUILDKIT:-1} docker compose --profile ${MODE_OF_OPERATION[@]}${MODULES[@]} "$@" } # in case you need help @@ -80,15 +80,7 @@ elif [ -f "$MONO_DIR/watod-config.sh" ]; then source "$MONO_DIR/watod-config.sh" fi -# Change docker-compose override according to mode of operation MODE_OF_OPERATION=${MODE_OF_OPERATION:-"deploy"} -if [ $MODE_OF_OPERATION == "deploy" ]; then - MODULES_DIR="$MONO_DIR/modules" -elif [ $MODE_OF_OPERATION == "develop" ]; then - MODULES_DIR="$MONO_DIR/modules/dev_overrides" -else - MODULES_DIR="$MONO_DIR/modules" -fi # generate .env file from watod_scripts/watod-setup-env.sh if [ ! -z $VERBOSE ]; then # if we want to see all verbose coming from setting up env @@ -103,7 +95,6 @@ if [ ! -z "$COMPOSE_CMD" ]; then if [ ! -z "$START_TERMINAL" ] && [[ ! " ${COMPOSE_CMD[@]} " =~ " -d " ]] && [[ " ${COMPOSE_CMD[@]} " =~ " up " ]]; then ADDITIONAL_ARGS="-d" fi - echo "hi" run_compose ${COMPOSE_CMD[@]} ${ADDITIONAL_ARGS} fi diff --git a/watod-config.sh b/watod-config.sh index 1ae6fa2..86a58bb 100755 --- a/watod-config.sh +++ b/watod-config.sh @@ -15,7 +15,7 @@ ## - robot : starts up robot nodes ## - samples : starts up sample nodes for reference -# ACTIVE_MODULES="" +ACTIVE_MODULES="robot gazebo vis_tools" ################################# MODE OF OPERATION ################################# ## Possible modes of operation when running watod. @@ -23,7 +23,7 @@ ## - deploy (default) : runs production-grade containers (non-editable) ## - develop : runs developer containers (editable) -# MODE_OF_OPERATION="" +MODE_OF_OPERATION="develop" ############################## ADVANCED CONFIGURATIONS ############################## ## Name to append to docker containers. DEFAULT = "" diff --git a/watod_scripts/watod-setup-env.sh b/watod_scripts/watod-setup-env.sh index 81e5069..6da895f 100644 --- a/watod_scripts/watod-setup-env.sh +++ b/watod_scripts/watod-setup-env.sh @@ -36,7 +36,7 @@ TAG=${TAG/\//-} ACTIVE_MODULES=${ACTIVE_MODULES:-""} # Docker Registry to pull/push images -REGISTRY_URL=${REGISTRY_URL:-"ghcr.io/watonomous/wato_monorepo"} +REGISTRY_URL=${REGISTRY_URL:-"ghcr.io/watonomous/wato_asd_training"} REGISTRY=$(echo "$REGISTRY_URL" | sed 's|^\(.*\)/.*$|\1|') REPOSITORY=$(echo "$REGISTRY_URL" | sed 's|^.*/\(.*\)$|\1|') @@ -45,21 +45,14 @@ REPOSITORY=$(echo "$REGISTRY_URL" | sed 's|^.*/\(.*\)$|\1|') # NOTE: ALL IMAGE NAMES MUCH BE IN THE FORMAT OF _ # ROS2 C++ Samples -SAMPLES_CPP_AGGREGATOR_IMAGE=${SAMPLES_CPP_AGGREGATOR_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_monorepo/samples_cpp_aggregator"} -SAMPLES_CPP_PRODUCER_IMAGE=${SAMPLES_CPP_PRODUCER_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_monorepo/samples_cpp_producer"} -SAMPLES_CPP_TRANSFORMER_IMAGE=${SAMPLES_CPP_TRANSFORMER_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_monorepo/samples_cpp_transformer"} - -# ROS2 Python Samples -SAMPLES_PYTHON_AGGREGATOR_IMAGE=${SAMPLES_PYTHON_AGGREGATOR_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_monorepo/samples_python_aggregator"} -SAMPLES_PYTHON_PRODUCER_IMAGE=${SAMPLES_PYTHON_PRODUCER_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_monorepo/samples_python_producer"} -SAMPLES_PYTHON_TRANSFORMER_IMAGE=${SAMPLES_PYTHON_TRANSFORMER_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_monorepo/samples_python_transformer"} +SAMPLES_AGGREGATOR_IMAGE=${SAMPLES_AGGREGATOR_IMAGE:-"$REGISTRY_URL/samples_aggregator"} +SAMPLES_PRODUCER_IMAGE=${SAMPLES_PRODUCER_IMAGE:-"$REGISTRY_URL/samples_producer"} +SAMPLES_TRANSFORMER_IMAGE=${SAMPLES_TRANSFORMER_IMAGE:-"$REGISTRY_URL/samples_transformer"} # ASD Training Images -GAZEBO_SERVER_IMAGE=${GAZEBO_SERVER_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_asd_training/gazebo_server"} -INFRASTRUCTURE_FOXGLOVE_IMAGE=${INFRASTRUCTURE_FOXGLOVE_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_asd_training/infrastructure_foxglove"} -ROBOT_COSTMAP_IMAGE=${ROBOT_COSTMAP_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_monorepo/robot_costmap"} -ROBOT_NAV_IMAGE=${ROBOT_NAV_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_monorepo/robot_nav"} -ROBOT_CONTROL_IMAGE=${ROBOT_CONTROL_IMAGE:-"git.uwaterloo.ca:5050/watonomous/wato_monorepo/robot_control"} +GAZEBO_SERVER_IMAGE=${GAZEBO_SERVER_IMAGE:-"$REGISTRY_URL/gazebo_server"} +INFRASTRUCTURE_FOXGLOVE_IMAGE=${INFRASTRUCTURE_FOXGLOVE_IMAGE:-"$REGISTRY_URL/infrastructure_foxglove"} +ROBOT_IMAGE=${ROBOT_IMAGE:-"$REGISTRY_URL/robot"} ## --------------------------- Ports ------------------------------ @@ -88,19 +81,12 @@ echo "BASE_PORT=$BASE_PORT" >> "$MODULES_DIR/.env" echo "FOXGLOVE_BRIDGE_PORT=$FOXGLOVE_BRIDGE_PORT" >> "$MODULES_DIR/.env" echo "GAZEBO_PORT=$GAZEBO_PORT" >> "$MODULES_DIR/.env" -# ROS2 C++ Samples -echo "SAMPLES_CPP_AGGREGATOR_IMAGE=$SAMPLES_CPP_AGGREGATOR_IMAGE" >> "$MODULES_DIR/.env" -echo "SAMPLES_CPP_PRODUCER_IMAGE=$SAMPLES_CPP_PRODUCER_IMAGE" >> "$MODULES_DIR/.env" -echo "SAMPLES_CPP_TRANSFORMER_IMAGE=$SAMPLES_CPP_TRANSFORMER_IMAGE" >> "$MODULES_DIR/.env" - -# ROS2 Python Samples -echo "SAMPLES_PYTHON_AGGREGATOR_IMAGE=$SAMPLES_PYTHON_AGGREGATOR_IMAGE" >> "$MODULES_DIR/.env" -echo "SAMPLES_PYTHON_PRODUCER_IMAGE=$SAMPLES_PYTHON_PRODUCER_IMAGE" >> "$MODULES_DIR/.env" -echo "SAMPLES_PYTHON_TRANSFORMER_IMAGE=$SAMPLES_PYTHON_TRANSFORMER_IMAGE" >> "$MODULES_DIR/.env" +# ROS2 Samples +echo "SAMPLES_AGGREGATOR_IMAGE=$SAMPLES_AGGREGATOR_IMAGE" >> "$MODULES_DIR/.env" +echo "SAMPLES_PRODUCER_IMAGE=$SAMPLES_PRODUCER_IMAGE" >> "$MODULES_DIR/.env" +echo "SAMPLES_TRANSFORMER_IMAGE=$SAMPLES_TRANSFORMER_IMAGE" >> "$MODULES_DIR/.env" # ASD Training Images echo "GAZEBO_SERVER_IMAGE=$GAZEBO_SERVER_IMAGE" >> "$MODULES_DIR/.env" echo "INFRASTRUCTURE_FOXGLOVE_IMAGE=$INFRASTRUCTURE_FOXGLOVE_IMAGE" >> "$MODULES_DIR/.env" -echo "ROBOT_COSTMAP_IMAGE=$ROBOT_COSTMAP_IMAGE" >> "$MODULES_DIR/.env" -echo "ROBOT_NAV_IMAGE=$ROBOT_NAV_IMAGE" >> "$MODULES_DIR/.env" -echo "ROBOT_CONTROL_IMAGE=$ROBOT_CONTROL_IMAGE" >> "$MODULES_DIR/.env" +echo "ROBOT_IMAGE=$ROBOT_IMAGE" >> "$MODULES_DIR/.env" From 11162fba36bc859c87e2349855d901b21af99c89 Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Thu, 31 Oct 2024 21:34:19 +0000 Subject: [PATCH 4/4] assignment skeleton --- docker/robot/robot.Dockerfile | 4 +- src/robot/control/package.xml | 2 +- src/robot/costmap/include/costmap_core.hpp | 4 -- src/robot/costmap/include/costmap_node.hpp | 3 -- src/robot/costmap/package.xml | 3 ++ src/robot/map_server/CMakeLists.txt | 40 +++++++++++++++++++ .../map_server/include/map_server_core.hpp | 17 ++++++++ .../map_server/include/map_server_node.hpp | 16 ++++++++ src/robot/map_server/package.xml | 25 ++++++++++++ src/robot/map_server/src/map_server_core.cpp | 8 ++++ src/robot/map_server/src/map_server_node.cpp | 16 ++++++++ src/robot/nav/include/nav_core.hpp | 16 -------- src/robot/nav/include/nav_node.hpp | 15 ------- src/robot/nav/src/nav_core.cpp | 9 ----- src/robot/nav/src/nav_node.cpp | 16 -------- src/robot/{nav => planner}/CMakeLists.txt | 18 ++++----- src/robot/planner/include/planner_core.hpp | 17 ++++++++ src/robot/planner/include/planner_node.hpp | 16 ++++++++ src/robot/{nav => planner}/package.xml | 7 +++- src/robot/planner/src/planner_core.cpp | 8 ++++ src/robot/planner/src/planner_node.cpp | 16 ++++++++ src/robot/state_machine/CMakeLists.txt | 40 +++++++++++++++++++ .../include/state_machine_core.hpp | 17 ++++++++ .../include/state_machine_node.hpp | 16 ++++++++ src/robot/state_machine/package.xml | 25 ++++++++++++ .../state_machine/src/state_machine_core.cpp | 8 ++++ .../state_machine/src/state_machine_node.cpp | 16 ++++++++ 27 files changed, 322 insertions(+), 76 deletions(-) create mode 100644 src/robot/map_server/CMakeLists.txt create mode 100644 src/robot/map_server/include/map_server_core.hpp create mode 100644 src/robot/map_server/include/map_server_node.hpp create mode 100644 src/robot/map_server/package.xml create mode 100644 src/robot/map_server/src/map_server_core.cpp create mode 100644 src/robot/map_server/src/map_server_node.cpp delete mode 100644 src/robot/nav/include/nav_core.hpp delete mode 100644 src/robot/nav/include/nav_node.hpp delete mode 100644 src/robot/nav/src/nav_core.cpp delete mode 100644 src/robot/nav/src/nav_node.cpp rename src/robot/{nav => planner}/CMakeLists.txt (74%) create mode 100644 src/robot/planner/include/planner_core.hpp create mode 100644 src/robot/planner/include/planner_node.hpp rename src/robot/{nav => planner}/package.xml (76%) create mode 100644 src/robot/planner/src/planner_core.cpp create mode 100644 src/robot/planner/src/planner_node.cpp create mode 100644 src/robot/state_machine/CMakeLists.txt create mode 100644 src/robot/state_machine/include/state_machine_core.hpp create mode 100644 src/robot/state_machine/include/state_machine_node.hpp create mode 100644 src/robot/state_machine/package.xml create mode 100644 src/robot/state_machine/src/state_machine_core.cpp create mode 100644 src/robot/state_machine/src/state_machine_node.cpp diff --git a/docker/robot/robot.Dockerfile b/docker/robot/robot.Dockerfile index e1b1d72..a1c288f 100644 --- a/docker/robot/robot.Dockerfile +++ b/docker/robot/robot.Dockerfile @@ -7,7 +7,9 @@ WORKDIR ${AMENT_WS}/src # Copy in source code COPY src/robot/costmap costmap -COPY src/robot/nav nav +COPY src/robot/map_server map_server +COPY src/robot/planner planner +COPY src/robot/state_machine state_machine COPY src/robot/control control COPY src/robot/bringup_robot bringup_robot diff --git a/src/robot/control/package.xml b/src/robot/control/package.xml index d8c00b6..97c448b 100644 --- a/src/robot/control/package.xml +++ b/src/robot/control/package.xml @@ -4,7 +4,7 @@ 0.0.0 A sample ROS package for pubsub communication - Owen Leather + Eddy Zhou TODO diff --git a/src/robot/costmap/include/costmap_core.hpp b/src/robot/costmap/include/costmap_core.hpp index b8111e0..a9870ee 100644 --- a/src/robot/costmap/include/costmap_core.hpp +++ b/src/robot/costmap/include/costmap_core.hpp @@ -6,10 +6,6 @@ namespace robot { -/** - * Implementation of the internal logic used by the Aggregator Node to - * calculate the operating frequency of topics. - */ class CostmapCore { public: explicit CostmapCore(); diff --git a/src/robot/costmap/include/costmap_node.hpp b/src/robot/costmap/include/costmap_node.hpp index 5ff3555..4768edb 100644 --- a/src/robot/costmap/include/costmap_node.hpp +++ b/src/robot/costmap/include/costmap_node.hpp @@ -7,9 +7,6 @@ class CostmapNode : public rclcpp::Node { public: - /** - * Costmap node constructor. - */ CostmapNode(); private: diff --git a/src/robot/costmap/package.xml b/src/robot/costmap/package.xml index a30a46b..64890ab 100644 --- a/src/robot/costmap/package.xml +++ b/src/robot/costmap/package.xml @@ -10,6 +10,9 @@ ament_cmake rclcpp + geometry_msgs + sensor_msgs + nav_msgs ament_lint_auto ament_lint_common diff --git a/src/robot/map_server/CMakeLists.txt b/src/robot/map_server/CMakeLists.txt new file mode 100644 index 0000000..fa1ecec --- /dev/null +++ b/src/robot/map_server/CMakeLists.txt @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 3.10) +project(map_server) + +# Set compiler to use C++ 17 standard +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 17) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# Search for dependencies required for building this package +find_package(ament_cmake REQUIRED) # ROS2 build tool +find_package(rclcpp REQUIRED) # ROS2 C++ package + +# Compiles source files into a library +# A library is not executed, instead other executables can link +# against it to access defined methods and classes. +# We build a library so that the methods defined can be used by +# both the unit test and ROS2 node executables. +add_library(map_server_lib + src/map_server_core.cpp) +# Indicate to compiler where to search for header files +target_include_directories(map_server_lib + PUBLIC include) +# Add ROS2 dependencies required by package +ament_target_dependencies(map_server_lib rclcpp) + +# Create ROS2 node executable from source files +add_executable(map_server_node src/map_server_node.cpp) +# Link to the previously built library to access map_server classes and methods +target_link_libraries(map_server_node map_server_lib) + +# Copy executable to installation location +install(TARGETS + map_server_node + DESTINATION lib/${PROJECT_NAME}) + +ament_package() diff --git a/src/robot/map_server/include/map_server_core.hpp b/src/robot/map_server/include/map_server_core.hpp new file mode 100644 index 0000000..65dcc6b --- /dev/null +++ b/src/robot/map_server/include/map_server_core.hpp @@ -0,0 +1,17 @@ +#ifndef MAP_SERVER_CORE_HPP_ +#define MAP_SERVER_CORE_HPP_ + +#include "rclcpp/rclcpp.hpp" + +namespace robot +{ + +class MapServerCore { + public: + explicit MapServerCore(); + +}; + +} + +#endif diff --git a/src/robot/map_server/include/map_server_node.hpp b/src/robot/map_server/include/map_server_node.hpp new file mode 100644 index 0000000..e0aaa5d --- /dev/null +++ b/src/robot/map_server/include/map_server_node.hpp @@ -0,0 +1,16 @@ +#ifndef MAP_SERVER_NODE_HPP_ +#define MAP_SERVER_NODE_HPP_ + +#include "rclcpp/rclcpp.hpp" + +#include "map_server_core.hpp" + +class MapServerNode : public rclcpp::Node { + public: + MapServerNode(); + + private: + robot::MapServerCore map_server_; +}; + +#endif diff --git a/src/robot/map_server/package.xml b/src/robot/map_server/package.xml new file mode 100644 index 0000000..f4d380a --- /dev/null +++ b/src/robot/map_server/package.xml @@ -0,0 +1,25 @@ + + + map_server + 0.0.0 + A sample ROS package for pubsub communication + + Eddy Zhou + TODO + + + ament_cmake + rclcpp + geometry_msgs + sensor_msgs + nav_msgs + + ament_lint_auto + ament_lint_common + ament_cmake_gtest + + + + ament_cmake + + \ No newline at end of file diff --git a/src/robot/map_server/src/map_server_core.cpp b/src/robot/map_server/src/map_server_core.cpp new file mode 100644 index 0000000..a522dab --- /dev/null +++ b/src/robot/map_server/src/map_server_core.cpp @@ -0,0 +1,8 @@ +#include + +#include "map_server_core.hpp" + +namespace robot +{ + MapServerCore::MapServerCore() {} +} diff --git a/src/robot/map_server/src/map_server_node.cpp b/src/robot/map_server/src/map_server_node.cpp new file mode 100644 index 0000000..fe61c25 --- /dev/null +++ b/src/robot/map_server/src/map_server_node.cpp @@ -0,0 +1,16 @@ +#include +#include + +#include "map_server_node.hpp" + +MapServerNode::MapServerNode() : Node("map_server"), map_server_(robot::MapServerCore()) { + +} + +int main(int argc, char ** argv) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} diff --git a/src/robot/nav/include/nav_core.hpp b/src/robot/nav/include/nav_core.hpp deleted file mode 100644 index e0d0403..0000000 --- a/src/robot/nav/include/nav_core.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef NAV_CORE_HPP_ -#define NAV_CORE_HPP_ - -#include - -namespace robot -{ - -class NavCore { - public: - NavCore(); -}; - -} - -#endif diff --git a/src/robot/nav/include/nav_node.hpp b/src/robot/nav/include/nav_node.hpp deleted file mode 100644 index badf8c4..0000000 --- a/src/robot/nav/include/nav_node.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef NAV_NODE_HPP_ -#define NAV_NODE_HPP_ - -#include "rclcpp/rclcpp.hpp" -#include "nav_core.hpp" - -class NavNode : public rclcpp::Node { - public: - NavNode(); - - private: - robot::NavCore nav_; -}; - -#endif diff --git a/src/robot/nav/src/nav_core.cpp b/src/robot/nav/src/nav_core.cpp deleted file mode 100644 index f01b1ca..0000000 --- a/src/robot/nav/src/nav_core.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -#include "nav_core.hpp" - -namespace robot -{ - NavCore::NavCore(){} -} diff --git a/src/robot/nav/src/nav_node.cpp b/src/robot/nav/src/nav_node.cpp deleted file mode 100644 index 20a3d2f..0000000 --- a/src/robot/nav/src/nav_node.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -#include "nav_node.hpp" - -NavNode::NavNode(): Node("transformer"), nav_(robot::NavCore()) -{ - -} - -int main(int argc, char ** argv) -{ - rclcpp::init(argc, argv); - rclcpp::spin(std::make_shared()); - rclcpp::shutdown(); - return 0; -} diff --git a/src/robot/nav/CMakeLists.txt b/src/robot/planner/CMakeLists.txt similarity index 74% rename from src/robot/nav/CMakeLists.txt rename to src/robot/planner/CMakeLists.txt index aa6cdf7..256e9a7 100644 --- a/src/robot/nav/CMakeLists.txt +++ b/src/robot/planner/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10) -project(nav) +project(planner) # Set compiler to use C++ 17 standard if(NOT CMAKE_CXX_STANDARD) @@ -19,22 +19,22 @@ find_package(rclcpp REQUIRED) # ROS2 C++ package # against it to access defined methods and classes. # We build a library so that the methods defined can be used by # both the unit test and ROS2 node executables. -add_library(nav_lib - src/nav_core.cpp) +add_library(planner_lib + src/planner_core.cpp) # Indicate to compiler where to search for header files -target_include_directories(nav_lib +target_include_directories(planner_lib PUBLIC include) # Add ROS2 dependencies required by package -ament_target_dependencies(nav_lib rclcpp) +ament_target_dependencies(planner_lib rclcpp) # Create ROS2 node executable from source files -add_executable(nav_node src/nav_node.cpp) -# Link to the previously built library to access nav classes and methods -target_link_libraries(nav_node nav_lib) +add_executable(planner_node src/planner_node.cpp) +# Link to the previously built library to access planner classes and methods +target_link_libraries(planner_node planner_lib) # Copy executable to installation location install(TARGETS - nav_node + planner_node DESTINATION lib/${PROJECT_NAME}) ament_package() diff --git a/src/robot/planner/include/planner_core.hpp b/src/robot/planner/include/planner_core.hpp new file mode 100644 index 0000000..79a4b7e --- /dev/null +++ b/src/robot/planner/include/planner_core.hpp @@ -0,0 +1,17 @@ +#ifndef PLANNER_CORE_HPP_ +#define PLANNER_CORE_HPP_ + +#include "rclcpp/rclcpp.hpp" + +namespace robot +{ + +class PlannerCore { + public: + explicit PlannerCore(); + +}; + +} + +#endif diff --git a/src/robot/planner/include/planner_node.hpp b/src/robot/planner/include/planner_node.hpp new file mode 100644 index 0000000..95562ed --- /dev/null +++ b/src/robot/planner/include/planner_node.hpp @@ -0,0 +1,16 @@ +#ifndef PLANNER_NODE_HPP_ +#define PLANNER_NODE_HPP_ + +#include "rclcpp/rclcpp.hpp" + +#include "planner_core.hpp" + +class PlannerNode : public rclcpp::Node { + public: + PlannerNode(); + + private: + robot::PlannerCore planner_; +}; + +#endif diff --git a/src/robot/nav/package.xml b/src/robot/planner/package.xml similarity index 76% rename from src/robot/nav/package.xml rename to src/robot/planner/package.xml index bb72be9..ecff129 100644 --- a/src/robot/nav/package.xml +++ b/src/robot/planner/package.xml @@ -1,15 +1,18 @@ - nav + planner 0.0.0 A sample ROS package for pubsub communication - Owen Leather + Eddy Zhou TODO ament_cmake rclcpp + geometry_msgs + sensor_msgs + nav_msgs ament_lint_auto ament_lint_common diff --git a/src/robot/planner/src/planner_core.cpp b/src/robot/planner/src/planner_core.cpp new file mode 100644 index 0000000..f93d05e --- /dev/null +++ b/src/robot/planner/src/planner_core.cpp @@ -0,0 +1,8 @@ +#include + +#include "planner_core.hpp" + +namespace robot +{ + PlannerCore::PlannerCore() {} +} diff --git a/src/robot/planner/src/planner_node.cpp b/src/robot/planner/src/planner_node.cpp new file mode 100644 index 0000000..0c8e3cf --- /dev/null +++ b/src/robot/planner/src/planner_node.cpp @@ -0,0 +1,16 @@ +#include +#include + +#include "planner_node.hpp" + +PlannerNode::PlannerNode() : Node("planner"), planner_(robot::PlannerCore()) { + +} + +int main(int argc, char ** argv) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} diff --git a/src/robot/state_machine/CMakeLists.txt b/src/robot/state_machine/CMakeLists.txt new file mode 100644 index 0000000..9ac8835 --- /dev/null +++ b/src/robot/state_machine/CMakeLists.txt @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 3.10) +project(state_machine) + +# Set compiler to use C++ 17 standard +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 17) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# Search for dependencies required for building this package +find_package(ament_cmake REQUIRED) # ROS2 build tool +find_package(rclcpp REQUIRED) # ROS2 C++ package + +# Compiles source files into a library +# A library is not executed, instead other executables can link +# against it to access defined methods and classes. +# We build a library so that the methods defined can be used by +# both the unit test and ROS2 node executables. +add_library(state_machine_lib + src/state_machine_core.cpp) +# Indicate to compiler where to search for header files +target_include_directories(state_machine_lib + PUBLIC include) +# Add ROS2 dependencies required by package +ament_target_dependencies(state_machine_lib rclcpp) + +# Create ROS2 node executable from source files +add_executable(state_machine_node src/state_machine_node.cpp) +# Link to the previously built library to access state_machine classes and methods +target_link_libraries(state_machine_node state_machine_lib) + +# Copy executable to installation location +install(TARGETS + state_machine_node + DESTINATION lib/${PROJECT_NAME}) + +ament_package() diff --git a/src/robot/state_machine/include/state_machine_core.hpp b/src/robot/state_machine/include/state_machine_core.hpp new file mode 100644 index 0000000..20d1e99 --- /dev/null +++ b/src/robot/state_machine/include/state_machine_core.hpp @@ -0,0 +1,17 @@ +#ifndef STATE_MACHINE_CORE_HPP_ +#define STATE_MACHINE_CORE_HPP_ + +#include "rclcpp/rclcpp.hpp" + +namespace robot +{ + +class StateMachineCore { + public: + explicit StateMachineCore(); + +}; + +} + +#endif diff --git a/src/robot/state_machine/include/state_machine_node.hpp b/src/robot/state_machine/include/state_machine_node.hpp new file mode 100644 index 0000000..295ef25 --- /dev/null +++ b/src/robot/state_machine/include/state_machine_node.hpp @@ -0,0 +1,16 @@ +#ifndef STATE_MACHINE_NODE_HPP_ +#define STATE_MACHINE_NODE_HPP_ + +#include "rclcpp/rclcpp.hpp" + +#include "state_machine_core.hpp" + +class StateMachineNode : public rclcpp::Node { + public: + StateMachineNode(); + + private: + robot::StateMachineCore state_machine_; +}; + +#endif diff --git a/src/robot/state_machine/package.xml b/src/robot/state_machine/package.xml new file mode 100644 index 0000000..35f658d --- /dev/null +++ b/src/robot/state_machine/package.xml @@ -0,0 +1,25 @@ + + + state_machine + 0.0.0 + A sample ROS package for pubsub communication + + Eddy Zhou + TODO + + + ament_cmake + rclcpp + geometry_msgs + sensor_msgs + nav_msgs + + ament_lint_auto + ament_lint_common + ament_cmake_gtest + + + + ament_cmake + + \ No newline at end of file diff --git a/src/robot/state_machine/src/state_machine_core.cpp b/src/robot/state_machine/src/state_machine_core.cpp new file mode 100644 index 0000000..f40f8b9 --- /dev/null +++ b/src/robot/state_machine/src/state_machine_core.cpp @@ -0,0 +1,8 @@ +#include + +#include "state_machine_core.hpp" + +namespace robot +{ + StateMachineCore::StateMachineCore() {} +} diff --git a/src/robot/state_machine/src/state_machine_node.cpp b/src/robot/state_machine/src/state_machine_node.cpp new file mode 100644 index 0000000..5f72b6d --- /dev/null +++ b/src/robot/state_machine/src/state_machine_node.cpp @@ -0,0 +1,16 @@ +#include +#include + +#include "state_machine_node.hpp" + +StateMachineNode::StateMachineNode() : Node("state_machine"), state_machine_(robot::StateMachineCore()) { + +} + +int main(int argc, char ** argv) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +}