-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.sh
67 lines (55 loc) · 2.31 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
echo "Starting setup script for ArduPilot Gazebo..."
# Change directory to home
cd ~
# Clone the specified branch from the GitHub repository
echo "Cloning the ardupilot_gazebo_ap repository..."
git clone https://github.com/snktshrma/ardupilot_gazebo_ap.git -b gsoc-arena
if [ $? -ne 0 ]; then
echo "Error: Failed to clone the repository."
exit 1
fi
# Update package lists
echo "Updating package lists..."
sudo apt update
# Install necessary dependencies
echo "Installing required libraries for Gazebo and GStreamer..."
sudo apt install -y libgz-sim8-dev rapidjson-dev
sudo apt install -y libopencv-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-gl
# Set GZ_VERSION environment variable
echo "Setting GZ_VERSION environment variable..."
echo 'export GZ_VERSION=harmonic' >> ~/.bashrc
# Move to cloned repository and build
echo "Entering the ardupilot_gazebo_ap directory and building project..."
cd ardupilot_gazebo_ap
mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
if [ $? -ne 0 ]; then
echo "Error: CMake configuration failed."
exit 1
fi
echo "Compiling the project (this may take a few minutes)..."
make -j4
if [ $? -ne 0 ]; then
echo "Error: Compilation failed."
exit 1
fi
# Set environment paths for plugins and resources
echo "Setting environment paths for plugins and resources..."
echo 'export GZ_SIM_SYSTEM_PLUGIN_PATH=$HOME/ardupilot_gazebo_ap/build:${GZ_SIM_SYSTEM_PLUGIN_PATH}' >> ~/.bashrc
echo 'export GZ_SIM_RESOURCE_PATH=$HOME/ardupilot_gazebo_ap/models:$HOME/ardupilot_gazebo_ap/worlds:${GZ_SIM_RESOURCE_PATH}' >> ~/.bashrc
echo 'export GZ_SIM_RESOURCE_PATH=$HOME/ap_nongps/models:$HOME/ap_nongps/worlds:$GZ_SIM_RESOURCE_PATH' >> ~/.bashrc
# Apply changes to current session
echo "Applying environment changes..."
source ~/.bashrc
# Install additional dependencies
echo "Installing additional required libraries..."
sudo apt-get install -y libgirepository1.0-dev libcairo2-dev gobject-introspection
# Install Python dependencies
echo "Installing Python dependencies from requirements.txt..."
pip install -r requirements.txt
if [ $? -ne 0 ]; then
echo "Error: Failed to install Python dependencies."
exit 1
fi
echo "Setup complete! You may need to restart your terminal for all changes to take effect."