18 KiB
18 KiB
Project Context
Use this file for verified target-repository facts only. Keep unknown values as Unknown / needs confirmation.
Project Identity
- Project name:
vslam(CMakeLists.txt:2, version 0.1.0); repo dirvslam_cpp - Robot or system: indoor service robot, differential drive, ZLAC8015D base (README.md:3, configuration_files/sensors.yaml
base:) - Primary use case: SLAM + localization for indoor service robot, pure C++, no ROS (README.md:3-4)
- Repository role: rewrite of
~/projects/vSLAM_ws(ROS 1 Noetic + catkin). Old repo kept as reference and test corpus (README.md:6-7).../vSLAM_wsis NOT in this repo.
Stack
- ROS distribution: none. No
package.xml, nosetup.py, no ament/catkin anywhere. ROS only appears as data-format compatibility (map_server.yaml/.pgm, REP-103 frame conventions) and as the reference implementation being replaced. - ROS variant: N/A
- Operating system: target Ubuntu 22.04 arm64 on Jetson AGX (README.md:4). Dev host is x86 (CMakeLists.txt:54-88, CMakePresets.json
dev). - Build system: CMake >= 3.16, C++17, CMakePresets.json v3 (presets
dev,asan,tsan,jetson). CPack is not wired:VSLAM_ENABLE_CPACKexists (default OFF) butcmake/vslam_cpack.cmakedoes not exist, so turning it on fails configure. The jetson preset no longer requests it (removed 2026-09-23). - Main languages: C++17 (libs/, app/, tools/, test/), JavaScript (libs/vslam_web/www/, test/www/), Python 3 (tools/gen_model_colors.py, test/gen_teleop_vectors.py), Bash (tools/*.sh)
- Simulation stack: in-repo
vslam_simlibrary — replaces Gazebo. Reads Gazebo.worldfiles directly (mesh rasterized to occupancy grid + meshes shipped to 3D web view) or ROS map_server.yaml+.pgm(README.md:100-186).
Repository Layout
- ROS packages: none. Eight CMake libraries in
libs/, gated byVSLAM_BUILD_*options (CMakeLists.txt:35-42):vslam_common(P0, ON) — config, log, clock, geometry, TransformTree, Channel, RobotModel, statsvslam_web(P1, ON) — Boost.Beast HTTP + WebSocket server, RLE, binary codec, embedded www assetsvslam_drivers(P2, ON) — LakiBeam LiDAR, RealSense D410, MCU serial bridge, ZLAC base, record/replay I/O, ScanSanitizer, ClockSyncvslam_odometry(P3, ON) — wheel odometry + EKF SE(2)vslam_safety(P4, ON) — SafetyMonitor FSMvslam_perception(P5, ON) — depth_to_cloud, depth_filter, gravity_align, cliff_detect, pipelinevslam_slam(P6, default OFF) — RTAB-Map wrapper, occupancy export, sensor data buildervslam_sim(ON) — Gazebo-world reader, occupancy map I/O, sim source- Dependency graph and rationale: libs/CMakeLists.txt:1-13
- Launch/config locations: no launch files. Wiring is code:
app/src/wiring.ccis the single place sources connect to stages (app/CMakeLists.txt:4-5, docs/RUNTIME.md). Runtime config:configuration_files/—robot.yaml,sensors.yaml,pipeline.yaml,slam.yaml,safety.yaml,system.yaml, plusmaster.dcf(CANopen, generated bydcfgen). - Source locations:
libs/<lib>/{include/vslam,src},app/src,tools/, vendored SDKs inlibs/vslam_drivers/thirdparty/(lakibeam_sdk,lidar_core,zlac— copied frombase_kit, see thirdparty/PROVENANCE.md) - Test locations:
test/— GTest binaries, node-level config tests, JS tests intest/www/; fixtures intest/data/, tolerance baselines intest/expected/(12 scenario JSONs) - Documentation locations:
README.md(~1000 lines, operational guide),docs/RUNTIME.md,docs/PERCEPTION.md,docs/SLAM.md,docs/REGRESSION.md. Config files themselves carry extensive rationale comments — treat them as primary docs.
Runtime Interfaces
- Main nodes: one process —
vslam_node(build/app/vslam_node). Owns all threads and all Channels. Source must be chosen explicitly, no default:--sim|--replay FILE|--live|--check(app/src/main.cc:39-69, docs/RUNTIME.md:1-20).- Tools:
vslam_record,vslam_replay,vslam_sim_run,vslam_slam_bench,vslam_web_demo,vslam_world_export,vslam_lidar_probe,probe_rtabmap
- Tools:
- Topics: none (no middleware). In-process
Channel<T>(libs/vslam_common/include/vslam/channel.h) replaces pub/sub. External surface is HTTP/WebSocket on port 8080 — e.g.GET /api/world.bin(README.md:133-135). Binary WS frame types: 1 scan, 2 cloud, 3 map_full, 4 retired (was map_patch, removed 2026-09-23), 5 path, 6 world_map, 7 voxel_full (chunked), 8 voxel_delta. Types 7/8 carry the accumulated 3D map as a voxel-hashed index set at 0.05 m; the browser renders it as a POINT CLOUD, not as boxes; token auth is asymmetric by design: engage e-stop needs no token, release e-stop / bumper reset require one (configuration_files/system.yamlweb.auth_token). - Services / Actions: none.
- Parameters: YAML only, one file per library. Selected verified values —
robot.yaml: wheel_radius 0.0865 m, wheel_separation 0.400 m, robot_radius 0.24, max_linear 0.35 m/s, max_angular 0.80 rad/s, accel_limit 0.30 m/s², base.cmd_timeout 0.30 ssafety.yaml: scan stop_distance 0.35 m, slow_distance 0.80 m, front_angle 0.5 rad, min_front_rays 20, cliff_hold 3.0 s, sensor_timeout 1.0 s, cmd_timeout 0.5 s (must stay > base.cmd_timeout), bumper escape_linear 0.10 / escape_angular 0.4pipeline.yaml: depth_filter 0.22–4.0 m, voxel 0.03 m, 30 Hz in / 10 Hz out; cliff_detect window 1.15–1.70 m (geometric blind zone from level camera at 0.445 m), andcliff_detect.enabled: false— cliff detection is currently OFF (pipeline.yaml:100)slam.yaml: enabled false, mode localization, Reg/Strategy=1 (ICP), Reg/Force3DoF=true, Optimizer/Strategy=1 (g2o), RGBD/NeighborLinkRefining=false, RGBD/ProximityPathMaxNeighbors=30, Rtabmap/DetectionRate=3, Grid/CellSize 0.05,camera_3d(code default false; slam.yaml currently true) is the 3D scanned-cloud switch: true sends depth into RTAB-Map (stored in the DB) and turns on the voxel map, but does NOT touch Grid/* — the grid stays 2D, LiDAR-only. The voxel map is built outsideprocess()from each node's depth (cached per node id, max 40 new nodes per export). Changed 2026-09-24: the old Grid/Sensor=2 + Grid/3D=true path raised sim pose error vs ground truth from 0.009 m to 0.06-0.11 msystem.yaml: web port 8080, status/scan 10 Hz, cloud 8 Hz, path 1 Hz, map_rebuild_rate_hz 4.0, voxel_chunk_bytes 16384 / voxel_sync_chunks_per_tick 1 (the voxel map has no send-rate knob by design); thread priorities safety 50 / driver 45 / estimator 40, safety_rate_hz 20- Unknown RTAB-Map keys are a startup refusal, not a silent ignore (
BuildRtabmapParams, slam.yaml:10-16) - Config dir resolution:
$VSLAM_CONFIG_DIR, else/etc/vslam/configuration_files; resources:$VSLAM_RESOURCE_DIR, else/var/lib/vslam/resources(libs/vslam_common/include/vslam/node_constants.h) - Map path resolution (added 2026-09-23): a RELATIVE
slam.database_path/--slam-dbresolves againstMapDir()=$VSLAM_RESOURCE_DIR/maps, i.e.<repo>/resources/maps/from the source tree.{stamp}anywhere in the path expands to%Y%m%d_%H%M%S(one value per call). Absolute paths are used as-is;""still means a RAM-only DB. The parent directory is created for mapping runs only. All of this lives inRtabmapSlam::Init, deliberately NOT on the--checkpath.
- TF frames: own
TransformTree, no tf2. Tree (node_constants.h:44-56, robot.yaml):map -> odom -> base_footprint -> base_link -> {laser_link, imu_link, camera_link},camera_link -> camera_depth_optical_frame | camera_infra1_optical_frame | camera_infra2_optical_frame- Three dynamic edges, one writer each:
map->odom(slam, ~1 Hz),odom->base_footprint(EKF, 50 Hz),base_footprint->base_link(gravity_align, measured roll/pitch) - Static: laser_link [0, 0, 0.13] rpy 0 (mount rotation compensated in driver via
angle_offset_deg: 178.75, NOT in TF — do not "fix"); imu_link [0, 0, 0.06]; camera_link rpy 0 (level, not tilted) = 0.445 m above floor (robot.yaml:100-101); optical frames rpy [-pi/2, 0, -pi/2]
- Three dynamic edges, one writer each:
Sensors And Hardware
- Cameras: RealSense D410 (depth + IR, no RGB — left IR doubles as the "rgb" channel for SLAM). 640x480 @ 30 fps,
decimate: 2with CameraInfo still carrying full-res K (consumers must compensate). Driverrealsense_driver.cc, built only with-DVSLAM_WITH_REALSENSE=ON; sensors.yaml states it is not yet verified against real hardware. - LiDAR: LakiBeam 1L over UDP, bind 0.0.0.0:2368, expected 25 Hz, 270° FOV, range 0.05–40.0 m. Angle convention
theta = (flip ? -alpha : alpha) + angle_offset_degwithangle_offset_deg: 178.75,angle_flip: true(sensors.yaml:52-53; the 1.25 deg off 180 is a MEASURED mount error, and the driver logs a suggestion line every 10 s that reads as a no-op when the value is already right). - IMU: WT61PC wired straight to a UART (USB-FTDI adapter,
/dev/imu,mcu.protocol: wt61pc), 115200 baud / 200 Hz (stored in the sensor 2026-10-06; factory default 9600 baud / 10 Hz), FTDI latency_timer 1 ms viaconfiguration_files/udev/99-imu.rules. Stamped from the host clock minusimu_lag_sec(noClockSync). The older ESP32-S3 path (mcu.protocol: esp,/dev/ttyACM0,ClockSync,McuTimeUnwrapperfor uint32micros()wrap every 71.58 min) is still supported. - Compute target: Jetson AGX (arm64); jetson preset uses
CMAKE_PREFIX_PATH=/opt/vslamandCMAKE_INSTALL_PREFIX=/opt/vslam, deps built from source (tools/build_deps.sh referenced by CMakePresets.json:40 — script not present in repo). - Accelerators: none used. No CUDA/TensorRT/OpenCL in the build; all processing is CPU.
- Actuators or robot base: ZLAC8015D dual motor driver over CANopen on
can0, node id 1 (not serial), vialiblely-coapp, gated by-DVSLAM_WITH_CANOPEN=ON. DCF atconfiguration_files/master.dcf, path resolved relative to the config dir.encoder_counts_per_rev: 0= fall back to 16384 (4096 "wire" x4); the x4 factor is confirmed by field data (2026-09-23, see Verification Notes).
CV And AI
- Models: no learned models in this repo. No
.onnx/.pt/.trt/.engine/.tflitefiles exist.resources/model_colors.jsonis a Gazebo model color lookup table (median texture color per mesh), generated bytools/gen_model_colors.py— not an ML model. - Model formats: N/A
- Inference runtimes: N/A. Geometric CV only: RTAB-Map (ICP/g2o) + OpenCV + PCL.
- Preprocessing: depth ->
depth_to_cloud->depth_filter(range gate 0.22–4.0 m, 0.03 m voxel, rate limit to 10 Hz) ->gravity_align(complementary filter alpha 0.98, own-acceleration subtraction from odometry) -> cloud inbase_footprint. Runs inline on the camera thread, not as separate stages (docs/PERCEPTION.md). - Postprocessing:
cliff_detect(self-leveling ground fit, window 1.15–1.70 m, fail-safe after 1.0 s; currently disabled in pipeline.yaml) -> cliff flags + edge cloud; SLAM outputs occupancy grid exported viaoccupancy_export, RLE-compressed for the web UI. - Calibration files: none in the repo. Camera intrinsics come from the device at runtime;
fx = 595.914 @ 640x480appears only inside comments as the basis for FOV math. Extrinsics live inrobot.yaml(there is no URDF — deliberately, robot.yaml:1-20).
Commands
All commands below are transcribed from README.md / CMakePresets.json / docs — not executed during onboarding. Run them yourself before relying on the outcomes.
- Environment prerequisite (dev x86):
source tools/dev_env.shremoves/opt/MVSfromLD_LIBRARY_PATH. The Hikvision MVS SDK ships an old libusb missinglibusb_set_option, which breaks any link againstlibpcl_io. CMakeLists.txt:59-88 turns this into a FATAL configure error when SLAM or perception is enabled. Also exportVSLAM_CONFIG_DIR=$PWD/configuration_filesandVSLAM_RESOURCE_DIR=$PWD/resourceswhen running from the source tree. - Build command:
cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVSLAM_BUILD_APP=ON -DVSLAM_BUILD_SLAM=ONthencmake --build build -j. Presets:cmake --preset dev|asan|tsan|jetson. Optional:-DVSLAM_WITH_REALSENSE=ON,-DVSLAM_WITH_CANOPEN=ON.-DVSLAM_BUILD_SLAM=OFFstill builds and runs everything else. - Test command:
(cd build && ctest)(README claims 37 tests);./tools/regress.sh(12 replay scenarios, README claims ~3 s);./build/app/vslam_node --check(config check only, then exit). ThreadSanitizer recipe in docs/RUNTIME.md;ctest --test-dir build-tsan -LE condvar. - Lint command: Unknown / needs confirmation — no
.clang-format,.clang-tidy, or CI configuration in the repo.tools/pre-push(install manually as a git hook) runs the regression suite, not a linter. - Launch examples:
./build/app/vslam_node --sim --token tthen openhttp://localhost:8080/?token=t./build/app/vslam_node --sim --world ../vSLAM_ws/src/robot_sim/worlds/hospital.world --x 1.03 --y -25.07 --token t(that start pose has 4.75 m clearance; origin does not)./build/app/vslam_node --sim --map test/data/maps/hospital.yaml --x -5.99 --y -2.91 --token t- Mapping: add
--slam --slam-db <NEW path> --slam-mode mapping. The DB path must be new every run — mapping into an existing DB is refused at startup (RTAB-Map 0.21.13 throwsUNIQUE constraint failed: Statistics.idevery frame). --liverequires a CANopen build; without it the node refuses to start with an actionable message (app/src/runtime.cc:137-146).
- Bag playback examples: no rosbag. Custom
.vsrrecord format —- record:
./build/tools/vslam_record ..././tools/regress.sh --record - replay:
./build/app/vslam_node --replay FILE.vsr, or./build/tools/vslam_replayfor flat JSON output compared againsttest/expected/by tolerance .vsrfiles are gitignored (~55 MB), regenerated on demand
- record:
Verification Notes
- Last inspected by Claude Code: 2026-09-23, branch
master, HEADdbcbf84(plus the uncommitted 3D-voxel-map work) - Verified files: CMakeLists.txt, CMakePresets.json, libs/CMakeLists.txt, app/CMakeLists.txt, all
libs/*/CMakeLists.txt(dependency greps), test/CMakeLists.txt, tools/CMakeLists.txt, all sixconfiguration_files/*.yaml, app/src/main.cc, app/src/runtime.cc (source-selection path), libs/vslam_common/include/vslam/node_constants.h, docs/RUNTIME.md, docs/PERCEPTION.md (head), docs/SLAM.md (head), docs/REGRESSION.md (head), README.md:1-260, tools/regress.sh (head), tools/pre-push, libs/vslam_drivers/thirdparty/PROVENANCE.md, .gitignore, build/CMakeCache.txt - Not verified: no C++ build, ctest, or regression run was executed from this session (the repo forbids it — see CLAUDE.md build handoff). The JS tests under
test/www/WERE run with node and pass. Test counts (37) and regression scenario counts (12) are README claims;test/expected/does contain 12 JSON baselines. - Field data, 2026-09-23 live mapping run on the robot (gamepad +
--live --slam): gamepad teleop, ClockSync, LiDAR blind-sector check and SLAM map growth all behaved; occupied cells 202 -> 8605 over 3.5 min. - Open questions:
sensors.yamlsector_masks(+/-118 deg) lost their geometric basis when the LiDAR moved tox = 0.0. The file says they must be re-measured before safety is enabled. Still unresolved.— ANSWERED 2026-09-23. On the real robot, encoder and gyro agree to 0.12% over 7671 samples (encoder_counts_per_revx4 factorenc 0.823336vsgyro 0.824332, steady turn; mean bias -0.0015 rad/s). A wrong quadrature factor would show as a 4x or 0.25x ratio, so 16384 is right. The wheel-lift measurement in sensors.yaml is no longer needed.- All EKF and wheel-odometry covariances are datasheet estimates. UMBmark and allan_variance have not been run on this robot (robot.yaml, pipeline.yaml).
- No clock-synchronization path exists for the CANopen base:
EncoderReadingstamps are host-clock-at-SDO-read.ClockSynconly bridges the serial MCU. - RealSense driver unverified on real hardware;
RS2_OPTION_GLOBAL_TIME_ENABLEDon FW 5.17.0.10 unchecked (falls back to TIME_OF_ARRIVAL, a few ms worse). safety.yamlcitesdocs/HARDWARE.mdfor the hardware motor-cut requirement, but that file does not exist indocs/.CMakePresets.jsonjetson preset citestools/build_deps.sh; that script is not in the repo. (The preset'sVSLAM_ENABLE_CPACK: ONwas removed 2026-09-23 — it pointed at acmake/vslam_cpack.cmakethat never existed and broke every Jetson configure.)docs/RUNTIME.md:8says the--livedriver is "CHUA viet" (not written), butapp/src/runtime.cc:137-191wires live LiDAR, MCU, base, and camera behindVSLAM_HAVE_CANOPEN. One of the two is stale — likely the doc.RGBD/NeighborLinkRefining=falsewas tuned against simulated odometry (exact to ground truth). Real-robot odometry drifts 1-2%, where ICP link refinement may help. Re-measure on hardware.- Real-hardware symmetric wheel slip is undetectable by the current
|omega_encoder - gyro_z|test (0 events, 13.29% error in theslip_symregression scenario). imu_lag_secwas re-measured 2026-09-23 and moved 0.08 -> 0.07 (estimator resolution is one 10 ms bin). The next live run must reportwheel_odom/lag: tot nhat ~0 ms; if it still says -10 ms the model has bottomed out and must not be tuned further.- The 3D scanned cloud (
camera_3d: true) produced frames in sim on 2026-09-24 with the OLD Grid/3D path; the depth-per-node path that replaced it is not yet run (sim or hardware). Not on hardware at all. Three numbers in it are reasoned estimates, not measurements:voxel.emit_size_m0.05,voxel.delta_max_ratio0.35, and the 300kmax_cellsceiling. The full-sync burst (2 x 32 kB x 10 Hz = 655 kB/s) also exceeds the documented 120 kB/s UI budget for 1-3 s per joining client — deliberate, but unmeasured on Jetson WiFi. Also unmeasured: RAM/CPU cost ofGrid/3D=truewith ray tracing left ON (kept on deliberately — turning it off empties the 2D free-space map).