exploration and navigation make targets are updated
This commit is contained in:
parent
e625b7090a
commit
3d8b3bcf49
11
Makefile
11
Makefile
|
@ -5,11 +5,20 @@ docker_start:
|
||||||
@./scripts/run_dev.sh
|
@./scripts/run_dev.sh
|
||||||
|
|
||||||
nav2:
|
nav2:
|
||||||
@cd deploy && docker build --tag go2py_nav2:latest -f docker/Dockerfile.nav2 .
|
@cd deploy && docker build --no-cache --tag go2py_nav2:latest -f docker/Dockerfile.nav2 .
|
||||||
|
|
||||||
|
nav2_source:
|
||||||
|
@cd deploy && docker build --tag robocaster/navigation2:aarch64 -f docker/Dockerfile.nav2_source .
|
||||||
|
|
||||||
nav2_start:
|
nav2_start:
|
||||||
@ ./scripts/run_nav2.sh
|
@ ./scripts/run_nav2.sh
|
||||||
|
|
||||||
|
mexplore:
|
||||||
|
@cd deploy && docker build --no-cache --tag go2py_mexplore:latest -f docker/Dockerfile.mexplore .
|
||||||
|
|
||||||
|
mexplore_start:
|
||||||
|
@ ./scripts/run_mexplore.sh
|
||||||
|
|
||||||
messages:
|
messages:
|
||||||
@cd scripts && ./make_msgs.sh
|
@cd scripts && ./make_msgs.sh
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
# FROM isaac_ros_dev-aarch64
|
||||||
|
FROM ros:humble
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
# uodate and install dependencies
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
ros-humble-rmw-cyclonedds-cpp ros-humble-rosidl-generator-dds-idl \
|
||||||
|
libyaml-cpp-dev \
|
||||||
|
ros-humble-xacro \
|
||||||
|
libboost-all-dev\
|
||||||
|
build-essential \
|
||||||
|
cmake \
|
||||||
|
git \
|
||||||
|
ros-humble-cv-bridge \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Cheange the ROS2 RMW to CycloneDDS as instructed by Unitree
|
||||||
|
RUN cd / && git clone https://github.com/unitreerobotics/unitree_ros2 && cd /unitree_ros2/cyclonedds_ws/src && \
|
||||||
|
git clone https://github.com/ros2/rmw_cyclonedds -b humble && git clone https://github.com/eclipse-cyclonedds/cyclonedds -b releases/0.10.x &&\
|
||||||
|
cd .. && colcon build --packages-select cyclonedds && source /opt/ros/humble/setup.bash && colcon build
|
||||||
|
|
||||||
|
# copy the required scripts and source files
|
||||||
|
COPY ros2_nodes/m-explore-ros2 /explore_ws/src/m-explore-ros2
|
||||||
|
# RUN cd /explore_ws && source /opt/ros/humble/setup.bash && colcon build --symlink-install
|
||||||
|
|
||||||
|
# set the entrypoint to bash
|
||||||
|
#ENTRYPOINT ["/bin/bash"]
|
||||||
|
ENTRYPOINT ["/bin/bash", "/root/scripts/front_cam_publisher.sh"]
|
|
@ -1,148 +1,28 @@
|
||||||
# FROM isaac_ros_dev-aarch64
|
FROM robocaster/navigation2:aarch64
|
||||||
# This dockerfile can be configured via --build-arg
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
# Build context must be the /navigation2 root folder for COPY.
|
SHELL ["/bin/bash", "-c"]
|
||||||
# Example build command:
|
# uodate and install dependencies
|
||||||
# export UNDERLAY_MIXINS="debug ccache lld"
|
RUN apt-get update && apt-get install -y \
|
||||||
# export OVERLAY_MIXINS="debug ccache coverage-gcc lld"
|
ros-rolling-rmw-cyclonedds-cpp ros-rolling-rosidl-generator-dds-idl \
|
||||||
# docker build -t nav2:latest \
|
libyaml-cpp-dev \
|
||||||
# --build-arg UNDERLAY_MIXINS \
|
libboost-all-dev\
|
||||||
# --build-arg OVERLAY_MIXINS ./
|
build-essential \
|
||||||
ARG FROM_IMAGE=ros:rolling
|
cmake \
|
||||||
ARG UNDERLAY_WS=/opt/underlay_ws
|
git \
|
||||||
ARG OVERLAY_WS=/opt/overlay_ws
|
|
||||||
|
|
||||||
# multi-stage for caching
|
|
||||||
FROM $FROM_IMAGE AS cacher
|
|
||||||
|
|
||||||
# clone underlay source
|
|
||||||
ARG UNDERLAY_WS
|
|
||||||
WORKDIR $UNDERLAY_WS/src
|
|
||||||
# Clone the repositories
|
|
||||||
RUN cd /home && mkdir nav2_ws && cd nav2_ws && mkdir src && cd src && \
|
|
||||||
git clone -b master https://github.com/BehaviorTree/BehaviorTree.CPP.git && \
|
|
||||||
git clone -b ros2 https://github.com/ros/angles.git && \
|
|
||||||
git clone -b rolling https://github.com/ros-perception/vision_opencv.git && \
|
|
||||||
git clone -b ros2 https://github.com/ros/bond_core.git && \
|
|
||||||
git clone -b ros2 https://github.com/ros/diagnostics.git && \
|
|
||||||
git clone -b ros2 https://github.com/ros-geographic-info/geographic_info.git && \
|
|
||||||
git clone -b main https://github.com/ompl/ompl.git && \
|
|
||||||
git clone -b ros2 https://github.com/cra-ros-pkg/robot_localization.git && \
|
|
||||||
git clone -b 1.0.1 https://github.com/ros-navigation/nav2_minimal_turtlebot_simulation.git
|
|
||||||
|
|
||||||
# copy overlay source
|
|
||||||
ARG OVERLAY_WS
|
|
||||||
WORKDIR $OVERLAY_WS/src
|
|
||||||
RUN git clone https://github.com/ros-navigation/navigation2.git && git clone https://github.com/SteveMacenski/slam_toolbox.git -b ros2
|
|
||||||
|
|
||||||
# copy manifests for caching
|
|
||||||
WORKDIR /opt
|
|
||||||
RUN find . -name "src" -type d \
|
|
||||||
-mindepth 1 -maxdepth 2 -printf '%P\n' \
|
|
||||||
| xargs -I % mkdir -p /tmp/opt/% && \
|
|
||||||
find . -name "package.xml" \
|
|
||||||
| xargs cp --parents -t /tmp/opt && \
|
|
||||||
find . -name "COLCON_IGNORE" \
|
|
||||||
| xargs cp --parents -t /tmp/opt || true
|
|
||||||
|
|
||||||
# multi-stage for building
|
|
||||||
FROM $FROM_IMAGE AS builder
|
|
||||||
|
|
||||||
# config dependencies install
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
RUN echo '\
|
|
||||||
APT::Install-Recommends "0";\n\
|
|
||||||
APT::Install-Suggests "0";\n\
|
|
||||||
' > /etc/apt/apt.conf.d/01norecommend
|
|
||||||
ENV PYTHONUNBUFFERED 1
|
|
||||||
|
|
||||||
# install CI dependencies
|
|
||||||
ARG RTI_NC_LICENSE_ACCEPTED=yes
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get upgrade -y --with-new-pkgs && \
|
|
||||||
apt-get install -y \
|
|
||||||
ccache \
|
|
||||||
lcov \
|
|
||||||
lld \
|
|
||||||
python3-pip \
|
|
||||||
ros-$ROS_DISTRO-rmw-fastrtps-cpp \
|
|
||||||
ros-$ROS_DISTRO-rmw-connextdds \
|
|
||||||
ros-$ROS_DISTRO-rmw-cyclonedds-cpp \
|
|
||||||
ros-$ROS_DISTRO-rmw-cyclonedds-cpp\
|
|
||||||
ros-$ROS_DISTRO-rosidl-generator-dds-idl \
|
|
||||||
&& pip3 install --break-system-packages \
|
|
||||||
fastcov \
|
|
||||||
git+https://github.com/ruffsl/colcon-cache.git@a937541bfc496c7a267db7ee9d6cceca61e470ca \
|
|
||||||
git+https://github.com/ruffsl/colcon-clean.git@a7f1074d1ebc1a54a6508625b117974f2672f2a9 \
|
|
||||||
&& rosdep update \
|
|
||||||
&& colcon mixin update \
|
|
||||||
&& colcon metadata update \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# install underlay dependencies
|
# Cheange the ROS2 RMW to CycloneDDS as instructed by Unitree
|
||||||
ARG UNDERLAY_WS
|
RUN cd / && git clone https://github.com/unitreerobotics/unitree_ros2 && cd /unitree_ros2/cyclonedds_ws/src && \
|
||||||
ENV UNDERLAY_WS $UNDERLAY_WS
|
git clone https://github.com/ros2/rmw_cyclonedds -b rolling && git clone https://github.com/eclipse-cyclonedds/cyclonedds -b releases/0.10.x &&\
|
||||||
WORKDIR $UNDERLAY_WS
|
cd .. && colcon build --packages-select cyclonedds && source /opt/ros/rolling/setup.bash && colcon build
|
||||||
COPY --from=cacher /tmp/$UNDERLAY_WS ./
|
|
||||||
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
|
|
||||||
apt-get update && rosdep install -q -y \
|
|
||||||
--from-paths src \
|
|
||||||
--skip-keys " \
|
|
||||||
slam_toolbox \
|
|
||||||
" \
|
|
||||||
--ignore-src \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# build underlay source
|
|
||||||
COPY --from=cacher $UNDERLAY_WS ./
|
|
||||||
ARG UNDERLAY_MIXINS="release ccache lld"
|
|
||||||
ARG CCACHE_DIR="$UNDERLAY_WS/.ccache"
|
|
||||||
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
|
|
||||||
colcon cache lock && \
|
|
||||||
colcon build \
|
|
||||||
--symlink-install \
|
|
||||||
--mixin $UNDERLAY_MIXINS \
|
|
||||||
--event-handlers console_direct+ \
|
|
||||||
--cmake-args -DCMAKE_BUILD_TYPE=Release
|
|
||||||
|
|
||||||
# install overlay dependencies
|
|
||||||
ARG OVERLAY_WS
|
|
||||||
ENV OVERLAY_WS $OVERLAY_WS
|
|
||||||
WORKDIR $OVERLAY_WS
|
|
||||||
COPY --from=cacher /tmp/$OVERLAY_WS ./
|
|
||||||
|
|
||||||
RUN . $UNDERLAY_WS/install/setup.sh && \
|
|
||||||
apt-get update && rosdep install -q -y \
|
|
||||||
--from-paths src \
|
|
||||||
--skip-keys " \
|
|
||||||
slam_toolbox \
|
|
||||||
"\
|
|
||||||
--ignore-src \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# multi-stage for testing
|
|
||||||
FROM builder AS tester
|
|
||||||
|
|
||||||
# build overlay source
|
|
||||||
COPY --from=cacher $OVERLAY_WS ./
|
|
||||||
ARG OVERLAY_MIXINS="release ccache lld"
|
|
||||||
ARG CCACHE_DIR="$OVERLAY_WS/.ccache"
|
|
||||||
RUN . $UNDERLAY_WS/install/setup.sh && \
|
|
||||||
colcon cache lock && \
|
|
||||||
colcon build \
|
|
||||||
--symlink-install \
|
|
||||||
--mixin $OVERLAY_MIXINS \
|
|
||||||
--cmake-args -DCMAKE_BUILD_TYPE=Release
|
|
||||||
|
|
||||||
# source overlay from entrypoint
|
|
||||||
RUN sed --in-place \
|
|
||||||
's|^source .*|source "$OVERLAY_WS/install/setup.bash"|' \
|
|
||||||
/ros_entrypoint.sh
|
|
||||||
|
|
||||||
|
|
||||||
# copy the go2py ros2 nodes
|
# copy the go2py ros2 nodes
|
||||||
COPY ros2_nodes/m-explore-ros2 /home/nav2_ws/src/m-explore-ros2
|
# COPY ros2_nodes/go2py_messages /bridge_ws/src/go2py_messages
|
||||||
# COPY ros2_nodes/sportmode_nav2 /home/nav2_ws/src/sportmode_nav2
|
# RUN cd /bridge_ws && source /opt/ros/humble/setup.bash && source /unitree_ros2/cyclonedds_ws/install/setup.bash && colcon build --symlink-install
|
||||||
# RUN cd /home/nav2_ws && source /opt/ros/rolling/setup.bash && \
|
|
||||||
# colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --symlink-install
|
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/bash"]
|
# Copy the script to start the nodes
|
||||||
|
COPY docker/scripts /root/scripts
|
||||||
|
COPY launch_files /root/launch
|
||||||
|
|
||||||
|
# set the entrypoint to bash
|
||||||
|
ENTRYPOINT ["/bin/bash", "/root/scripts/nav2_start.sh"]
|
||||||
|
|
|
@ -0,0 +1,148 @@
|
||||||
|
# FROM isaac_ros_dev-aarch64
|
||||||
|
# This dockerfile can be configured via --build-arg
|
||||||
|
# Build context must be the /navigation2 root folder for COPY.
|
||||||
|
# Example build command:
|
||||||
|
# export UNDERLAY_MIXINS="debug ccache lld"
|
||||||
|
# export OVERLAY_MIXINS="debug ccache coverage-gcc lld"
|
||||||
|
# docker build -t nav2:latest \
|
||||||
|
# --build-arg UNDERLAY_MIXINS \
|
||||||
|
# --build-arg OVERLAY_MIXINS ./
|
||||||
|
ARG FROM_IMAGE=ros:rolling
|
||||||
|
ARG UNDERLAY_WS=/opt/underlay_ws
|
||||||
|
ARG OVERLAY_WS=/opt/overlay_ws
|
||||||
|
|
||||||
|
# multi-stage for caching
|
||||||
|
FROM $FROM_IMAGE AS cacher
|
||||||
|
|
||||||
|
# clone underlay source
|
||||||
|
ARG UNDERLAY_WS
|
||||||
|
WORKDIR $UNDERLAY_WS/src
|
||||||
|
# Clone the repositories
|
||||||
|
RUN cd /home && mkdir nav2_ws && cd nav2_ws && mkdir src && cd src && \
|
||||||
|
git clone -b master https://github.com/BehaviorTree/BehaviorTree.CPP.git && \
|
||||||
|
git clone -b ros2 https://github.com/ros/angles.git && \
|
||||||
|
git clone -b rolling https://github.com/ros-perception/vision_opencv.git && \
|
||||||
|
git clone -b ros2 https://github.com/ros/bond_core.git && \
|
||||||
|
git clone -b ros2 https://github.com/ros/diagnostics.git && \
|
||||||
|
git clone -b ros2 https://github.com/ros-geographic-info/geographic_info.git && \
|
||||||
|
git clone -b main https://github.com/ompl/ompl.git && \
|
||||||
|
git clone -b ros2 https://github.com/cra-ros-pkg/robot_localization.git && \
|
||||||
|
git clone -b 1.0.1 https://github.com/ros-navigation/nav2_minimal_turtlebot_simulation.git
|
||||||
|
|
||||||
|
# copy overlay source
|
||||||
|
ARG OVERLAY_WS
|
||||||
|
WORKDIR $OVERLAY_WS/src
|
||||||
|
RUN git clone https://github.com/ros-navigation/navigation2.git && git clone https://github.com/SteveMacenski/slam_toolbox.git -b ros2
|
||||||
|
|
||||||
|
# copy manifests for caching
|
||||||
|
WORKDIR /opt
|
||||||
|
RUN find . -name "src" -type d \
|
||||||
|
-mindepth 1 -maxdepth 2 -printf '%P\n' \
|
||||||
|
| xargs -I % mkdir -p /tmp/opt/% && \
|
||||||
|
find . -name "package.xml" \
|
||||||
|
| xargs cp --parents -t /tmp/opt && \
|
||||||
|
find . -name "COLCON_IGNORE" \
|
||||||
|
| xargs cp --parents -t /tmp/opt || true
|
||||||
|
|
||||||
|
# multi-stage for building
|
||||||
|
FROM $FROM_IMAGE AS builder
|
||||||
|
|
||||||
|
# config dependencies install
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
RUN echo '\
|
||||||
|
APT::Install-Recommends "0";\n\
|
||||||
|
APT::Install-Suggests "0";\n\
|
||||||
|
' > /etc/apt/apt.conf.d/01norecommend
|
||||||
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
|
||||||
|
# install CI dependencies
|
||||||
|
ARG RTI_NC_LICENSE_ACCEPTED=yes
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get upgrade -y --with-new-pkgs && \
|
||||||
|
apt-get install -y \
|
||||||
|
ccache \
|
||||||
|
lcov \
|
||||||
|
lld \
|
||||||
|
python3-pip \
|
||||||
|
ros-$ROS_DISTRO-rmw-fastrtps-cpp \
|
||||||
|
ros-$ROS_DISTRO-rmw-connextdds \
|
||||||
|
ros-$ROS_DISTRO-rmw-cyclonedds-cpp \
|
||||||
|
ros-$ROS_DISTRO-rmw-cyclonedds-cpp\
|
||||||
|
ros-$ROS_DISTRO-rosidl-generator-dds-idl \
|
||||||
|
&& pip3 install --break-system-packages \
|
||||||
|
fastcov \
|
||||||
|
git+https://github.com/ruffsl/colcon-cache.git@a937541bfc496c7a267db7ee9d6cceca61e470ca \
|
||||||
|
git+https://github.com/ruffsl/colcon-clean.git@a7f1074d1ebc1a54a6508625b117974f2672f2a9 \
|
||||||
|
&& rosdep update \
|
||||||
|
&& colcon mixin update \
|
||||||
|
&& colcon metadata update \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# install underlay dependencies
|
||||||
|
ARG UNDERLAY_WS
|
||||||
|
ENV UNDERLAY_WS $UNDERLAY_WS
|
||||||
|
WORKDIR $UNDERLAY_WS
|
||||||
|
COPY --from=cacher /tmp/$UNDERLAY_WS ./
|
||||||
|
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
|
||||||
|
apt-get update && rosdep install -q -y \
|
||||||
|
--from-paths src \
|
||||||
|
--skip-keys " \
|
||||||
|
slam_toolbox \
|
||||||
|
" \
|
||||||
|
--ignore-src \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# build underlay source
|
||||||
|
COPY --from=cacher $UNDERLAY_WS ./
|
||||||
|
ARG UNDERLAY_MIXINS="release ccache lld"
|
||||||
|
ARG CCACHE_DIR="$UNDERLAY_WS/.ccache"
|
||||||
|
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
|
||||||
|
colcon cache lock && \
|
||||||
|
colcon build \
|
||||||
|
--symlink-install \
|
||||||
|
--mixin $UNDERLAY_MIXINS \
|
||||||
|
--event-handlers console_direct+ \
|
||||||
|
--cmake-args -DCMAKE_BUILD_TYPE=Release
|
||||||
|
|
||||||
|
# install overlay dependencies
|
||||||
|
ARG OVERLAY_WS
|
||||||
|
ENV OVERLAY_WS $OVERLAY_WS
|
||||||
|
WORKDIR $OVERLAY_WS
|
||||||
|
COPY --from=cacher /tmp/$OVERLAY_WS ./
|
||||||
|
|
||||||
|
RUN . $UNDERLAY_WS/install/setup.sh && \
|
||||||
|
apt-get update && rosdep install -q -y \
|
||||||
|
--from-paths src \
|
||||||
|
--skip-keys " \
|
||||||
|
slam_toolbox \
|
||||||
|
"\
|
||||||
|
--ignore-src \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# multi-stage for testing
|
||||||
|
FROM builder AS tester
|
||||||
|
|
||||||
|
# build overlay source
|
||||||
|
COPY --from=cacher $OVERLAY_WS ./
|
||||||
|
ARG OVERLAY_MIXINS="release ccache lld"
|
||||||
|
ARG CCACHE_DIR="$OVERLAY_WS/.ccache"
|
||||||
|
RUN . $UNDERLAY_WS/install/setup.sh && \
|
||||||
|
colcon cache lock && \
|
||||||
|
colcon build \
|
||||||
|
--symlink-install \
|
||||||
|
--mixin $OVERLAY_MIXINS \
|
||||||
|
--cmake-args -DCMAKE_BUILD_TYPE=Release
|
||||||
|
|
||||||
|
# source overlay from entrypoint
|
||||||
|
RUN sed --in-place \
|
||||||
|
's|^source .*|source "$OVERLAY_WS/install/setup.bash"|' \
|
||||||
|
/ros_entrypoint.sh
|
||||||
|
|
||||||
|
|
||||||
|
# copy the go2py ros2 nodes
|
||||||
|
# COPY ros2_nodes/m-explore-ros2 /home/nav2_ws/src/m-explore-ros2
|
||||||
|
# COPY ros2_nodes/sportmode_nav2 /home/nav2_ws/src/sportmode_nav2
|
||||||
|
# RUN cd /home/nav2_ws && source /opt/ros/rolling/setup.bash && \
|
||||||
|
# colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --symlink-install
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash"]
|
|
@ -0,0 +1,7 @@
|
||||||
|
source /opt/ros/humble/setup.bash
|
||||||
|
source /unitree_ros2/cyclonedds_ws/install/setup.bash
|
||||||
|
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
|
||||||
|
export CYCLONEDDS_URI='<CycloneDDS><Domain><General><Interfaces>
|
||||||
|
<NetworkInterface name="eth0" priority="default" multicast="default" />
|
||||||
|
</Interfaces></General></Domain></CycloneDDS>'
|
||||||
|
source /explore_ws/install/setup.bash && /bin/bash
|
|
@ -0,0 +1,7 @@
|
||||||
|
source /opt/ros/rolling/setup.bash
|
||||||
|
source /unitree_ros2/cyclonedds_ws/install/setup.bash
|
||||||
|
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
|
||||||
|
export CYCLONEDDS_URI='<CycloneDDS><Domain><General><Interfaces>
|
||||||
|
<NetworkInterface name="eth0" priority="default" multicast="default" />
|
||||||
|
</Interfaces></General></Domain></CycloneDDS>'
|
||||||
|
source /opt/overlay_ws/install/setup.bash && /bin/bash
|
|
@ -1,272 +0,0 @@
|
||||||
# Copyright (c) 2018 Intel Corporation
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from ament_index_python.packages import get_package_share_directory
|
|
||||||
|
|
||||||
from launch import LaunchDescription
|
|
||||||
from launch.actions import DeclareLaunchArgument, GroupAction, SetEnvironmentVariable
|
|
||||||
from launch.conditions import IfCondition
|
|
||||||
from launch.substitutions import LaunchConfiguration, PythonExpression
|
|
||||||
from launch_ros.actions import LoadComposableNodes
|
|
||||||
from launch_ros.actions import Node
|
|
||||||
from launch_ros.descriptions import ComposableNode, ParameterFile
|
|
||||||
from nav2_common.launch import RewrittenYaml
|
|
||||||
|
|
||||||
|
|
||||||
def generate_launch_description():
|
|
||||||
# Get the launch directory
|
|
||||||
bringup_dir = get_package_share_directory('sportmode_nav2')
|
|
||||||
|
|
||||||
namespace = LaunchConfiguration('namespace')
|
|
||||||
use_sim_time = LaunchConfiguration('use_sim_time', default='false')
|
|
||||||
autostart = LaunchConfiguration('autostart')
|
|
||||||
params_file = LaunchConfiguration('params_file')
|
|
||||||
use_composition = LaunchConfiguration('use_composition')
|
|
||||||
container_name = LaunchConfiguration('container_name')
|
|
||||||
container_name_full = (namespace, '/', container_name)
|
|
||||||
use_respawn = LaunchConfiguration('use_respawn')
|
|
||||||
log_level = LaunchConfiguration('log_level')
|
|
||||||
|
|
||||||
lifecycle_nodes = ['controller_server',
|
|
||||||
'smoother_server',
|
|
||||||
'planner_server',
|
|
||||||
'behavior_server',
|
|
||||||
'bt_navigator',
|
|
||||||
'waypoint_follower',
|
|
||||||
'velocity_smoother']
|
|
||||||
|
|
||||||
# Map fully qualified names to relative ones so the node's namespace can be prepended.
|
|
||||||
# In case of the transforms (tf), currently, there doesn't seem to be a better alternative
|
|
||||||
# https://github.com/ros/geometry2/issues/32
|
|
||||||
# https://github.com/ros/robot_state_publisher/pull/30
|
|
||||||
# TODO(orduno) Substitute with `PushNodeRemapping`
|
|
||||||
# https://github.com/ros2/launch_ros/issues/56
|
|
||||||
remappings = [('/tf', 'tf'),
|
|
||||||
('/tf_static', 'tf_static'), ('/cmd_vel', '/nav2/cmd_vel')]
|
|
||||||
|
|
||||||
# Create our own temporary YAML files that include substitutions
|
|
||||||
param_substitutions = {
|
|
||||||
'use_sim_time': use_sim_time,
|
|
||||||
'autostart': autostart}
|
|
||||||
|
|
||||||
configured_params = ParameterFile(
|
|
||||||
RewrittenYaml(
|
|
||||||
source_file=params_file,
|
|
||||||
root_key=namespace,
|
|
||||||
param_rewrites=param_substitutions,
|
|
||||||
convert_types=True),
|
|
||||||
allow_substs=True)
|
|
||||||
|
|
||||||
stdout_linebuf_envvar = SetEnvironmentVariable(
|
|
||||||
'RCUTILS_LOGGING_BUFFERED_STREAM', '1')
|
|
||||||
|
|
||||||
declare_namespace_cmd = DeclareLaunchArgument(
|
|
||||||
'namespace',
|
|
||||||
default_value='',
|
|
||||||
description='Top-level namespace')
|
|
||||||
|
|
||||||
declare_use_sim_time_cmd = DeclareLaunchArgument(
|
|
||||||
'use_sim_time',
|
|
||||||
default_value='false',
|
|
||||||
description='Use simulation (Gazebo) clock if true')
|
|
||||||
|
|
||||||
declare_params_file_cmd = DeclareLaunchArgument(
|
|
||||||
'params_file',
|
|
||||||
default_value=os.path.join(bringup_dir, 'params', 'nav2_params.yaml'),
|
|
||||||
description='Full path to the ROS2 parameters file to use for all launched nodes')
|
|
||||||
|
|
||||||
declare_autostart_cmd = DeclareLaunchArgument(
|
|
||||||
'autostart', default_value='true',
|
|
||||||
description='Automatically startup the nav2 stack')
|
|
||||||
|
|
||||||
declare_use_composition_cmd = DeclareLaunchArgument(
|
|
||||||
'use_composition', default_value='False',
|
|
||||||
description='Use composed bringup if True')
|
|
||||||
|
|
||||||
declare_container_name_cmd = DeclareLaunchArgument(
|
|
||||||
'container_name', default_value='nav2_container',
|
|
||||||
description='the name of conatiner that nodes will load in if use composition')
|
|
||||||
|
|
||||||
declare_use_respawn_cmd = DeclareLaunchArgument(
|
|
||||||
'use_respawn', default_value='False',
|
|
||||||
description='Whether to respawn if a node crashes. Applied when composition is disabled.')
|
|
||||||
|
|
||||||
declare_log_level_cmd = DeclareLaunchArgument(
|
|
||||||
'log_level', default_value='info',
|
|
||||||
description='log level')
|
|
||||||
|
|
||||||
load_nodes = GroupAction(
|
|
||||||
condition=IfCondition(PythonExpression(['not ', use_composition])),
|
|
||||||
actions=[
|
|
||||||
Node(
|
|
||||||
package='nav2_controller',
|
|
||||||
executable='controller_server',
|
|
||||||
output='screen',
|
|
||||||
respawn=use_respawn,
|
|
||||||
respawn_delay=2.0,
|
|
||||||
parameters=[configured_params],
|
|
||||||
arguments=['--ros-args', '--log-level', log_level],
|
|
||||||
remappings=remappings + [('cmd_vel', 'cmd_vel_nav')]),
|
|
||||||
Node(
|
|
||||||
package='nav2_smoother',
|
|
||||||
executable='smoother_server',
|
|
||||||
name='smoother_server',
|
|
||||||
output='screen',
|
|
||||||
respawn=use_respawn,
|
|
||||||
respawn_delay=2.0,
|
|
||||||
parameters=[configured_params],
|
|
||||||
arguments=['--ros-args', '--log-level', log_level],
|
|
||||||
remappings=remappings),
|
|
||||||
Node(
|
|
||||||
package='nav2_planner',
|
|
||||||
executable='planner_server',
|
|
||||||
name='planner_server',
|
|
||||||
output='screen',
|
|
||||||
respawn=use_respawn,
|
|
||||||
respawn_delay=2.0,
|
|
||||||
parameters=[configured_params],
|
|
||||||
arguments=['--ros-args', '--log-level', log_level],
|
|
||||||
remappings=remappings),
|
|
||||||
Node(
|
|
||||||
package='nav2_behaviors',
|
|
||||||
executable='behavior_server',
|
|
||||||
name='behavior_server',
|
|
||||||
output='screen',
|
|
||||||
respawn=use_respawn,
|
|
||||||
respawn_delay=2.0,
|
|
||||||
parameters=[configured_params],
|
|
||||||
arguments=['--ros-args', '--log-level', log_level],
|
|
||||||
remappings=remappings),
|
|
||||||
Node(
|
|
||||||
package='nav2_bt_navigator',
|
|
||||||
executable='bt_navigator',
|
|
||||||
name='bt_navigator',
|
|
||||||
output='screen',
|
|
||||||
respawn=use_respawn,
|
|
||||||
respawn_delay=2.0,
|
|
||||||
parameters=[configured_params],
|
|
||||||
arguments=['--ros-args', '--log-level', log_level],
|
|
||||||
remappings=remappings),
|
|
||||||
Node(
|
|
||||||
package='nav2_waypoint_follower',
|
|
||||||
executable='waypoint_follower',
|
|
||||||
name='waypoint_follower',
|
|
||||||
output='screen',
|
|
||||||
respawn=use_respawn,
|
|
||||||
respawn_delay=2.0,
|
|
||||||
parameters=[configured_params],
|
|
||||||
arguments=['--ros-args', '--log-level', log_level],
|
|
||||||
remappings=remappings),
|
|
||||||
Node(
|
|
||||||
package='nav2_velocity_smoother',
|
|
||||||
executable='velocity_smoother',
|
|
||||||
name='velocity_smoother',
|
|
||||||
output='screen',
|
|
||||||
respawn=use_respawn,
|
|
||||||
respawn_delay=2.0,
|
|
||||||
parameters=[configured_params],
|
|
||||||
arguments=['--ros-args', '--log-level', log_level],
|
|
||||||
remappings=remappings +
|
|
||||||
[('cmd_vel', 'cmd_vel_nav'), ('cmd_vel_smoothed', 'cmd_vel')]),
|
|
||||||
Node(
|
|
||||||
package='nav2_lifecycle_manager',
|
|
||||||
executable='lifecycle_manager',
|
|
||||||
name='lifecycle_manager_navigation',
|
|
||||||
output='screen',
|
|
||||||
arguments=['--ros-args', '--log-level', log_level],
|
|
||||||
parameters=[{'use_sim_time': use_sim_time},
|
|
||||||
{'autostart': autostart},
|
|
||||||
{'node_names': lifecycle_nodes}]),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
load_composable_nodes = LoadComposableNodes(
|
|
||||||
condition=IfCondition(use_composition),
|
|
||||||
target_container=container_name_full,
|
|
||||||
composable_node_descriptions=[
|
|
||||||
ComposableNode(
|
|
||||||
package='nav2_controller',
|
|
||||||
plugin='nav2_controller::ControllerServer',
|
|
||||||
name='controller_server',
|
|
||||||
parameters=[configured_params],
|
|
||||||
remappings=remappings + [('cmd_vel', 'cmd_vel_nav')]),
|
|
||||||
ComposableNode(
|
|
||||||
package='nav2_smoother',
|
|
||||||
plugin='nav2_smoother::SmootherServer',
|
|
||||||
name='smoother_server',
|
|
||||||
parameters=[configured_params],
|
|
||||||
remappings=remappings),
|
|
||||||
ComposableNode(
|
|
||||||
package='nav2_planner',
|
|
||||||
plugin='nav2_planner::PlannerServer',
|
|
||||||
name='planner_server',
|
|
||||||
parameters=[configured_params],
|
|
||||||
remappings=remappings),
|
|
||||||
ComposableNode(
|
|
||||||
package='nav2_behaviors',
|
|
||||||
plugin='behavior_server::BehaviorServer',
|
|
||||||
name='behavior_server',
|
|
||||||
parameters=[configured_params],
|
|
||||||
remappings=remappings),
|
|
||||||
ComposableNode(
|
|
||||||
package='nav2_bt_navigator',
|
|
||||||
plugin='nav2_bt_navigator::BtNavigator',
|
|
||||||
name='bt_navigator',
|
|
||||||
parameters=[configured_params],
|
|
||||||
remappings=remappings),
|
|
||||||
ComposableNode(
|
|
||||||
package='nav2_waypoint_follower',
|
|
||||||
plugin='nav2_waypoint_follower::WaypointFollower',
|
|
||||||
name='waypoint_follower',
|
|
||||||
parameters=[configured_params],
|
|
||||||
remappings=remappings),
|
|
||||||
ComposableNode(
|
|
||||||
package='nav2_velocity_smoother',
|
|
||||||
plugin='nav2_velocity_smoother::VelocitySmoother',
|
|
||||||
name='velocity_smoother',
|
|
||||||
parameters=[configured_params],
|
|
||||||
remappings=remappings +
|
|
||||||
[('cmd_vel', 'cmd_vel_nav'), ('cmd_vel_smoothed', 'cmd_vel')]),
|
|
||||||
ComposableNode(
|
|
||||||
package='nav2_lifecycle_manager',
|
|
||||||
plugin='nav2_lifecycle_manager::LifecycleManager',
|
|
||||||
name='lifecycle_manager_navigation',
|
|
||||||
parameters=[{'use_sim_time': use_sim_time,
|
|
||||||
'autostart': autostart,
|
|
||||||
'node_names': lifecycle_nodes}]),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
# Create the launch description and populate
|
|
||||||
ld = LaunchDescription()
|
|
||||||
|
|
||||||
# Set environment variables
|
|
||||||
ld.add_action(stdout_linebuf_envvar)
|
|
||||||
|
|
||||||
# Declare the launch options
|
|
||||||
ld.add_action(declare_namespace_cmd)
|
|
||||||
ld.add_action(declare_use_sim_time_cmd)
|
|
||||||
ld.add_action(declare_params_file_cmd)
|
|
||||||
ld.add_action(declare_autostart_cmd)
|
|
||||||
ld.add_action(declare_use_composition_cmd)
|
|
||||||
ld.add_action(declare_container_name_cmd)
|
|
||||||
ld.add_action(declare_use_respawn_cmd)
|
|
||||||
ld.add_action(declare_log_level_cmd)
|
|
||||||
# Add the actions to launch all of the navigation nodes
|
|
||||||
ld.add_action(load_nodes)
|
|
||||||
ld.add_action(load_composable_nodes)
|
|
||||||
|
|
||||||
return ld
|
|
|
@ -1,146 +0,0 @@
|
||||||
# Copyright (c) 2018 Intel Corporation
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from ament_index_python.packages import get_package_share_directory
|
|
||||||
|
|
||||||
from launch import LaunchDescription
|
|
||||||
from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable
|
|
||||||
from launch.substitutions import LaunchConfiguration
|
|
||||||
from launch_ros.actions import Node
|
|
||||||
from nav2_common.launch import RewrittenYaml
|
|
||||||
|
|
||||||
|
|
||||||
def generate_launch_description():
|
|
||||||
# Get the launch directory
|
|
||||||
bringup_dir = get_package_share_directory('sportmode_nav2')
|
|
||||||
|
|
||||||
namespace = LaunchConfiguration('namespace')
|
|
||||||
use_sim_time = LaunchConfiguration('use_sim_time')
|
|
||||||
autostart = LaunchConfiguration('autostart')
|
|
||||||
params_file = LaunchConfiguration('params_file')
|
|
||||||
default_bt_xml_filename = LaunchConfiguration('default_bt_xml_filename')
|
|
||||||
map_subscribe_transient_local = LaunchConfiguration('map_subscribe_transient_local')
|
|
||||||
|
|
||||||
lifecycle_nodes = ['controller_server',
|
|
||||||
'planner_server',
|
|
||||||
'recoveries_server',
|
|
||||||
'bt_navigator',
|
|
||||||
'waypoint_follower']
|
|
||||||
|
|
||||||
# Map fully qualified names to relative ones so the node's namespace can be prepended.
|
|
||||||
# In case of the transforms (tf), currently, there doesn't seem to be a better alternative
|
|
||||||
# https://github.com/ros/geometry2/issues/32
|
|
||||||
# https://github.com/ros/robot_state_publisher/pull/30
|
|
||||||
# TODO(orduno) Substitute with `PushNodeRemapping`
|
|
||||||
# https://github.com/ros2/launch_ros/issues/56
|
|
||||||
remappings = [('/tf', '/tf'),
|
|
||||||
('/tf_static', '/tf_static'),
|
|
||||||
('/cmd_vel', '/go2/cmd_vel')]
|
|
||||||
|
|
||||||
# Create our own temporary YAML files that include substitutions
|
|
||||||
param_substitutions = {
|
|
||||||
'use_sim_time': use_sim_time,
|
|
||||||
'default_bt_xml_filename': default_bt_xml_filename,
|
|
||||||
'autostart': autostart,
|
|
||||||
'map_subscribe_transient_local': map_subscribe_transient_local}
|
|
||||||
|
|
||||||
configured_params = RewrittenYaml(
|
|
||||||
source_file=params_file,
|
|
||||||
root_key=namespace,
|
|
||||||
param_rewrites=param_substitutions,
|
|
||||||
convert_types=True)
|
|
||||||
|
|
||||||
return LaunchDescription([
|
|
||||||
# Set env var to print messages to stdout immediately
|
|
||||||
SetEnvironmentVariable('RCUTILS_LOGGING_BUFFERED_STREAM', '1'),
|
|
||||||
|
|
||||||
DeclareLaunchArgument(
|
|
||||||
'namespace', default_value='',
|
|
||||||
description='Top-level namespace'),
|
|
||||||
|
|
||||||
DeclareLaunchArgument(
|
|
||||||
'use_sim_time', default_value='false',
|
|
||||||
description='Use simulation (Gazebo) clock if true'),
|
|
||||||
|
|
||||||
DeclareLaunchArgument(
|
|
||||||
'autostart', default_value='true',
|
|
||||||
description='Automatically startup the nav2 stack'),
|
|
||||||
|
|
||||||
DeclareLaunchArgument(
|
|
||||||
'params_file',
|
|
||||||
default_value=os.path.join(bringup_dir, 'params', 'nav2_params.yaml'),
|
|
||||||
description='Full path to the ROS2 parameters file to use'),
|
|
||||||
|
|
||||||
DeclareLaunchArgument(
|
|
||||||
'default_bt_xml_filename',
|
|
||||||
default_value=os.path.join(
|
|
||||||
get_package_share_directory('nav2_bt_navigator'),
|
|
||||||
'behavior_trees', 'navigate_w_replanning_and_recovery.xml'),
|
|
||||||
description='Full path to the behavior tree xml file to use'),
|
|
||||||
|
|
||||||
DeclareLaunchArgument(
|
|
||||||
'map_subscribe_transient_local', default_value='false',
|
|
||||||
description='Whether to set the map subscriber QoS to transient local'),
|
|
||||||
|
|
||||||
Node(
|
|
||||||
package='nav2_controller',
|
|
||||||
executable='controller_server',
|
|
||||||
output='screen',
|
|
||||||
parameters=[configured_params],
|
|
||||||
remappings=remappings),
|
|
||||||
|
|
||||||
Node(
|
|
||||||
package='nav2_planner',
|
|
||||||
executable='planner_server',
|
|
||||||
name='planner_server',
|
|
||||||
output='screen',
|
|
||||||
parameters=[configured_params],
|
|
||||||
remappings=remappings),
|
|
||||||
|
|
||||||
Node(
|
|
||||||
package='nav2_recoveries',
|
|
||||||
executable='recoveries_server',
|
|
||||||
name='recoveries_server',
|
|
||||||
output='screen',
|
|
||||||
parameters=[configured_params],
|
|
||||||
remappings=remappings),
|
|
||||||
|
|
||||||
Node(
|
|
||||||
package='nav2_bt_navigator',
|
|
||||||
executable='bt_navigator',
|
|
||||||
name='bt_navigator',
|
|
||||||
output='screen',
|
|
||||||
parameters=[configured_params],
|
|
||||||
remappings=remappings),
|
|
||||||
|
|
||||||
Node(
|
|
||||||
package='nav2_waypoint_follower',
|
|
||||||
executable='waypoint_follower',
|
|
||||||
name='waypoint_follower',
|
|
||||||
output='screen',
|
|
||||||
parameters=[configured_params],
|
|
||||||
remappings=remappings),
|
|
||||||
|
|
||||||
Node(
|
|
||||||
package='nav2_lifecycle_manager',
|
|
||||||
executable='lifecycle_manager',
|
|
||||||
name='lifecycle_manager_navigation',
|
|
||||||
output='screen',
|
|
||||||
parameters=[{'use_sim_time': use_sim_time},
|
|
||||||
{'autostart': autostart},
|
|
||||||
{'node_names': lifecycle_nodes}]),
|
|
||||||
|
|
||||||
])
|
|
|
@ -1,73 +0,0 @@
|
||||||
slam_toolbox:
|
|
||||||
ros__parameters:
|
|
||||||
|
|
||||||
# Plugin params
|
|
||||||
solver_plugin: solver_plugins::CeresSolver
|
|
||||||
ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
|
|
||||||
ceres_preconditioner: SCHUR_JACOBI
|
|
||||||
ceres_trust_strategy: LEVENBERG_MARQUARDT
|
|
||||||
ceres_dogleg_type: TRADITIONAL_DOGLEG
|
|
||||||
ceres_loss_function: None
|
|
||||||
|
|
||||||
# ROS Parameters
|
|
||||||
odom_frame: odom
|
|
||||||
map_frame: map
|
|
||||||
base_frame: base_link # ToDo: add a base_footprint to the URDF
|
|
||||||
scan_topic: /go2/scan
|
|
||||||
mode: mapping #localization
|
|
||||||
|
|
||||||
# if you'd like to immediately start continuing a map at a given pose
|
|
||||||
# or at the dock, but they are mutually exclusive, if pose is given
|
|
||||||
# will use pose
|
|
||||||
#map_file_name: test_steve
|
|
||||||
# map_start_pose: [0.0, 0.0, 0.0]
|
|
||||||
#map_start_at_dock: true
|
|
||||||
|
|
||||||
debug_logging: false
|
|
||||||
throttle_scans: 1
|
|
||||||
transform_publish_period: 0.02 #if 0 never publishes odometry
|
|
||||||
map_update_interval: 5.0
|
|
||||||
resolution: 0.05
|
|
||||||
max_laser_range: 5.0 #for rastering images
|
|
||||||
minimum_time_interval: 0.5
|
|
||||||
transform_timeout: 0.2
|
|
||||||
tf_buffer_duration: 30.
|
|
||||||
stack_size_to_use: 40000000 #// program needs a larger stack size to serialize large maps
|
|
||||||
enable_interactive_mode: true
|
|
||||||
|
|
||||||
# General Parameters
|
|
||||||
use_scan_matching: true
|
|
||||||
use_scan_barycenter: true
|
|
||||||
minimum_travel_distance: 0.5
|
|
||||||
minimum_travel_heading: 0.5
|
|
||||||
scan_buffer_size: 10
|
|
||||||
scan_buffer_maximum_scan_distance: 10.0
|
|
||||||
link_match_minimum_response_fine: 0.1
|
|
||||||
link_scan_maximum_distance: 1.5
|
|
||||||
loop_search_maximum_distance: 3.0
|
|
||||||
do_loop_closing: true
|
|
||||||
loop_match_minimum_chain_size: 10
|
|
||||||
loop_match_maximum_variance_coarse: 3.0
|
|
||||||
loop_match_minimum_response_coarse: 0.35
|
|
||||||
loop_match_minimum_response_fine: 0.45
|
|
||||||
|
|
||||||
# Correlation Parameters - Correlation Parameters
|
|
||||||
correlation_search_space_dimension: 0.5
|
|
||||||
correlation_search_space_resolution: 0.01
|
|
||||||
correlation_search_space_smear_deviation: 0.1
|
|
||||||
|
|
||||||
# Correlation Parameters - Loop Closure Parameters
|
|
||||||
loop_search_space_dimension: 8.0
|
|
||||||
loop_search_space_resolution: 0.05
|
|
||||||
loop_search_space_smear_deviation: 0.03
|
|
||||||
|
|
||||||
# Scan Matcher Parameters
|
|
||||||
distance_variance_penalty: 0.5
|
|
||||||
angle_variance_penalty: 1.0
|
|
||||||
|
|
||||||
fine_search_angle_offset: 0.00349
|
|
||||||
coarse_search_angle_offset: 0.349
|
|
||||||
coarse_angle_resolution: 0.0349
|
|
||||||
minimum_angle_penalty: 0.9
|
|
||||||
minimum_distance_penalty: 0.5
|
|
||||||
use_response_expansion: true
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
CONTAINER_NAME="go2py_mexplore"
|
||||||
|
|
||||||
|
# Function to print usage
|
||||||
|
function usage() {
|
||||||
|
echo "Usage: run_mexplore.sh"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to check if docker command succeeded
|
||||||
|
function check_docker() {
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Docker command failed. Please check your Docker installation."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Prevent running as root
|
||||||
|
if [ $(id -u) -eq 0 ]; then
|
||||||
|
echo "This script cannot be executed with root privileges."
|
||||||
|
echo "Please re-run without sudo and configure docker for non-root user if needed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if user can run docker without root
|
||||||
|
if [[ ! $(groups $USER) =~ docker ]]; then
|
||||||
|
echo "User |$USER| is not a member of the 'docker' group and cannot run docker commands without sudo."
|
||||||
|
echo "Run 'sudo usermod -aG docker \$USER && newgrp docker' to add user to 'docker' group, then re-run this script."
|
||||||
|
echo "See: https://docs.docker.com/engine/install/linux-postinstall/"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if able to run docker commands
|
||||||
|
docker ps &>/dev/null
|
||||||
|
check_docker
|
||||||
|
|
||||||
|
# Check if the container is running
|
||||||
|
if [ "$(docker ps -q -f name=$CONTAINER_NAME)" ]; then
|
||||||
|
echo "Attaching to running container: $CONTAINER_NAME"
|
||||||
|
docker exec -it --workdir /home/nav2_ws $CONTAINER_NAME /bin/bash
|
||||||
|
check_docker
|
||||||
|
else
|
||||||
|
echo "Starting new container: $CONTAINER_NAME"
|
||||||
|
sudo docker run -it --rm --name $CONTAINER_NAME --privileged --network host --ipc=host -v $(pwd)/deploy/ros2_nodes/m-explore-ros2:/home/explore_ws/src/m-explore-ros2 -v /dev/*:/dev/* -v /etc/localtime:/etc/localtime:ro --workdir /home/explore_ws go2py_mexplore:latest
|
||||||
|
check_docker
|
||||||
|
fi
|
|
@ -41,6 +41,6 @@ if [ "$(docker ps -q -f name=$CONTAINER_NAME)" ]; then
|
||||||
check_docker
|
check_docker
|
||||||
else
|
else
|
||||||
echo "Starting new container: $CONTAINER_NAME"
|
echo "Starting new container: $CONTAINER_NAME"
|
||||||
sudo docker run -it --rm --name $CONTAINER_NAME --privileged --network host --ipc=host -v $(pwd)/deploy/ros2_nodes/sportmode_nav2:/home/nav2_ws/src/sportmode_nav2 -v /dev/*:/dev/* -v /etc/localtime:/etc/localtime:ro -v /home/unitree/Go2Py/deploy/SGNav/llm_planner:/home/llm_planner --runtime nvidia --workdir /home/nav2_ws go2py_nav2:latest
|
sudo docker run -it --rm --name $CONTAINER_NAME --privileged --network host --ipc=host -v $(pwd)/deploy/ros2_nodes/sportmode_nav2:/home/nav2_ws/src/sportmode_nav2 -v /dev/*:/dev/* -v /etc/localtime:/etc/localtime:ro -v /home/unitree/Go2Py/deploy/SGNav/llm_planner:/home/llm_planner --workdir /home/nav2_ws go2py_nav2:latest
|
||||||
check_docker
|
check_docker
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue