Controller Update

This commit is contained in:
2026-02-09 05:51:51 +00:00
parent cd9ae9a4f6
commit 1a616472f0
16 changed files with 1545 additions and 669 deletions

View File

@@ -1,87 +1,106 @@
# Setup Guide
Complete installation for Ubuntu 22.04/24.04 and WSL2.
## Prerequisites
## One-Command Installation
- Ubuntu 22.04 (Humble) or 24.04 (Jazzy)
- 16GB RAM minimum
- 50GB free disk space
- Internet connection
## Automatic Installation
The `setup.sh` script installs everything automatically:
```bash
git clone https://git.sirblob.co/SirBlob/simulation.git
cd simulation
cd ~/sim/uav_ugv_simulation
bash setup.sh
```
The script installs:
- ROS 2 (Humble or Jazzy)
- Gazebo Harmonic
- ArduPilot SITL
- ardupilot_gazebo plugin
- Python dependencies
### What Gets Installed
Installation takes 20-40 minutes.
1. **ROS 2** (Humble or Jazzy based on Ubuntu version)
2. **Gazebo Harmonic** (modern simulation)
3. **ArduPilot SITL** (flight controller)
4. **ardupilot_gazebo plugin** (ArduPilot-Gazebo bridge)
5. **Python dependencies** (pymavlink, opencv, scipy, etc.)
6. **MAVROS** (ROS 2 - MAVLink bridge)
### Installation Time
- First install: 20-40 minutes
- ArduPilot build: ~15 minutes
- Gazebo plugin build: ~5 minutes
## Manual Installation
If you prefer to install components separately:
### 1. ROS 2
### Step 1: Install 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
# Ubuntu 22.04
sudo apt install software-properties-common
sudo add-apt-repository universe
sudo apt update && sudo apt install curl -y
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 $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update
sudo apt install ros-humble-ros-base ros-humble-ros-gz
sudo apt install ros-humble-desktop
```
### 2. Gazebo Harmonic
### Step 2: Install 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 install -y wget
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
sudo apt install gz-harmonic
```
### 3. ArduPilot SITL
### Step 3: Install ArduPilot
```bash
git clone --recurse-submodules https://github.com/ArduPilot/ardupilot.git ~/ardupilot
cd ~/ardupilot
cd ~
git clone --recurse-submodules https://github.com/ArduPilot/ardupilot.git
cd ardupilot
Tools/environment_install/install-prereqs-ubuntu.sh -y
. ~/.profile
./waf configure --board sitl
./waf copter
```
### 4. ardupilot_gazebo Plugin
### Step 4: Install ardupilot_gazebo Plugin
```bash
git clone https://github.com/ArduPilot/ardupilot_gazebo.git ~/ardupilot_gazebo
cd ~/ardupilot_gazebo
cd ~
git clone https://github.com/ArduPilot/ardupilot_gazebo.git
cd ardupilot_gazebo
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j4
```
### 5. Python Environment
### Step 5: Install Python Dependencies
```bash
cd ~/simulation
cd ~/sim/uav_ugv_simulation
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```
## Environment Setup
After installation, source the environment:
```bash
source ~/sim/uav_ugv_simulation/activate_venv.sh
```
This sets up:
- Python virtual environment
- Gazebo resource paths
- ArduPilot paths
## Verify Installation
```bash
@@ -91,26 +110,23 @@ 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
# Check Python deps
python3 -c "import pymavlink; print('pymavlink OK')"
python3 -c "import cv2; print('opencv OK')"
```
## Uninstall
```bash
bash scripts/uninstall.sh # ArduPilot and plugin only
bash scripts/uninstall.sh --all # Everything including project
# Remove ArduPilot and plugin only
bash scripts/uninstall.sh
# Remove everything including venv
bash scripts/uninstall.sh --all
```
To remove ROS 2 and Gazebo:
```bash
sudo apt remove ros-humble-* gz-harmonic
```
## Next Steps
1. Run a test simulation: `bash scripts/run_autonomous.sh --mission hover`
2. Read the [Usage Guide](usage.md)
3. Check [Troubleshooting](troubleshooting.md) if issues arise