$npx -y skills add arpitg1304/robotics-agent-skills --skill robot-bringupPatterns and best practices for bringing up a complete ROS2-based robotics system on a robot's onboard computer, including systemd services, launch file composition, ordered startup, and production monitoring. Use this skill when configuring a robot to start ROS2 nodes on boot, w
| 1 | # Robot Bringup Skill |
| 2 | |
| 3 | ## When to Use This Skill |
| 4 | |
| 5 | - Configuring a robot to automatically start its full ROS2 stack on boot via systemd |
| 6 | - Writing systemd unit files that correctly source ROS2 workspaces and set DDS environment |
| 7 | - Composing layered launch files (hardware, drivers, perception, application) into a single bringup |
| 8 | - Setting up ordered startup with health checks to avoid race conditions between dependent nodes |
| 9 | - Writing udev rules for deterministic device naming of cameras, LiDARs, and serial devices |
| 10 | - Configuring CycloneDDS or FastDDS for multi-machine ROS2 discovery across robot and base station |
| 11 | - Implementing watchdog and heartbeat monitoring for production robot systems |
| 12 | - Setting up log rotation and structured logging for long-running robot deployments |
| 13 | - Writing graceful shutdown handlers that bring actuators to a safe state before exit |
| 14 | - Debugging boot-time failures, service ordering issues, or device enumeration races |
| 15 | |
| 16 | ## The Robot Bringup Stack |
| 17 | |
| 18 | A production robot bringup follows a layered startup sequence from hardware initialization through application-level nodes. Each layer depends on the one below it. |
| 19 | |
| 20 | ``` |
| 21 | ┌─────────────────────────────────────────────────────────────────────┐ |
| 22 | │ APPLICATION LAYER │ |
| 23 | │ Navigation, manipulation, mission planning, HRI │ |
| 24 | ├─────────────────────────────────────────────────────────────────────┤ |
| 25 | │ PERCEPTION LAYER │ |
| 26 | │ Object detection, SLAM, point cloud filtering, sensor fusion │ |
| 27 | ├─────────────────────────────────────────────────────────────────────┤ |
| 28 | │ DRIVER LAYER │ |
| 29 | │ Camera drivers, LiDAR drivers, motor controllers, IMU │ |
| 30 | ├─────────────────────────────────────────────────────────────────────┤ |
| 31 | │ HARDWARE LAYER │ |
| 32 | │ udev rules, device enumeration, USB reset, firmware check │ |
| 33 | ├─────────────────────────────────────────────────────────────────────┤ |
| 34 | │ ROS2 ENVIRONMENT │ |
| 35 | │ Source workspace, set RMW, ROS_DOMAIN_ID, DDS config │ |
| 36 | ├─────────────────────────────────────────────────────────────────────┤ |
| 37 | │ SYSTEMD TARGETS & SERVICES │ |
| 38 | │ network-online.target → robot-hw.target → robot-bringup.target │ |
| 39 | ├─────────────────────────────────────────────────────────────────────┤ |
| 40 | │ LINUX BOOT (systemd) │ |
| 41 | │ BIOS/UEFI → GRUB → kernel → systemd init │ |
| 42 | ├─────────────────────────────────────────────────────────────────────┤ |
| 43 | │ HARDWARE BOOT │ |
| 44 | │ Power supply, onboard computer, peripherals │ |
| 45 | └─────────────────────────────────────────────────────────────────────┘ |
| 46 | ``` |
| 47 | |
| 48 | ## systemd Service Units for ROS2 |
| 49 | |
| 50 | ### Basic ROS2 Service Unit |
| 51 | |
| 52 | Place service files in `/etc/systemd/system/`. This template starts a ROS2 launch file as a long-running service with watchdog support. |
| 53 | |
| 54 | ```ini |
| 55 | # /etc/systemd/system/robot-bringup.service |
| 56 | [Unit] |
| 57 | Description=Robot ROS2 Bringup Stack |
| 58 | Documentation=https://github.com/my-org/my-robot |
| 59 | After=network-online.target robot-hw.target |
| 60 | Wants=network-online.target |
| 61 | Requires=robot-hw.target |
| 62 | |
| 63 | [Service] |
| 64 | Type=notify |
| 65 | User=robot |
| 66 | Group=robot |
| 67 | WorkingDirectory=/home/robot |
| 68 | |
| 69 | # Load ROS2 environment variables from a dedicated env file |
| 70 | EnvironmentFile=/etc/robot/ros2.env |
| 71 | |
| 72 | # Pre-start check: verify critical devices exist |
| 73 | ExecStartPre=/usr/local/bin/robot-device-check.sh |
| 74 | |
| 75 | # Start the ROS2 launch file via bash so we can source the workspace |
| 76 | ExecStart=/bin/ |