117 lines
2.5 KiB
Markdown
117 lines
2.5 KiB
Markdown
# Setup Guide
|
|
|
|
Complete installation for Ubuntu 22.04/24.04 and WSL2.
|
|
|
|
## One-Command Installation
|
|
|
|
```bash
|
|
git clone https://git.sirblob.co/SirBlob/simulation.git
|
|
cd simulation
|
|
bash setup.sh
|
|
```
|
|
|
|
The script installs:
|
|
- ROS 2 (Humble or Jazzy)
|
|
- Gazebo Harmonic
|
|
- ArduPilot SITL
|
|
- ardupilot_gazebo plugin
|
|
- Python dependencies
|
|
|
|
Installation takes 20-40 minutes.
|
|
|
|
## Manual Installation
|
|
|
|
If you prefer to install components separately:
|
|
|
|
### 1. ROS 2
|
|
|
|
```bash
|
|
# Add ROS 2 repository
|
|
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key \
|
|
-o /usr/share/keyrings/ros-archive-keyring.gpg
|
|
|
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] \
|
|
http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | \
|
|
sudo tee /etc/apt/sources.list.d/ros2.list
|
|
|
|
sudo apt update
|
|
sudo apt install ros-humble-ros-base ros-humble-ros-gz
|
|
```
|
|
|
|
### 2. Gazebo Harmonic
|
|
|
|
```bash
|
|
sudo wget https://packages.osrfoundation.org/gazebo.gpg \
|
|
-O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
|
|
|
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] \
|
|
http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | \
|
|
sudo tee /etc/apt/sources.list.d/gazebo-stable.list
|
|
|
|
sudo apt update
|
|
sudo apt install gz-harmonic libgz-cmake3-dev libgz-sim8-dev
|
|
```
|
|
|
|
### 3. ArduPilot SITL
|
|
|
|
```bash
|
|
git clone --recurse-submodules https://github.com/ArduPilot/ardupilot.git ~/ardupilot
|
|
cd ~/ardupilot
|
|
Tools/environment_install/install-prereqs-ubuntu.sh -y
|
|
. ~/.profile
|
|
./waf configure --board sitl
|
|
./waf copter
|
|
```
|
|
|
|
### 4. ardupilot_gazebo Plugin
|
|
|
|
```bash
|
|
git clone https://github.com/ArduPilot/ardupilot_gazebo.git ~/ardupilot_gazebo
|
|
cd ~/ardupilot_gazebo
|
|
mkdir build && cd build
|
|
cmake .. -DCMAKE_BUILD_TYPE=Release
|
|
make -j$(nproc)
|
|
```
|
|
|
|
### 5. Python Environment
|
|
|
|
```bash
|
|
cd ~/simulation
|
|
python3 -m venv venv
|
|
source venv/bin/activate
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
## Verify Installation
|
|
|
|
```bash
|
|
# Check Gazebo
|
|
gz sim --version
|
|
|
|
# Check ArduPilot
|
|
sim_vehicle.py --help
|
|
|
|
# Check plugin
|
|
ls ~/ardupilot_gazebo/build/libArduPilotPlugin.so
|
|
```
|
|
|
|
## Running the Simulation
|
|
|
|
```bash
|
|
cd ~/simulation
|
|
source activate_venv.sh
|
|
bash scripts/run_simulation.sh
|
|
```
|
|
|
|
## Uninstall
|
|
|
|
```bash
|
|
bash scripts/uninstall.sh # ArduPilot and plugin only
|
|
bash scripts/uninstall.sh --all # Everything including project
|
|
```
|
|
|
|
To remove ROS 2 and Gazebo:
|
|
```bash
|
|
sudo apt remove ros-humble-* gz-harmonic
|
|
```
|