mirror of
https://github.com/CopterExpress/clover_vm.git
synced 2026-05-27 07:29:33 +00:00
Simply build script
This commit is contained in:
@@ -12,45 +12,74 @@ echo "--- Increasing apt retries"
|
||||
sudo -E sh -c 'echo "APT::Acquire::Retries \"3\";" > /etc/apt/apt.conf.d/80-retries'
|
||||
cat /etc/apt/apt.conf.d/80-retries
|
||||
|
||||
echo "--- Updating apt"
|
||||
sudo -E sh -c 'apt-get update'
|
||||
|
||||
echo "--- Allowing apt to perform its updates"
|
||||
sudo -E sh -c 'apt-get update; while fuser /var/lib/dpkg/lock ; do sleep 0.5 ; done'
|
||||
sudo -E sh -c 'while fuser /var/lib/dpkg/lock ; do sleep 0.5 ; done'
|
||||
|
||||
echo "--- Installing open-vm-tools"
|
||||
sudo -E sh -c 'apt-get install -y open-vm-tools open-vm-tools-desktop'
|
||||
|
||||
sudo -E sh -c 'apt-get update; apt-get install -y open-vm-tools open-vm-tools-desktop'
|
||||
echo "--- Installing ROS desktop"
|
||||
sudo -E sh -c 'apt-get install -y curl'
|
||||
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
|
||||
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
|
||||
sudo -E sh -c 'apt-get update; apt-get install -y python3-pip python3-rosdep python3-rosinstall-generator python3-wstool build-essential ros-noetic-desktop'
|
||||
|
||||
echo "--- Installing ROS desktop packages"
|
||||
|
||||
sudo -E sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
|
||||
sudo -E sh -c 'apt-key adv --keyserver "hkp://keyserver.ubuntu.com:80" --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654'
|
||||
sudo -E sh -c 'apt-get update; apt-get install -y python3-rosdep python3-rosinstall-generator python3-wstool build-essential ros-noetic-desktop'
|
||||
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
|
||||
source /opt/ros/noetic/setup.bash
|
||||
|
||||
echo "--- Updating rosdep"
|
||||
sudo -E sh -c 'rosdep init'
|
||||
rosdep update
|
||||
|
||||
# FIXME: PX4 needs pip to be installed
|
||||
# FIXME: python2 dependencies?
|
||||
echo "--- Downloading PX4 and installing its dependencies"
|
||||
git clone --recursive --depth 1 --branch v1.12.0 https://github.com/PX4/PX4-Autopilot.git ${HOME}/PX4-Autopilot
|
||||
# PX4 v1.11.1 script will happily run sudo by itself
|
||||
${HOME}/PX4-Autopilot/Tools/setup/ubuntu.sh
|
||||
# Ubuntu 20.04 no longer sets assistive_technologies, thankfully
|
||||
echo "--- Creating Catkin workspace"
|
||||
mkdir -p ~/catkin_ws/src
|
||||
cd ~/catkin_ws
|
||||
catkin_make
|
||||
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
|
||||
source ~/catkin_ws/devel/setup.bash
|
||||
|
||||
echo "--- Getting Clover sources"
|
||||
cd ~/catkin_ws/src
|
||||
git clone --depth 1 https://github.com/CopterExpress/clover
|
||||
git clone --depth 1 https://github.com/CopterExpress/ros_led
|
||||
git clone --depth 1 https://github.com/ethz-asl/mav_comm
|
||||
|
||||
echo "--- Installing dependencies with rosdep"
|
||||
cd ~/catkin_ws
|
||||
rosdep install --from-paths src --ignore-src -y
|
||||
|
||||
echo "--- Installing Clover's Python dependencies"
|
||||
sudo -E sh -c '/usr/bin/python3 -m pip install -r ~/catkin_ws/src/clover/clover/requirements.txt'
|
||||
|
||||
echo "--- Downloading PX4"
|
||||
git clone --recursive --depth 1 --branch v1.12.0 https://github.com/PX4/PX4-Autopilot.git ~/PX4-Autopilot
|
||||
ln -s ~/PX4-Autopilot ~/catkin_ws/src/
|
||||
ln -s ~/PX4-Autopilot/Tools/sitl_gazebo ~/catkin_ws/src/
|
||||
ln -s ~/PX4-Autopilot/mavlink ~/catkin_ws/src/
|
||||
|
||||
echo "--- Installing PX4 dependencies"
|
||||
~/PX4-Autopilot/Tools/setup/ubuntu.sh
|
||||
pip3 install --user toml
|
||||
sudo -E sh -c 'apt-get install -y ant openjdk-11-jdk' # Additional packages for jMAVSim
|
||||
|
||||
echo "--- Prebuilding PX4 SITL configuration"
|
||||
make -C ${HOME}/PX4-Autopilot px4_sitl
|
||||
echo "--- Patching gazebo plugins for SITL"
|
||||
# cd ${HOME}/PX4-Autopilot/Tools/sitl_gazebo
|
||||
# patch -p1 < /tmp/patches/sitl_gazebo.patch
|
||||
echo 'export SVGA_VGPU10=0' >> ${HOME}/PX4-Autopilot/Tools/setup_gazebo.bash
|
||||
|
||||
echo "--- Addding Gazebo initialization to bashrc"
|
||||
echo "source /usr/share/gazebo/setup.sh" >> ~/.bashrc
|
||||
echo "export SVGA_VGPU10=0" >> ~/.bashrc
|
||||
|
||||
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
|
||||
echo "--- Addding Clover airframe"
|
||||
ln -s ~/catkin_ws/src/clover/clover_simulation/airframes/* ~/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/airframes/
|
||||
|
||||
echo "--- Installing geographiclib datasets"
|
||||
sudo -E sh -c '/opt/ros/noetic/lib/mavros/install_geographiclib_datasets.sh'
|
||||
|
||||
echo "--- Building the workspace"
|
||||
cd ~/catkin_ws
|
||||
catkin_make
|
||||
|
||||
echo "--- Installing Visual Studio Code"
|
||||
|
||||
sudo -E sh -c 'apt-get update; apt-get install -y curl'
|
||||
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > ${HOME}/packages.microsoft.gpg
|
||||
sudo -E sh -c 'install -o root -g root -m 644 ${HOME}/packages.microsoft.gpg /usr/share/keyrings'
|
||||
@@ -63,56 +92,15 @@ code --install-extension ms-vscode.cmake-tools
|
||||
code --install-extension ms-vscode.cpptools
|
||||
code --install-extension streetsidesoftware.code-spell-checker
|
||||
code --install-extension eamodio.gitlens
|
||||
|
||||
echo "--- Installing pylint"
|
||||
/usr/bin/python3 -m pip install -U pylint --user
|
||||
|
||||
echo "--- Cloning and installing Clover packages"
|
||||
sudo sh -c 'curl http://deb.coex.tech/aptly_repo_signing.key 2> /dev/null | apt-key add -'
|
||||
sudo sh -c 'echo "deb http://deb.coex.tech/ros xenial main" > /etc/apt/sources.list.d/coex.tech.list'
|
||||
sudo sh -c 'echo "yaml file:///etc/ros/rosdep/coex.yaml" > /etc/ros/rosdep/sources.list.d/99-coex.list'
|
||||
sudo sh -c 'cat <<EOF > /etc/ros/rosdep/coex.yaml
|
||||
led_msgs:
|
||||
ubuntu:
|
||||
focal: [ros-noetic-led-msgs]
|
||||
async_web_server_cpp:
|
||||
ubuntu:
|
||||
focal: [ros-noetic-async-web-server-cpp]
|
||||
ros_pytest:
|
||||
ubuntu:
|
||||
focal: [ros-noetic-ros-pytest]
|
||||
tf2_web_republisher:
|
||||
ubuntu:
|
||||
focal: [ros-noetic-tf2-web-republisher]
|
||||
web_video_server:
|
||||
ubuntu:
|
||||
focal: [ros-noetic-web-video-server]
|
||||
ws281x:
|
||||
ubuntu:
|
||||
focal: [ros-noetic-ws281x]
|
||||
EOF'
|
||||
sudo apt-get update
|
||||
rosdep update
|
||||
mkdir -p ${HOME}/catkin_ws/src
|
||||
git clone --depth 1 https://github.com/CopterExpress/clover ${HOME}/catkin_ws/src/clover
|
||||
git clone --depth 1 https://github.com/CopterExpress/ros_led ${HOME}/catkin_ws/src/ros_led
|
||||
# These packages are missing from Noetic release, but are required for sitl_gazebo
|
||||
git clone --depth 1 https://github.com/ethz-asl/mav_comm ${HOME}/catkin_ws/src/mav_comm
|
||||
# Make PX4 and Gazebo plugins visible in the workspace
|
||||
ln -s ${HOME}/PX4-Autopilot ${HOME}/catkin_ws/src/PX4-Autopilot
|
||||
ln -s ${HOME}/PX4-Autopilot/Tools/sitl_gazebo ${HOME}/catkin_ws/src/sitl_gazebo
|
||||
rosdep install --from-paths ${HOME}/catkin_ws/src --ignore-src --rosdistro noetic -y
|
||||
sudo /opt/ros/noetic/lib/mavros/install_geographiclib_datasets.sh
|
||||
sudo /usr/bin/python3 -m pip install -r ${HOME}/catkin_ws/src/clover/clover/requirements.txt
|
||||
source /opt/ros/noetic/setup.bash
|
||||
cd ${HOME}/catkin_ws && catkin_make
|
||||
echo "source ${HOME}/catkin_ws/devel/setup.bash" >> ~/.bashrc
|
||||
echo "--- Exposing examples"
|
||||
ln -s ${HOME}/catkin_ws/src/clover/clover/examples ${HOME}/
|
||||
[[ -d ${HOME}/examples ]] # test symlink is valid
|
||||
|
||||
source $HOME/catkin_ws/devel/setup.bash
|
||||
|
||||
echo "--- Adding Clover vehicle startup script to PX4"
|
||||
ln -s "$(catkin_find clover_simulation airframes)"/* $HOME/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/airframes/
|
||||
|
||||
echo "--- Installing npm"
|
||||
echo "--- Installing npm and building documentation"
|
||||
cd ${HOME}
|
||||
NODE_VERSION=v10.15.0 # GitBook won't install on newer version
|
||||
wget --progress=dot:giga https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-linux-x64.tar.gz
|
||||
@@ -131,10 +119,6 @@ gitbook install
|
||||
gitbook build
|
||||
touch node_modules/CATKIN_IGNORE docs/CATKIN_IGNORE _book/CATKIN_IGNORE clover/www/CATKIN_IGNORE # ignore documentation files by catkin
|
||||
|
||||
echo "--- Exposing examples"
|
||||
ln -s ${HOME}/catkin_ws/src/clover/clover/examples ${HOME}/
|
||||
[[ -d ${HOME}/examples ]] # test symlink is valid
|
||||
|
||||
echo "--- Enabling roscore service"
|
||||
sed -i "s/pi/${USER}/g" ${HOME}/catkin_ws/src/clover/builder/assets/roscore.service
|
||||
sudo cp ${HOME}/catkin_ws/src/clover/builder/assets/roscore.service /etc/systemd/system
|
||||
|
||||
Reference in New Issue
Block a user