Monte Carlo Localization written in Java for a probabilistic robotics course. A robot wanders a 2D room while a cloud of particles — each a guess at the robot's position and heading — is weighted against the robot's simulated sensor readings and resampled every frame, converging on the robot's true pose without ever being told it directly. Processing is used for drawing graphics and JavaGeom for the room/sensor geometry; robot motion and the particle filter itself are implemented in-project.
- JDK 25
- Maven 3.9+
Build a runnable fat jar with:
mvn clean package
Run it from the repo root, so it can find settings.yaml:
java -jar target/monte-carlo-localization-2.0.0.jar
- Mouse — the robot steers toward the cursor, stopping short of walls.
k— teleport the robot to a random point in the room; the particle cloud re-converges from scratch.
Maps and filter parameters live in settings.yaml at the repo root, read at startup — no rebuild needed, just edit and rerun:
defaultMap— which entry undermapsto load.maps— named rooms, each a polygon of{x, y}corners (at least 3).numOfParticles— size of the particle cloud.sensorRange— max range of the robot's 3-ray sensor (front/left/right).orientationNoise,moveNoise,sensorNoise— motion and sensor noise standard deviations.
A typo'd key or a map with fewer than 3 corners fails fast at startup with a clear error, rather than silently defaulting. YAML forbids tab indentation — use spaces.
mvn test
Covers the particle filter, sensor model, geometry, and config parsing/validation — everything that doesn't need a graphics context to run.
GNU General Public License v2 — see license.txt.