Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b9bcadd
Created ROS2 Topic to send pose data from Perception to M&L
boots962 Oct 28, 2026
3561262
Merge pull request #71 from WE-Autopilot/ml/sync-main
HamzaKababji Oct 28, 2026
62bf758
Add CARLA bag filter to mimic kart LiDAR and IMU
Gabe575 Oct 30, 2026
9151dd0
Updated CODEOWNERS to include M&L Leads
HamzaKababji Oct 30, 2026
03fe33d
Merge pull request #76 from WE-Autopilot/main
HamzaKababji Nov 2, 2026
dacea90
Add LIO-SAM paper-bag params and updated setup docs
HamzaKababji Nov 2, 2026
e31d130
Cap lidar max range per beam group
Gabe575 Nov 2, 2026
d4b16f5
Document sensor extrinsics and mount orientation
Gabe575 Nov 2, 2026
9d156e3
Reject bad configs and raw bags instead of warning
Gabe575 Nov 2, 2026
c0ba3f8
Merge pull request #75 from WE-Autopilot/ml/carla-data-filter
Gabe575 Nov 3, 2026
f8fbbd9
Merge pull request #77 from WE-Autopilot/ml/lio-sam-build
HamzaKababji Nov 4, 2026
bfa362a
Add LIO-SAM params and launch for CARLA sensor set
HamzaKababji Nov 5, 2026
26bca5d
Added script to record ros2 bags from carla maps
Gabe575 Nov 5, 2026
d832777
Update simulation README
Gabe575 Nov 5, 2026
517cfb5
Added comments for running recorder script in WSL
Nov 5, 2026
b884e8f
moved content to localization package, and test, finalized publish to…
YellowAli Nov 6, 2026
660f3e8
Merge branch 'main' into ml/DynamicRosTopic
YellowAli Nov 6, 2026
a514380
Shut down launch when a LIO-SAM node dies; add runtime deps
HamzaKababji Nov 7, 2026
2de6e4e
Rename LIO-SAM's hardcoded lidar_link TF so it doesn't steal the sens…
HamzaKababji Nov 7, 2026
4617fb3
Use CV7-derived IMU noise values
HamzaKababji Nov 7, 2026
3340390
Split record_bag.py into modules and share helpers with filter_bag.py
Nov 7, 2026
2b12cf9
Add recording.yaml, CARLA version check and startup checks
Nov 7, 2026
8ca8a12
Add recorder tests and update simulation README
Nov 7, 2026
a2b3e10
Merge pull request #86 from WE-Autopilot/ml/DynamicRosTopic
YellowAli Nov 7, 2026
d78433d
added bag replay and map save script
osma-id Nov 8, 2026
f1970eb
added bag replay section in readme
osma-id Nov 8, 2026
837fffe
Merge pull request #82 from WE-Autopilot/ml/carla-bag-script
Gabe575 Nov 8, 2026
0490305
reworked odom monitoring and update readme examples
osma-id Nov 9, 2026
e064a0f
removed random space
osma-id Nov 9, 2026
4c5fd90
Convert run_lio_sam.py to LF, drop unused variable, tidy docstring an…
HamzaKababji Nov 9, 2026
d1e2366
Merge pull request #87 from WE-Autopilot/ml/bag-replay-map-save-script
osma-id Nov 10, 2026
28877c6
Merge pull request #84 from WE-Autopilot/ml/lio-sam-tf-frame-fix
HamzaKababji Nov 11, 2026
ef81804
Merge pull request #83 from WE-Autopilot/ml/lio-sam-carla-params
HamzaKababji Nov 11, 2026
7c1547d
Removed outdated republisher.
HamzaKababji Nov 11, 2026
d2e71b1
Add map_carla.sh and mapping README
HamzaKababji Nov 11, 2026
4ebd266
Updated Mapping README
HamzaKababji Nov 11, 2026
90fe3e0
Updated documentation with mapping functionality and corrected typos
HamzaKababji Nov 11, 2026
bbccad1
Updated Mapping README with instructions on manual map and trajectory…
HamzaKababji Nov 11, 2026
322b3ae
Merge pull request #102 from WE-Autopilot/ml/map-carla-script
HamzaKababji Nov 17, 2026
ba8076d
Merge pull request #103 from WE-Autopilot/ml/setup-docs-update
HamzaKababji Nov 17, 2026
8e7dcc9
localization: install Autoware NDT scan matcher and map loader via ro…
HamzaKababji Nov 19, 2026
cbfbeec
Merge pull request #114 from WE-Autopilot/ml/autoware-ndt-install
HamzaKababji Nov 19, 2026
589680c
localization: map_loader launch for the NDT map (Autoware pointcloud …
HamzaKababji Nov 19, 2026
654b93b
Merge pull request #115 from WE-Autopilot/ml/ndt-map-loader
HamzaKababji Nov 19, 2026
8b148c8
Reorganized simulation directory so its easier to navigate, similarly…
YellowAli Nov 29, 2026
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ __pycache__/
*.pyc
*.egg-info/

# record_bag.py output
bags/

# OS generated files
.DS_Store
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ For setup see SETUP.md.

## Repo Structure

Under `src` find dirs for:
- bringup (launching ap1 in ROS2)
- msgs (communication between subsystems)

As well as for each subsystem:
- perception
- mapping_and_localization
- planning_and_control
- `src/bringup`: launch files for the full system
- `src/msgs`: `ap1_msgs`, messages between subsystems
- `src/perception`: Perception
- `src/mapping`, `src/localization`: Mapping & Localization
- `src/planning`, `src/control`: Planning & Control
- `src/console`: operator console UI
- `simulation/`: CARLA bag recording and sensor filtering (see `simulation/README.md`)
- `scripts/`: helper scripts, including `map_carla.sh` (see `src/mapping/README.md`)
114 changes: 94 additions & 20 deletions SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# Option 1 -- Script (Recommended)

This script will auto detect if you're using zsh or bash and other environment variables. You may need to give sudo permissions to the script.s
This script will auto detect if you're using zsh or bash and other environment variables. You may need to give sudo permissions to the script.

```bash
chmod +x ap1_setup.sh
Expand Down Expand Up @@ -38,13 +38,15 @@ If you already imported the repos yourself and want setup to skip that step:
## 1. Clone the Workspace

```bash
mkdir -p ~/Documents/ap1
git clone https://github.com/WE-Autopilot/ap1.git ~/Documents/ap1
cd ~/Documents/ap1

# THIS STEP IS BEING DEPRECATED
vcs import < ap1.repos
```

`vcs import` pulls in LIO-SAM (`src/external/LIO-SAM`).

`ap1_setup.sh` also patches LIO-SAM's CMakeLists for Jazzy, so on the manual route use the script for that step or LIO-SAM may not build.

Run `vcs import` from the workspace root. The paths in `ap1.repos` already
include `src/`, so importing from inside `src/` creates nested paths such as
`src/src/perception`.
Expand Down Expand Up @@ -86,9 +88,11 @@ cd ~/Documents/ap1
source /opt/ros/jazzy/setup.bash
rosdep install --from-paths src --ignore-src -r -y

colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
colcon build --symlink-install
```

Release is already set per package in `colcon.meta`, which colcon reads automatically from the workspace root.

> **Tip:** For C++ IDE support (clangd autocomplete in `ap1_control`/`ap1_planning`, i.e., this is mainly for planning & control team):
> ```bash
> colcon build --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=1
Expand Down Expand Up @@ -126,17 +130,89 @@ ros2 launch ap1_bringup full_system.launch.py
ros2 launch ap1_bringup pnc_backend.launch.py
```

### Mapping & Localization pipeline only
### LIO-SAM (map building)

`ap1_setup.sh` clones LIO-SAM into `src/external/LIO-SAM` at a pinned commit and patches it for Jazzy, so `git status` inside that folder shows modified files. That's expected.

```bash
ros2 launch lio_sam run.launch.py
```

To test it on the LIO-SAM paper's Walking dataset:

1. Download it from the [LIO-SAM sample datasets](https://drive.google.com/drive/folders/1gJHwfdHCRdjP7vuT556pv8atqrCJPbUq) and convert it to ROS 2:
```bash
pip install rosbags --break-system-packages
rosbags-convert --src walking_dataset.bag --dst walking_dataset
```
2. Run in two terminals from the workspace root:
```bash
ros2 launch lio_sam run.launch.py params_file:=src/mapping/config/lio_sam_paper.yaml
ros2 bag play walking_dataset --clock
```

#### Map a CARLA town

Start CARLA 0.9.16, then run:

```bash
scripts/map_carla.sh --map Town01 --short
```

See `src/mapping/README.md` for details.

### Autoware NDT localization

Localization runs two Autoware nodes from apt (Jazzy, amd64 and arm64): `autoware_map_loader` serves our `.pcd` map and `autoware_ndt_scan_matcher` matches each LiDAR scan against it. Both are declared in `src/localization/package.xml`, so `ap1_setup.sh` (or the `rosdep install` in step 4) installs them. To install them on their own:

```bash
sudo apt-get update
rosdep install --from-paths src/localization --ignore-src -y
# same as: sudo apt install ros-jazzy-autoware-ndt-scan-matcher ros-jazzy-autoware-map-loader
```

Check that both nodes start with Autoware's default parameters (each should come up and keep running; Ctrl-C to stop). Don't use `--ros-args --help`: it isn't a valid ROS argument and aborts every node.

```bash
ros2 launch autoware_ndt_scan_matcher ndt_scan_matcher.launch.xml
MAP=<path/to/map.pcd>
ros2 launch autoware_map_loader pointcloud_map_loader.launch.xml \
pointcloud_map_path:=$MAP pointcloud_map_metadata_path:=none \
pcd_paths_or_directory:=$MAP pcd_metadata_path:=none
```

The map loader needs a real `.pcd` (e.g. a LIO-SAM `GlobalMap.pcd`). Its param file reads `pcd_paths_or_directory` and `pcd_metadata_path`, which its own launch file doesn't set (a parent Autoware launch normally does), so pass all four. A single-file map needs no metadata YAML; any path that doesn't exist (like `none`) makes the loader read the bounds from the cloud. NDT idles with a warning until it is activated and has a map; that's expected.

How they connect: NDT gets its map from the loader over a service, not a topic. Its client `pcd_loader_service` (`autoware_map_msgs/srv/GetDifferentialPointCloudMap`) must be remapped to the loader's `service/get_differential_pcd_map`. The loader's latched `/map/pointcloud_map` topic is for RViz only. NDT also starts deactivated and ignores scans until its `trigger_node_srv` (`std_srvs/SetBool`) is called with `true`.

#### Load the localization map

The map `.pcd` isn't in git (too big). Point the launch at any `.pcd`, e.g. one from `scripts/map_carla.sh`:

```bash
ros2 launch mapping_localization_python mapping_pipeline.launch.py
ros2 launch ap1_localization map_loader.launch.py pointcloud_map:=<run>/results/map/GlobalMap.pcd
```

There's no shared team map yet. Once there is, it goes at the default path `~/WEAP/maps/ap1_map/pointcloud_map.pcd` and the launch needs no arguments.

This starts Autoware's point cloud map loader and map projection loader (projector `Local`, from `src/localization/config/map_projector_info.yaml`). Everything is in the `map` frame:

# With Kitware SLAM enabled:
ros2 launch mapping_localization_python mapping_pipeline.launch.py use_kitware_slam:=true
| Name | What it is |
|---|---|
| `/map/pointcloud_map` | whole map, latched; for Foxglove/RViz only |
| `/map/get_differential_pointcloud_map` | service NDT gets its map from |
| `/map/get_partial_pointcloud_map` | service, map cells within a radius (handy for testing) |
| `/map/map_projector_info` | projector type, latched |

# With synthetic perception data (no real sensors needed):
ros2 launch mapping_localization_python mapping_pipeline.launch.py use_synthetic_perception:=true
Check it:

```bash
ros2 service call /map/get_partial_pointcloud_map autoware_map_msgs/srv/GetPartialPointCloudMap \
"{area: {center_x: 0.0, center_y: 0.0, radius: 50.0}}" | grep -E "cell_id|width"
```

A `cell_id` and a non-zero `width` mean it returned points. In Foxglove, start the bridge with `-p send_buffer_limit:=200000000` (the default 10 MB drops the map), set the display frame to `map` and show `/map/pointcloud_map`.

### Console UI only
```bash
ros2 run ap1_console console
Expand Down Expand Up @@ -182,19 +258,15 @@ ros2 topic echo --once /ap1/mapping/lanes
# List all active nodes
ros2 node list

# Expected nodes on fullsystem launch:
# Expected nodes on full_system launch:
# /ap1_console
# /ap1_control
# /ap1_planning
# /ap1_yolo
# /ap1_ufld_ground
# /ap1_console
# /perception_pipeline
# /stored_point_registry
# /slam_bridge
# /base_to_lidar_tf
# /ap1_yolo

# Check a topic is publishing
ros2 topic echo /ap1/localization/slam_pose
# List active topics
ros2 topic list
```

---
Expand All @@ -219,3 +291,5 @@ ros2 launch ap1_bringup full_system.launch.py
| `No module named 'PyQt6'` | Console requires PyQt6 | `pip install PyQt6` into the active venv |
| All nodes shut down immediately | A `CriticalNode` crashed (usually `yolo_node`) | Fix the crashing node first — it takes down the whole system on exit |
| `WARN: Velocity is null` / `necessary field is null` | Normal at startup | Nodes are waiting for sensor data — not an error |
| LIO-SAM path flies off or `Large velocity, reset IMU-preintegration!` | Params don't match the bag's sensors | Check `extrinsicRot`/`extrinsicRPY`, `sensor`, `N_SCAN` and `Horizon_SCAN` in the params file |
| `existing path cannot be removed: Is a directory` during `colcon build` | Switched between `--symlink-install` and a plain build in the same workspace | `rm -rf build install log` then rebuild |
5 changes: 5 additions & 0 deletions ap1_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ if [[ -f "$LIO_SAM_CMAKE" ]]; then
if ! grep -q "<depend>cv_bridge</depend>" "$LIO_SAM_XML"; then
sed -i 's|^\( *\)<build_depend>gtsam</build_depend>|&\n\1<depend>cv_bridge</depend>|' "$LIO_SAM_XML"
fi
# LIO-SAM hardcodes its own odom -> "lidar_link" TF in mapOptmization.cpp
# (sic). That steals our lidar_link from the static base_link -> lidar_link
# mount, so give LIO-SAM's frame its own name. Idempotent.
LIO_SAM_MAPOPT="$WS_ROOT/src/external/LIO-SAM/src/mapOptmization.cpp"
sed -i 's/child_frame_id = "lidar_link";/child_frame_id = "lio_sam_lidar";/' "$LIO_SAM_MAPOPT"
else
err "LIO-SAM not found at src/external/LIO-SAM (vcs import failed?)"
ERRORS=$((ERRORS+1))
Expand Down
40 changes: 39 additions & 1 deletion scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Scripts

This is for scripts.
## Mapping

| Script | Does |
|---|---|
| `map_carla.sh` | One command for a CARLA map: checks the setup, records and filters a drive (or takes `--bag`), runs LIO-SAM, prints a summary. See [src/mapping/README.md](../src/mapping/README.md) |
| `run_lio_sam.py` | Runs LIO-SAM on one bag and saves the map and trajectories ([below](#bag-replay-and-map-save-script)). `map_carla.sh` calls it |
| `summarize_run.py` | Prints keyframes, path lengths and map sizes for a run's `results/` folder. `map_carla.sh` calls it |
| `lib/preflight.sh` | Shared checks to `source` before anything slow: `source_ros`, `require_pkg`, `require_python_module`, `warn_low_disk`, `stop_leftovers`, `wait_for_exit` |

## Other

`perception_setup.sh` is for getting perceptions dependencies in order. If on a fresh machine run it. Must be ubuntu.

Expand Down Expand Up @@ -46,3 +55,32 @@ Current blocker: `realsense2_camera` can fail on IMU-only bags with
`No known base_stream found for transformations`, so use `pyrealsense2`
directly until AP1 has a dedicated IMU bag publisher or IMU-to-odometry fusion
node.

## Bag Replay and Map Save script

`run_lio_sam.py` uses args to run either a) paper bag or b) carla bag
using lio_sam and saves pcd map files, a log file, and .tum
trajectory files to the specified output directory.

Example use A (Paper dataset):
```bash
python3 scripts/run_lio_sam.py \
--bag <path>/paper_dataset \
--params <path>/config/params.yaml \
--rate 0.5 \
--output <path>/results
```

Example use B (CARLA filtered bag):
```bash
python3 scripts/run_lio_sam.py \
--bag <path>/<bag>_filtered \
--params src/mapping/config/lio_sam_carla.yaml \
--launch-pkg ap1_mapping \
--launch-file lio_sam_carla.launch.py \
--rate 0.5 \
--output <path>/results \
--ground-truth
```

Note: Both configuration files have `savePCD: true` (LIO-SAM saves the map a second time on shutdown (harmless, just slower)).
Loading
Loading