Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
54 changes: 3 additions & 51 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
5 changes: 3 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 8 additions & 20 deletions scripts/dev.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#!/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] <command> [args]
# scripts/dev.sh <command> [args]
#
# up import the stack if missing, build the image if needed, start the container
# shell interactive shell inside (ROS and the workspace sourced)
# build [args] colcon build inside (args go to colcon, e.g. --packages-up-to hotdog)
# 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.
Expand All @@ -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
Expand Down
7 changes: 4 additions & 3 deletions scripts/timesync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -122,7 +123,7 @@ ptp_config() { # ptp_config <ptp4l major version>
local only=masterOnly
[[ "${1:-3}" -ge 4 ]] && only=serverOnly
cat <<EOF
# Written by scripts/timesync.sh: PTP master for the LiDAR (Livox Mid-360: PTPv2 over UDP).
# Written by scripts/timesync.sh: PTP master for the LiDAR (PTPv2 over UDP).
[global]
$only 1
priority1 127
Expand Down
26 changes: 23 additions & 3 deletions scripts/tmux/robot.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# scripts/start_tmux.sh robot: the stack on the robot, one window per subsystem.
# scripts/start_tmux.sh robot: the stack on the robot, one window per subsystem (for debugging:
# the service runs the same with `ros2 launch hotdog robot.launch.py`; stop it first).
# For this robot's settings add params_file:=/etc/hotdog/site.yaml to BRINGUP_ARGS.
session_name: robot
environment:
ROBOT_NS: m20
ROBOT_DRIVER: m20_bringup
ROBOT_IP: 10.21.31.103
SITE: ""
SITES_DIR: ""
POD_IP: 10.21.31.26 # unipod_driver default
setup: >-
source /opt/ros/${ROS_DISTRO}/setup.bash && source ${WS}/install/setup.bash &&
BRINGUP_CONFIG=$(ros2 pkg prefix hotdog)/share/hotdog/config &&
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion scripts/tmux/sim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading