EU_Robot_Group-D/README.md

107 lines
2.6 KiB
Markdown

# 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
```bash
python3 -m venv slam_env
source slam_env/bin/activate
```
### 2. Install required Python libraries
```bash
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:
```bash
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:
```bash
cd ../python
mkdir build && cd build
cmake ..
make -j$(nproc)
sudo make install
```
If needed, update your PYTHONPATH:
```bash
export PYTHONPATH=/usr/local/lib/python3.x/dist-packages:$PYTHONPATH
```
Replace `python3.x` with your installed version.
## 🚀 Usage
### Run the simulation in GUI mode
```bash
python aa.py
```
or explicitly:
```bash
python aa.py --gui
```
### Run the simulation in headless (non-GUI) mode
```bash
python aa.py --no-gui
```
### Load a custom environment from a Tiled map
```bash
python aa.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 file
- `map.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 |