How metrox-eth/vector-dimos works
Purpose and Integration
vector-dimos is an external Python blueprint package that integrates the VECTOR holonomic mecanum rover with dimOS. dimOS discovers deployable modules through Python entry points; the normal runtime starts with dimos run, notably vector-dimos.base, vector-dimos.gamepad, and vector-dimos.rplidar.
Core integration and blueprint registration live in:
• vector_dimos/blueprints.py
• vector_dimos/nav_blueprints.py
• vector_dimos/rig_blueprints.py
Base Motion Control
The base-control path converts a dimOS 3-DOF twist [vx, vy, wz] into safe per-wheel velocity commands, drives two dual-channel motor controllers, and returns feedback/odometry. VectorBaseAdapter implements dimOS’s TwistBaseAdapter; a coordinator subclass ensures adapter registration also occurs in dimOS forkserver workers.
• vector_dimos/adapter.py
• vector_dimos/kinematics.py
• vector_dimos/zlac8015d.py
The hardware boundary is MODBUS RTU over RS485 to two ZLAC8015D controllers. The drive core is standard-library-only until a real serial bus is opened; VECTOR_MOCK_BUS=1 substitutes the in-memory bus for full control-pipeline testing.
Operator Inputs and Sensors
Teleoperation publishes twist commands, while lidar supplies planar point clouds to dimOS perception/navigation. The base consumes the coordinator command channel; commands must be continuously refreshed because dimOS applies a velocity watchdog.
• vector_dimos/gamepad.py
• vector_dimos/rplidar_c1.py
• vector_dimos/esp_sensors.py
Gamepad input uses optional pygame; RPLIDAR C1 serial access requires pyserial and produces PointCloud2. A RealSense D455F is composed from dimOS’s separate camera module; local camera support exists in vector_dimos/camera.py.
Localization, Persistent Mapping, and Costmap
Lidar odometry provides scan-to-map localization with a gyro prior. The 2D costmap is the decision map: it learns/unlearns obstacles, incorporates camera/lidar evidence, and overlays persistent keep-out zones after other layers so observations cannot erase forbidden space.
• vector_dimos/lidar_odometry.py
• vector_dimos/costmap2d.py
• vector_dimos/persistent_map.py
Persistent state is stored under ~/.local/state/vector/ as versioned .npz maps plus keepout.json. PERSISTENT_MAP=0 disables persistence, relocalization, and zones.
Relocalization and Distributed Compute
At startup, planar scans are globally matched against the saved 2D map before accepting its coordinate frame. Re-localization also reruns when the robot is moved without wheel motion. This local planar matcher is intentionally separate from dimOS’s 3D reference-map relocalization.
• vector_dimos/relocalize2d.py
• vector_dimos/relocalization.py
• tools/rig_runner.py
A second machine can run the dimOS reference-map relocalization workload via vector-dimos.reloc-rig. Robot and rig communicate over the shared zenoh mesh, while namespaced coordinators keep lifecycle control independent.
Navigation Safety and Autonomy
Navigation/exploration blueprints combine voxel mapping, costmapping, planning, and recovery. Slip protections compare wheel/body behavior against observed movement; no_slip_reflex zones suppress these guards where intentional slip is expected, such as ramps.
• vector_dimos/explorer2.py
• vector_dimos/recovering_planner.py
• _perime/slip_detectors_20260826/imu_slip.py
GPU voxel mapping depends on CUDA-enabled Open3D on Jetson aarch64. Build recipes encode the required JetPack/Open3D workarounds in tools/four_open3d_cuda.sh and related scripts.
Operations and External Services
Flight launch is gated and defaults to piloted operation; EXPLORE=1 explicitly arms autonomy. Operational visibility spans both LCM and zenoh, with a panel and change-only state vigil.
• tools/fly.sh
• tools/stats_server.py
• tools/vigie_iris.py
Zone editing is isolated from robot control: a small HTTP service reads/writes only the persistent map and zone file, and is deployable as a systemd service.
• tools/zone_server.py
• tools/zone_ui.html
• tools/vector-zones.service
Main entry points: lidar_odometry.py Lidar odometry · costmap2d.py 2D costmap · rplidar_c1.py RPLIDAR C1 · persistent_map.py Persistent map and zones
Components 23
dimOS runtime
- Deployable entry points · Exposes base, gamepad, lidar, and relocation-rig modules to dimOS.
- Blueprint registration
vector_dimos/blueprints.py - Rig blueprints
vector_dimos/rig_blueprints.py - dimOS coordinators · Namespaced coordinators isolate robot and rig lifecycle control.
- Gamepad teleop · Optional pygame input publishes twist commands.
vector_dimos/gamepad.py - RPLIDAR C1 · pyserial-backed planar scan source.
vector_dimos/rplidar_c1.py - ESP sensors
vector_dimos/esp_sensors.py - Shared zenoh mesh
- Remote relocation rig · Runs dimOS 3D reference-map relocalization on a second machine.
tools/rig_runner.py
Motion hardware
- Vector base adapter · Registers in forkserver workers and consumes watchdog-refreshed twist commands.
vector_dimos/adapter.py - Mecanum kinematics
vector_dimos/kinematics.py - ZLAC8015D drivers
vector_dimos/zlac8015d.py - RS485 MODBUS bus · Mock bus is selected with VECTOR_MOCK_BUS=1.
- Mecanum rover
Mapping and navigation
- Navigation blueprints
vector_dimos/nav_blueprints.py - Lidar odometry · Uses a gyro prior.
vector_dimos/lidar_odometry.py - 2D costmap · Fuses evidence, learns obstacles, and applies zones last.
vector_dimos/costmap2d.py - Persistent map and zones · Stores .npz maps and keepout.json under the local state directory.
vector_dimos/persistent_map.py - Planar relocalizer · Separately matches planar scans against the saved 2D map.
vector_dimos/relocalize2d.py - Exploration and recovery · Combines voxel mapping, planning, recovery, and slip safety.
vector_dimos/explorer2.py - Slip guards · no_slip_reflex zones suppress guards where slip is intentional.
_perime/slip_detectors_20260826/imu_slip.py
Operations
- Flight and visibility · Piloted by default; EXPLORE=1 arms autonomy.
tools/fly.sh - Zone editor service · Edits only persistent maps and keep-out zones.
tools/zone_server.py
Connections 24
- Deployable entry points → Blueprint registration: loads
- Blueprint registration → dimOS coordinators: assembles
- Navigation blueprints → Exploration and recovery: assembles
- Rig blueprints → Remote relocation rig: deploys
- Gamepad teleop → dimOS coordinators: publishes twist
- dimOS coordinators → Vector base adapter: command channel
- Vector base adapter → Mecanum kinematics: 3-DOF twist
- Mecanum kinematics → ZLAC8015D drivers: wheel velocities
- ZLAC8015D drivers → RS485 MODBUS bus: MODBUS RTU
- RS485 MODBUS bus → Mecanum rover: drives and reads feedback
- RPLIDAR C1 → Lidar odometry: planar scans
- ESP sensors → Lidar odometry: gyro prior
- Lidar odometry → 2D costmap: pose
- RPLIDAR C1 → 2D costmap: obstacle evidence
- Persistent map and zones → 2D costmap: keep-out overlay
- Persistent map and zones → Planar relocalizer: saved 2D map
- RPLIDAR C1 → Planar relocalizer: startup/move scans
- Planar relocalizer → Lidar odometry: accepted frame
- 2D costmap → Exploration and recovery: decision map
- Slip guards → Exploration and recovery: motion safety
- dimOS coordinators → Shared zenoh mesh: robot namespace
- Remote relocation rig → Shared zenoh mesh: rig namespace
- Flight and visibility → dimOS coordinators: launches
- Zone editor service → Persistent map and zones: reads and writes