System Architecture

The platform has two independent layers connected via WebSocket (ROSBridge on port 9090) and a latency API on port 8085.

FRONTEND (Nuxt 3)useRobotConnectionSim | ROS2 | Hardware modeROSBridgeSLAM NavControl AlgoObstacle AvoidLatency DashAnalyticsMobileRobotPhysics (RK4) · SLAMMap · LaserScan169 vitest testsws:9090:8085 APIBACKEND (ROS2 Humble)BaseRobotNodeAbstract base classvirtual_robothardware_robotlatency_tracker.py → API :8085rosbridge_websocket :9090SLAM ToolboxNav2drivers/ L298N · Serial · MockGPIO / USB

Connection Modes

Every control page has a 3-mode selector. The frontend behavior changes, the backend is swapped.

SIM MODEBrowserMobileRobotPhysicsNo networkROS2 MODEBrowserws:9090virtual_robot.pyDocker / nativeHW MODEBrowserws:9090hardware_robot.pyGPIO Motors+ LiDAR

Latency Measurement

Two measurement points: client round-trip (browser) and backend command-to-execute (ROS2 node).

LATENCY MEASUREMENT FLOWcmd_vel sentt₁ = now()WebSocket transportnetwork latencyexecutor receivest₂ = now()motor executest₃ = now()Client Round-Trip (t₃ − t₁)Execution (t₃ − t₂)Sim: ~0.01msDocker: 0.1–0.5msPi native: 0.2–0.8ms

ROS2 Topic Interface

The contract between frontend and backend — all communication goes through these topics.

FRONTENDBACKEND/cmd_velgeometry_msgs/Twist/odomnav_msgs/Odometry · 20Hz/scansensor_msgs/LaserScan · 10Hz/robot_infostd_msgs/String (JSON) · 1Hz

Control Strategies

Four navigation algorithms available on the Auto Control page. Each computes linear and angular velocity from the error between robot pose and target.

PID Controller

Errore(t)ProportionalKp · e(t)Reacts to present errorPIntegralKi · ∫ e(t) dtEliminates steady-state errorIDerivativeKd · de(t)/dtPredicts future errorDΣControlu(t) → cmd_velu(t) = Kp·e + Ki·∫e dt + Kd·(de/dt)

Algorithm Comparison

Target(x, y)PProportionalv = Kp · distance · cos(heading_err)Simple, fast responseMay oscillate near targetPIDPID ControllerKp·e + Ki·∫e + Kd·(de/dt)Accurate, tunableEliminates steady-state errPPPure Pursuitω = 2·sin(α) / look_aheadSmooth curvesBest for path followingSMState MachineTurn → Drive → ArrivePredictable phasesTurn-then-drive approach→ cmd_vel

Obstacle Avoidance Methods

LiDAR/scanPotential FieldsDWAVector Field Hist.Safety ZonesCritical: 0.3m → STOPWarning: 0.6m → SlowDetection: 1.5m → TrackEmergency stop overrides allSafe cmd_velModified velocity

Tunable Parameters

All parameters are adjustable in real-time via sliders on the Auto Control page. Changes take effect immediately.

Controller Gains

Proportional
Kp linear0.1 – 3.0

How aggressively the robot drives toward the target. Higher = faster approach but may overshoot.

Kp angular0.5 – 5.0

How aggressively the robot turns to face the target. Higher = sharper turns.

PID
Kp (linear & angular)0.1 – 8.0

Proportional gain — reacts to current error magnitude.

Ki (linear & angular)0.0 – 1.0

Integral gain — accumulates past errors to eliminate steady-state offset. Too high causes overshoot.

Kd (linear & angular)0.0 – 1.0

Derivative gain — predicts future error from rate of change. Dampens oscillation.

Integral limit0.1 – 5.0

Clamps the integral accumulator to prevent windup when the robot is stuck.

Pure Pursuit
Lookahead distance0.1 – 2.0 m

How far ahead on the path the robot aims. Short = tight tracking but jittery. Long = smooth curves but cuts corners.

Kp linear0.1 – 3.0

Speed gain — scales velocity with distance to lookahead point.

State Machine
Arrival tolerance0.05 – 1.0 m

Distance threshold to consider the robot "arrived" at the target. Smaller = more precise but takes longer to settle.

Heading tolerance0.05 – 1.0 rad

Angle error threshold to switch from "turn in place" to "drive forward" phase.

Safety Zones

RDetection Zone1.5m — Start tracking obstaclesWarning 0.6mSlow downCritical 0.3mEmergency stopObsDetection — track & prepareWarning — reduce speedCritical — emergency stop

Avoidance Algorithm Behaviour

Potential Fields

Each obstacle generates a repulsive force inversely proportional to distance². Forces are summed to create a "push" vector that blends with the desired velocity. Smooth and reactive but can get stuck in local minima between two equal obstacles.

Dynamic Window (DWA)

Evaluates velocity candidates within the robot's acceleration limits. Scores each by clearance (distance to nearest obstacle), heading (alignment to goal), and speed. Picks the best-scoring velocity. Good for tight spaces.

Vector Field Histogram (VFH)

Builds a polar histogram of obstacle density around the robot. Finds the widest gap (lowest density sector) and steers toward it. Reliable in cluttered environments with many small obstacles.

Emergency Stop

Simplest method — halts the robot completely when any obstacle enters the critical zone. Reduces speed in the warning zone. No path re-planning. Use as a safety fallback layer.

Speed Presets

PresetLinear (m/s)Angular (rad/s)Use Case
Slow0.31.0Tight spaces, precision navigation
Normal1.02.0General purpose
Fast2.53.5Open areas, quick traversal

Pages

Joystick + keyboard teleoperation with live latency HUD. Speed/turn sliders with presets, dead zone, emergency stop.

SimROS2HW
Auto Control/control

Autonomous navigation with 4 controllers (P, PID, Pure Pursuit, State Machine), 4 avoidance methods, environment density toggle (Clear/Scarce/Medium/Dense), live performance charts, real-time parameter tuning.

SimROS2HW
SLAM Navigation/slam-navigation

Occupancy grid mapping with SLAM Toolbox, Cartographer, or client-side simulation. Auto-explore, manual control, map export.

SimROS2
Trajectory Following/figure-eight-nav

Figure-eight lemniscate path with pure pursuit controller. Cross-track error, lap counting, data export.

SimROS2

Command-to-execution timing from backend API. Shows avg, P95, jitter, std dev, min/max. CSV export.

ROS2HW
Analytics/analytics

Aggregated performance data from control runs. Singleton state persists across pages. CSV/JSON export.

SimROS2
Material Handling/material-handling

Warehouse pick-and-place simulation with shelves, zones, task queue, gripper control.

Sim
ROS2 Test Bench/ros2-test

ROSBridge connection test, topic subscribe/publish, live telemetry (odom + scan), quick velocity commands with feedback.

ROS2HW

Architecture diagrams, control strategy block diagrams, parameter reference, safety zones, deployment guides.

SimROS2HW

Deployment

Frontend (dev)
cd frontend && pnpm dev
Frontend (prod)
pnpm build && node .output/server/index.mjs
Backend (Docker)
cd backend && ./start.sh start
Backend (Pi native)
sudo ./install.sh systemd
Backend (Pi HW)
sudo ./install.sh systemd --hardware
Full stack
docker compose up --build

Test Suite

19MobileRobotPhysics
18SLAMMap
14LaserScan
22FigureEight
10useROSBridge
12useSimulation
14useROS2Robot
15useSLAMNav
13useControlAlgo
12useObstacleAvoid
11useAnalytics
9useConnection
cd frontend && pnpm test:run169 tests · ~3s