diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cdc0e0c..a28e505 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: - name: Scripts tests run: if [ -d scripts/test ]; then python -m pytest -q scripts/test; fi - name: Compose file - run: docker compose --profile foxy --profile humble --profile jazzy config -q + run: docker compose --profile foxy config -q docs: runs-on: ubuntu-22.04 @@ -87,8 +87,7 @@ jobs: container: ros:${{ matrix.distro }}-ros-base env: BRANCH: ${{ github.head_ref || github.ref_name }} - ROS_LOCALHOST_ONLY: "1" # foxy, humble - ROS_AUTOMATIC_DISCOVERY_RANGE: LOCALHOST # jazzy + ROS_LOCALHOST_ONLY: "1" PYTHONUNBUFFERED: "1" defaults: run: diff --git a/compose.yaml b/compose.yaml index 228a76b..3b366b4 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,6 +1,6 @@ -# Dev containers, one per ROS distro: scripts/dev.sh up --distro foxy|humble|jazzy -# (or docker compose --profile jazzy up -d --build). Build artefacts live in per-distro volumes: -# the build/ of one distro must never mix with another's. +# The dev container: ROS 2 Foxy on Ubuntu 20.04, as on the robot. scripts/dev.sh up +# (or docker compose --profile foxy up -d --build). Build artefacts live in named volumes, so the +# macOS bind mount only carries the sources. name: hotdog x-dev: &dev @@ -40,55 +40,7 @@ services: - install-foxy:/home/robot/ws/install - log-foxy:/home/robot/ws/log - dev-humble: - <<: *dev - profiles: [humble] - build: - <<: *build - args: - ROS_DISTRO: humble - USER_UID: ${USER_UID:-1000} - USER_GID: ${USER_GID:-1000} - image: hotdog-dev:humble - container_name: hotdog-dev-humble - hostname: hotdog-humble - ports: - - "127.0.0.1:5901:5901" # VNC (vnc://localhost:5901) - - "127.0.0.1:6080:6080" # noVNC (http://localhost:6080/vnc.html) - volumes: - - .:/home/robot/ws - - build-humble:/home/robot/ws/build - - install-humble:/home/robot/ws/install - - log-humble:/home/robot/ws/log - - dev-jazzy: - <<: *dev - profiles: [jazzy] - build: - <<: *build - args: - ROS_DISTRO: jazzy - USER_UID: ${USER_UID:-1000} - USER_GID: ${USER_GID:-1000} - image: hotdog-dev:jazzy - container_name: hotdog-dev-jazzy - hostname: hotdog-jazzy - ports: - - "127.0.0.1:5902:5901" # VNC (vnc://localhost:5902) - - "127.0.0.1:6081:6080" # noVNC (http://localhost:6081/vnc.html) - volumes: - - .:/home/robot/ws - - build-jazzy:/home/robot/ws/build - - install-jazzy:/home/robot/ws/install - - log-jazzy:/home/robot/ws/log - volumes: build-foxy: install-foxy: log-foxy: - build-humble: - install-humble: - log-humble: - build-jazzy: - install-jazzy: - log-jazzy: diff --git a/docker/Dockerfile b/docker/Dockerfile index 24827d2..bd85254 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -62,12 +62,13 @@ RUN case "${ROS_DISTRO}" in \ RUN pipx install --python "$(command -v python3.9 || command -v python3)" "pre-commit>=3.5" \ && pipx install "ruff==0.16.9" -# ROS dependencies of every package in src/ (vendor packages that are not checked out: skipped) +# ROS dependencies of every package in src/ (vendor packages that are not checked out: skipped; +# FAST-LIO, legKILO and Livox: HotDog runs on the M20's own odometry) COPY --from=manifests /src /tmp/src RUN apt-get update \ && rosdep update --rosdistro "${ROS_DISTRO}" --include-eol-distros \ && rosdep install --from-paths /tmp/src --ignore-src -r -y --rosdistro "${ROS_DISTRO}" \ - --skip-keys "python3-loguru" \ + --skip-keys "python3-loguru fast_lio legkilo livox_ros_driver2" \ && rm -rf /var/lib/apt/lists/* /tmp/src # User with the host's uid (the noble images already have uid 1000: ubuntu). A gid the image diff --git a/scripts/dev.sh b/scripts/dev.sh index aac6063..5bf881f 100755 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -# Dev container helper (Linux / macOS): one container per ROS distro, see compose.yaml. +# Dev container helper (Linux / macOS): ROS 2 Foxy as on the robot, see compose.yaml. # -# scripts/dev.sh [--distro foxy|humble|jazzy] [args] +# scripts/dev.sh [args] # # up import the stack if missing, build the image if needed, start the container # shell interactive shell inside (ROS and the workspace sourced) @@ -9,12 +9,12 @@ # test [args] colcon test + colcon test-result inside # vnc print the VNC / noVNC addresses (opens Screen Sharing on macOS) # down stop and remove the container (build/install/log volumes are kept) -# clean down, then delete this distro's build/install/log volumes +# clean down, then delete the build/install/log volumes # import [--update] vcs import dharma.repos and external.repos into src/ (--update: move # existing checkouts to the listed versions too); plain git without vcstool # doctor check Docker, compose, CPU / memory, the architecture and GitHub access # -# Env: DHARMA_DISTRO (default distro, foxy), VNC_PASSWORD (dharma), VNC=0 (no desktop), +# Env: VNC_PASSWORD (dharma), VNC=0 (no desktop), # USER_UID / USER_GID (container user; default: yours on Linux, 1000 on macOS, where # Docker Desktop maps file ownership of the bind mount itself) # Runs on the bash 3.2 of macOS: no empty "${array[@]}" under set -u, no bash 4 features. @@ -26,23 +26,11 @@ usage() { sed -n '2,/^set -/p' "$0" | sed -e '$d' -e 's/^# \{0,1\}//' } -DISTRO="${DHARMA_DISTRO:-foxy}" -ARGS=() -while [[ $# -gt 0 ]]; do - case "$1" in - --distro) DISTRO="${2:-}"; shift 2 || { usage; exit 1; } ;; - --distro=*) DISTRO="${1#*=}"; shift ;; - -h | --help) usage; exit 0 ;; - *) ARGS+=("$1"); shift ;; - esac -done -set -- "${ARGS[@]+"${ARGS[@]}"}" -case "$DISTRO" in - foxy) VNC_PORT=5903 NOVNC_PORT=6082 ;; - humble) VNC_PORT=5901 NOVNC_PORT=6080 ;; - jazzy) VNC_PORT=5902 NOVNC_PORT=6081 ;; - *) echo "unknown distro '$DISTRO': foxy, humble or jazzy" >&2; exit 1 ;; +DISTRO=foxy # the robot's: Ubuntu 20.04, ROS 2 Foxy +case "${1:-}" in + -h | --help) usage; exit 0 ;; esac +VNC_PORT=5903 NOVNC_PORT=6082 SERVICE="dev-$DISTRO" if [[ "$(uname -s)" == Linux ]]; then # the bind-mounted workspace stays yours: the container user gets your uid / gid diff --git a/scripts/timesync.sh b/scripts/timesync.sh index 066f5c4..a029c0c 100755 --- a/scripts/timesync.sh +++ b/scripts/timesync.sh @@ -11,8 +11,9 @@ # the distribution's pool) and serves the robot's other computers in TIME_ALLOW (space # separated subnets, e.g. "192.168.123.0/24"). `local stratum 10` keeps serving them without # internet. Replaces systemd-timesyncd. -# ptp: ptp4l is the PTP master on the network interface of the LiDAR, so a Livox Mid-360 (PTPv2 -# over UDP) stamps its points with this computer's clock. The interface is PTP_IFACE, else the +# ptp: ptp4l is the PTP master on the network interface of the LiDAR, so a LiDAR that takes PTPv2 +# over UDP stamps its points with this computer's clock. HotDog does not need it: its Airy are +# stamped on arrival (rslidar.yaml use_lidar_clock: false). The interface is PTP_IFACE, else the # one that routes to LIDAR_IP (or LIVOX_IP); without either, PTP is skipped. # PTP_TIMESTAMPING=software (default, any interface) or hardware (the interface's own clock, # kept on the system clock by phc2sys). @@ -122,7 +123,7 @@ ptp_config() { # ptp_config local only=masterOnly [[ "${1:-3}" -ge 4 ]] && only=serverOnly cat <- source /opt/ros/${ROS_DISTRO}/setup.bash && source ${WS}/install/setup.bash && BRINGUP_CONFIG=$(ros2 pkg prefix hotdog)/share/hotdog/config && @@ -46,8 +49,25 @@ windows: - window_name: health panes: - shell_command: ros2 launch dharma_health health.launch.py $BRINGUP_ARGS + - window_name: inspection + layout: even-vertical + panes: + - shell_command: >- + ros2 launch unipod_driver unipod_driver.launch.py namespace:=unipod + ip:=${POD_IP} + - shell_command: >- + ros2 launch hotdog_inspection inspection.launch.py $BRINGUP_ARGS + sites_dir:=${SITES_DIR} + - window_name: patrol + layout: even-vertical + panes: + - shell_command: >- + ros2 launch hotdog_patrol patrol.launch.py $BRINGUP_ARGS robot_ns:=${ROBOT_NS} + sites_dir:=${SITES_DIR} + - shell_command: ros2 launch hotdog_reports reports.launch.py $BRINGUP_ARGS + - shell_command: ros2 launch hotdog_alerts alerts.launch.py $BRINGUP_ARGS - window_name: shell layout: even-horizontal panes: - - shell_command: "# ros2 service call /localization/assume_origin std_srvs/srv/Trigger" - - shell_command: watch -n 2 ros2 node list + - shell_command: "# scripts/hotdog.sh status | patrol | return | estop | teach ..." + - shell_command: watch -n 5 scripts/hotdog.sh status diff --git a/scripts/tmux/sim.yaml b/scripts/tmux/sim.yaml index 0033b09..8b3dce5 100644 --- a/scripts/tmux/sim.yaml +++ b/scripts/tmux/sim.yaml @@ -17,4 +17,4 @@ windows: - shell_command: >- # ros2 topic pub --once /sim/obstacles geometry_msgs/msg/PoseArray "{poses: [{position: {x: 2.0, y: -3.0}}]}" - - shell_command: watch -n 2 ros2 topic echo --once /navigation/status + - shell_command: watch -n 5 scripts/hotdog.sh status