Skip to content

Commit 4c43f3b

Browse files
committed
feat: add GitHub Actions workflow for ROS CI and Copilot instructions
1 parent ea8b2cc commit 4c43f3b

2 files changed

Lines changed: 101 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Livox ROS Driver 2 — Copilot Instructions
2+
3+
## Project Overview
4+
5+
This is a ROS2 device driver for Livox 3D LiDAR sensors (MID360, HAP). It targets **ROS2 Humble or later**. The codebase also retains partial ROS1 compatibility gated behind `#ifdef BUILDING_ROS1` preprocessor guards. But only every work on the ROS2 code.
6+
7+
## Build and Test
8+
9+
```bash
10+
# From the workspace root (/ros2_ws)
11+
colcon build
12+
13+
```
14+
15+
## Architecture
16+
17+
- **`src/driver_node.*`** — ROS2 node entry point, lifecycle management
18+
- **`src/lddc.*`** — Lidar Data Distribution Center; routes point cloud and IMU data to ROS publishers
19+
- **`src/lds_lidar.*` / `src/lds.*`** — Lidar Device Scheduler; manages sensor connections and data pipelines
20+
- **`src/comm/`** — Low-level communication utilities: queues, semaphores, caching, and the central `PubHandler`
21+
- **`src/call_back/`** — SDK callback handlers for incoming lidar/IMU frames
22+
- **`src/parse_cfg_file/`** — JSON config file parsing (uses RapidJSON from `3rdparty/`)
23+
- **`src/include/`** — Shared headers; `ros_headers.h` abstracts ROS1/ROS2 includes
24+
- **`config/`** — Per-sensor JSON configuration files
25+
- **`launch/`** — ROS2 Python launch files
26+
27+
## Code Conventions
28+
29+
- **Language**: C++14, namespace `livox_ros`
30+
- **Naming**: `PascalCase` for classes, `snake_case` for functions and member variables
31+
- **Header guards**: `#ifndef LIVOX_<MODULE>_H` / `#define LIVOX_<MODULE>_H`
32+
- **ROS abstraction**: Use the wrappers in `src/include/ros_headers.h` rather than including ROS headers directly; guard any ROS1-specific code with `#ifdef BUILDING_ROS1`
33+
- **JSON parsing**: Use the bundled RapidJSON library in `3rdparty/rapidjson/`
34+
- **License header**: All new source files must include the MIT license block present in existing files
35+
36+
## Dependencies
37+
38+
Key runtime deps: `rclcpp`, `rclcpp_components`, `sensor_msgs`, `pcl_conversions`, `livox_lidar_sdk`.
39+
Do **not** add new third-party libraries without updating both `CMakeLists.txt` and `package.xml`.

.github/workflows/ros-ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: ros CI
2+
3+
on:
4+
push:
5+
# you may want to configure the branches that this should be run on here.
6+
branches: [ "master" ]
7+
pull_request:
8+
branches: [ "master" ]
9+
10+
jobs:
11+
test_docker: # On Linux, iterates on all ROS 1 and ROS 2 distributions.
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
ros_distribution:
16+
# - noetic
17+
- humble
18+
# - iron
19+
20+
# Define the Docker image(s) associated with each ROS distribution.
21+
# The include syntax allows additional variables to be defined, like
22+
# docker_image in this case. See documentation:
23+
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-configurations-in-a-matrix-build
24+
#
25+
# Platforms are defined in REP 3 and REP 2000:
26+
# https://ros.org/reps/rep-0003.html
27+
# https://ros.org/reps/rep-2000.html
28+
include:
29+
# Noetic Ninjemys (May 2020 - May 2025)
30+
# - docker_image: ubuntu:focal
31+
# ros_distribution: noetic
32+
# ros_version: 1
33+
34+
# Humble Hawksbill (May 2022 - May 2027)
35+
- docker_image: ubuntu:jammy
36+
ros_distribution: humble
37+
ros_version: 2
38+
39+
# Iron Irwini (May 2023 - November 2024)
40+
# - docker_image: ubuntu:jammy
41+
# ros_distribution: iron
42+
# ros_version: 2
43+
44+
# # Rolling Ridley (No End-Of-Life)
45+
# - docker_image: ubuntu:jammy
46+
# ros_distribution: rolling
47+
# ros_version: 2
48+
49+
container:
50+
image: ${{ matrix.docker_image }}
51+
steps:
52+
- uses: actions/checkout@v3
53+
path: src/livox_ros_driver2
54+
- name: setup ROS environment
55+
uses: ros-tooling/setup-ros@v0.7
56+
- name: build and test ROS 2
57+
if: ${{ matrix.ros_version == 2 }}
58+
uses: ros-tooling/action-ros-ci@v0.3
59+
with:
60+
import-token: ${{ github.token }}
61+
target-ros2-distro: ${{ matrix.ros_distribution }}
62+
skip-tests: true

0 commit comments

Comments
 (0)