2.6 KiB
2.6 KiB
Robot SLAM Simulation with Sensor Crosstalk Management
This project simulates a robot equipped with Ultrasound and IR sensors navigating a 2D environment, performing SLAM (Simultaneous Localization and Mapping), managing dynamic crosstalk, and building an occupancy grid map in real-time, with optional GUI visualization.
📦 Installation (Linux)
1. Set up a Python virtual environment
python3 -m venv slam_env
source slam_env/bin/activate
2. Install required Python libraries
pip install numpy matplotlib PyQt5 scikit-learn pytmx
3. Install GTSAM manually from GitHub
Follow the official GTSAM installation guide:
https://github.com/borglab/gtsam
Summary of typical steps:
sudo apt-get install cmake libboost-all-dev libtbb-dev libeigen3-dev
git clone https://github.com/borglab/gtsam.git
cd gtsam
mkdir build && cd build
cmake ..
make -j$(nproc)
sudo make install
Then, install Python bindings:
cd ../python
mkdir build && cd build
cmake ..
make -j$(nproc)
sudo make install
If needed, update your PYTHONPATH:
export PYTHONPATH=/usr/local/lib/python3.x/dist-packages:$PYTHONPATH
Replace python3.x with your installed version.
🚀 Usage
Run the simulation in GUI mode
python your_script.py
or explicitly:
python your_script.py --gui
Run the simulation in headless (non-GUI) mode
python your_script.py --no-gui
Load a custom environment from a Tiled map
python your_script.py --tiled_map your_map.tmx
Controls (in GUI mode)
| Key | Action |
|---|---|
Z |
Move forward |
S |
Move backward |
Q |
Turn left |
D |
Turn right |
X |
Stop movement |
SPACE |
Pause / Resume |
ESC |
Save sensor layout |
When closing the GUI, the following files are automatically saved:
map.pkl→ Occupancy grid as a pickle filemap.png→ Occupancy grid image
🔧 Project Structure
| File/Folder | Description |
|---|---|
| Sensor, MotionModel, SLAMEngine, etc. | Core simulation classes |
| SensorLayoutEditor | GUI editor for live sensor placement |
| Visualizer | 2D occupancy grid visualization |
| Environment | Wall and obstacle management (including Tiled map support) |
| OccupancyGrid, CoverageAnalyzer | Mapping and blind spot detection |
| main() | Entry point for launching GUI or headless simulation |