113 lines
12 KiB
Markdown
113 lines
12 KiB
Markdown
# Project Context
|
||
|
||
Use this file for verified target-repository facts only. Keep unknown values as `Unknown / needs confirmation`.
|
||
|
||
## Project Identity
|
||
|
||
- Project name: `vSLAM_ws` — catkin workspace at `~/projects/vSLAM_ws`
|
||
- Robot or system: `service_robot` (URDF `<robot name>`), differential-drive indoor service robot, 2 driven wheels + front/rear casters
|
||
- Primary use case: 2.5D SLAM + navigation for a food-serving robot in multi-floor restaurants/hotels. Pose is SE(2); roll/pitch are **measured** from IMU, never estimated; z assumed 0. 2D ToF LiDAR is the SLAM backbone, RealSense D410 is perception-only. Back-end intended to be GTSAM.
|
||
- Repository role: single ROS 1 workspace holding 8 first-party packages + a `third_party/` vcstool manifest. Development is currently simulation-first; no real sensors are attached yet.
|
||
|
||
## Stack
|
||
|
||
- ROS distribution: Noetic (`/opt/ros/noetic` present)
|
||
- ROS variant: ROS 1 — `package format="2"`, catkin, XML `.launch`, nodelets, `dynamic` params via param server
|
||
- Operating system: Linux, kernel 5.15. Distro version not verified (Noetic implies Ubuntu 20.04 but this was not checked)
|
||
- Build system: `catkin_tools` (`.catkin_tools/` + `build/` + `devel/`), i.e. `catkin build`, not `catkin_make`
|
||
- Main languages: C++ (roscpp nodes and nodelets), Python 3 (rospy scripts), xacro/URDF, YAML, one bash script
|
||
- Simulation stack: Gazebo via `gazebo_ros` + `gazebo_plugins`. Worlds: `restaurant`, `hotel_corridor` (`src/robot_sim/worlds/`)
|
||
|
||
## Repository Layout
|
||
|
||
- ROS packages (all under `src/`, all first-party):
|
||
- `robot_bringup` — URDF/TF, central config, the layered launch files. No code.
|
||
- `robot_sim` — Gazebo plugins, worlds, ground truth, barometer/elevator/degradation simulators
|
||
- `robot_drivers` — `wheel_odom_node` (C++, shared sim+real), `imu_bridge_node.py`, RICHBEAM LiDAR wrapper
|
||
- `robot_safety` — independent safety process: bumper, ultrasonic, speed limits, e-stop
|
||
- `perception_3d` — zero-copy nodelets: `DepthFilterNodelet`, `GravityAlignNodelet`
|
||
- `slam_core` — 2.5D factor-graph node, **currently passthrough** (GTSAM not installed)
|
||
- `localization_ops` — dock init, barometer/AprilTag floor detection, multi-map manager
|
||
- `slam_eval` — ATE/RPE, repeatability, resource profiling, rosbag recording
|
||
- `experimental/` — carries `CATKIN_IGNORE`, GPL quarantine area (empty of code)
|
||
- `third_party/` — carries `CATKIN_IGNORE`, `.rosinstall` only; nothing imported yet
|
||
- Launch/config locations: `src/<pkg>/launch/*.launch`, `src/<pkg>/config/*.yaml`. Central robot geometry in `src/robot_bringup/config/robot.yaml`
|
||
- Source locations: `src/<pkg>/src/*.cpp`, `src/<pkg>/scripts/*.py`, headers in `src/slam_core/include/slam_core/`
|
||
- Test locations: **none** — no rostest, gtest, or unittest anywhere in the repo, and no CI config. Verification is manual per-layer acceptance (L0–L6 in `README.md`) plus the `slam_eval` scripts
|
||
- Documentation locations: `README.md` (run instructions, layer table, status), `docs/ARCHITECTURE.md` (design rationale — read before changing architecture), `docs/HARDWARE.md`, `docs/ROADMAP.md` (phases GĐ0–GĐ8), `docs/SIM_VS_REAL.md`, `docs/SLAM-vSLAM-3DSLAM-ban-thao.md`. All docs are in Vietnamese.
|
||
|
||
## Runtime Interfaces
|
||
|
||
- Main nodes:
|
||
- `robot_state_publisher`, `joint_state_publisher` (fake joints only at L0)
|
||
- `wheel_odom` (`robot_drivers/wheel_odom_node`) — same binary in sim and on real hardware
|
||
- `ekf_odom` (`robot_localization/ekf_localization_node`) — owns TF `odom → base_footprint`
|
||
- `perception_manager` nodelet manager hosting `depth_to_cloud` (`depth_image_proc/point_cloud_xyz`), `depth_filter`, `gravity_align`
|
||
- `octomap_server`
|
||
- `slam_core` — owns TF `map → odom`
|
||
- `move_base`, `amcl`, `map_server` (localization mode)
|
||
- `safety_monitor` — always a separate process, `respawn="true"`
|
||
- `dock_init`, `floor_detector`, `multi_map_manager`
|
||
- Sim-only: `spawn_robot`, `baro_sim`, `elevator_sim`, `sim_degradation`
|
||
- Topics (see `ROS_TOPIC_MAP.md` for the full table):
|
||
- Raw sensors: `/scan`, `/imu/data_raw`, `/joint_states`, `/camera/depth/image_rect_raw`, `/camera/depth/camera_info`, `/camera/infra1|infra2/image_rect_raw`, `/baro/pressure`, `/baro/temperature`
|
||
- Odometry: `/odom`, `/odometry/filtered`, `/wheel_odom/slip_metric`
|
||
- Perception: `/perception/cloud_raw` → `/perception/cloud_filtered` → `/perception/cloud_aligned`, `/gravity_align/roll_pitch`, `/octomap_full`, `/map` (octomap `projected_map` is remapped to `/map`)
|
||
- SLAM/localization: `/slam/pose`, `/initialpose`, `/map_metadata`, `/map_name`, `/floor/current`, `/floor/status`, `/floor/tag_hint`
|
||
- Control/safety: `/cmd_vel` → `safety_monitor` → `/cmd_vel_safe` → motors/Gazebo, `/bumper`, `/safety/status`, `/ultrasonic/*` (list is currently empty)
|
||
- Sim-only: `/ground_truth/odom` (evaluation only — no estimator may subscribe), `/elevator/status`, `/elevator/goto_floor`
|
||
- Services: `safety/reset`, `safety/estop` (`robot_safety`), `dock_init/set_dock_pose` (`std_srvs/Trigger`)
|
||
- Actions: no custom actions defined in-repo. `move_base` contributes its standard `/move_base` action interface
|
||
- Parameters: loaded from `robot_bringup/config/{robot,ekf_odom,move_base,costmap_common,costmap_local,costmap_global}.yaml`, `slam_core/config/slam_core.yaml`, `perception_3d/config/depth_filter.yaml` (namespaces `depth_filter` and `gravity_align`), `robot_safety/config/safety.yaml`, `localization_ops/config/floors.yaml`, `robot_sim/config/sim_sensors.yaml`
|
||
- TF frames (see `TF_FRAME_MAP.md`): `map → odom → base_footprint → base_link → {left/right_wheel_link, front/rear_caster_link, laser_link, camera_link, imu_link}`; `camera_link → camera_depth_optical_frame → camera_infra1_optical_frame`, `camera_infra2_optical_frame`. TF ownership is strictly split: `ekf_odom` publishes `odom → base_footprint`, `slam_core` publishes `map → odom`. At L3 a static identity `map → odom` stands in and is disabled at L4.
|
||
|
||
## Sensors And Hardware
|
||
|
||
- Cameras: Intel RealSense **D410**, Product Id `0AD2`, FW `5.17.0.10`, USB 3.2 — verified via `rs-enumerate-devices` (2026-08). **No RGB** (Stereo Module only), **no built-in IMU**, no alternating-emitter mode, rolling shutter, 69° FOV. Configured 640×480 @ 30 Hz for depth + infra1 + infra2; emitter fixed at `1` (Laser), never `2` (Laser Auto). Min-Z **estimated** ~22 cm at this resolution — not yet measured.
|
||
- LiDAR: RICHBEAM 2D ToF. **Driver not yet obtained** — `richbeam.launch` launches nothing; the real node is commented out pending the vendor package. Four properties still unverified: interface (Ethernet vs USB), whether the device supplies its own timestamp, true FOV (270° vs 360°), scan rate/angular resolution. Gazebo stands in with `gpu_ray`: 960 samples, FOV ±120° (deliberately 240°, not 270°, so rays do not hit the robot body), 15 Hz, range 0.05–30 m.
|
||
- IMU: **not purchased**. Planned ICM-42688-P or BMI088 read by an MCU (STM32F4/Teensy 4.0/RP2040) over serial at 921600 baud, timestamped at sample time. Barometer BMP390/BMP581 planned in the same module. Gazebo stands in with `libgazebo_ros_imu_sensor` @ 200 Hz using datasheet-derived noise.
|
||
- Compute target: development on i5-14500 + RTX 4060. Deployment target is an industrial PC (IPC) — model not chosen (`docs/ROADMAP.md` GĐ8).
|
||
- Accelerators: RTX 4060, used only for Gazebo `gpu_ray`. No inference accelerator in the pipeline.
|
||
- Actuators or robot base: differential drive. `wheel_radius` 0.075 m, `wheel_separation` 0.36 m, body 0.40 × 0.34 × 0.85 m, `ground_clearance` 0.04 m, `body_offset_x` −0.06 m. These values exist in **two** places that must stay in sync: `robot_bringup/urdf/robot.urdf.xacro` and `robot_bringup/config/robot.yaml`. Gazebo's `diff_drive_controller` subscribes to `cmd_vel_safe`, so the safety layer is exercised in simulation too. Bumper and ultrasonic sensors are **not yet purchased**; `ultrasonic_topics` is an empty list, meaning glass and mirrors are currently undetectable.
|
||
|
||
## CV And AI
|
||
|
||
- Models: **none**. No model or weight files exist in the repo (`.pt`, `.onnx`, `.trt`, `.engine`, `.pth`, `.tflite` — all absent), and no package depends on an inference runtime. This is not an edge-AI deployment repo at present.
|
||
- Model formats: not applicable
|
||
- Inference runtimes: not applicable
|
||
- Preprocessing: depth image → point cloud (`depth_image_proc/point_cloud_xyz`) → `DepthFilterNodelet` (range gate 0.22–4.0 m, 3 cm voxel, temporal confirmation with `min_hits: 3`, optional statistical outlier removal currently off) → `GravityAlignNodelet` (complementary filter α 0.98, accel low-pass α 0.05, accel gate 1.0 m/s²; outputs in `base_footprint`)
|
||
- Postprocessing: `octomap_server` at 0.05 m resolution, `occupancy_min_z` 0.05, `occupancy_max_z` 1.10, producing `/octomap_full` and `/map`
|
||
- Calibration files: **none exist yet**. Three calibrations are outstanding and every covariance currently in config is a datasheet guess: `allan_variance_ros` for IMU noise (≥3 h run), UMBmark for wheel geometry (targets ~5% → ~1% odometry error), and camera/LiDAR extrinsics.
|
||
|
||
## Commands
|
||
|
||
- Build command: `cd ~/projects/vSLAM_ws && catkin build && source devel/setup.bash`
|
||
- Test command: `Unknown / needs confirmation` — no automated test suite exists. The de-facto verification is the L0–L6 acceptance table in `README.md`
|
||
- Lint command: `Unknown / needs confirmation` — no linter is configured
|
||
- Launch examples (layered; each layer is accepted before the next is run):
|
||
- `roslaunch robot_bringup description.launch` — L0, URDF + TF only
|
||
- `roslaunch robot_bringup sim.launch world:=restaurant|hotel_corridor` — L1, Gazebo
|
||
- `roslaunch robot_bringup odom.launch` — L2, wheel odom + EKF
|
||
- `roslaunch robot_bringup perception.launch` — L3, cloud pipeline + OctoMap
|
||
- `roslaunch robot_bringup slam.launch` — L4, adds `slam_core`
|
||
- `roslaunch robot_bringup nav.launch` — L5, adds `move_base` (robot will not move: no safety layer to bridge `/cmd_vel` → `/cmd_vel_safe`)
|
||
- `roslaunch robot_bringup robot.launch [use_sim:=false]` — L6, full system
|
||
- `roslaunch robot_bringup mapping.launch` / `localization.launch` — the two operating modes
|
||
- Bag playback examples: `rosrun slam_eval record_bag.sh <name>` writes to `bags/` (raw topics only — outputs are deliberately excluded so algorithms can be re-run on identical input). Playback command not scripted: `Unknown / needs confirmation`. `bags/`, `maps/`, and `results/` are all currently empty.
|
||
- Evaluation: `rosrun slam_eval eval_ate.py --out results/<run>`, `repeatability.py --samples 20`, `resource_profile.py --duration 60`
|
||
|
||
## Verification Notes
|
||
|
||
- Last inspected by Claude Code: 2026-08-26
|
||
- Verified files: `README.md`; `docs/ARCHITECTURE.md`; `docs/HARDWARE.md`; all 8 `package.xml`; all launch files in `robot_bringup`, `robot_drivers`, `robot_sim`, `perception_3d`, `slam_core`, `robot_safety`, `localization_ops`; `robot.urdf.xacro`; `sensors.xacro`; `gazebo_sensors.xacro`; `robot.yaml`; `ekf_odom.yaml`; `slam_core.yaml`; `safety.yaml`; `depth_filter.yaml`; `floors.yaml`; `topics_to_record.yaml`; `record_bag.sh`; `src/third_party/{README.md,.rosinstall}`; publisher/subscriber declarations in every `.cpp` and `.py` node
|
||
- Open questions:
|
||
1. `slam_core` is passthrough — GTSAM is not installed, so there is no optimization, no scan matching, no loop closure, and pose **will drift**. This is expected until GĐ5.
|
||
2. RICHBEAM driver absent; the four LiDAR properties in `docs/HARDWARE.md` §2 are unverified, so `/scan` on real hardware is not yet characterized.
|
||
3. IMU, barometer, bumper, and ultrasonic sensors are unpurchased. With `ultrasonic_topics: []`, glass and mirrors cannot be detected at all.
|
||
4. Every covariance in `slam_core.yaml`, `ekf_odom.yaml`, `robot.yaml`, and `imu_bridge.launch` is a datasheet guess pending calibration.
|
||
5. librealsense version conflict (Intel 2.58.3 vs ROS 2.50.0 with wrapper 2.3.2) blocks running the real camera. Does not affect simulation.
|
||
6. D410 Min-Z ~22 cm is an estimate; the measured value determines the bumper specification and `depth_filter/min_range`.
|
||
7. No maps exist yet, so `localization.launch` and the multi-floor path cannot run; `floors.yaml` paths point at files that have not been created.
|
||
8. L5 and L6 have never been run (`README.md` status table).
|
||
9. Ubuntu release not confirmed.
|