Compare commits

..

15 Commits

Author SHA1 Message Date
Alexey Rogachevskiy
0ced4b306d build, travis: Produce less dots 2020-07-20 22:56:13 +03:00
Alexey Rogachevskiy
0fad6726f5 travis-ci: Don't use upload folders 2020-07-20 22:55:15 +03:00
Alexey Rogachevskiy
c70fc8dd0b travis: Use proper bucket name 2020-07-09 21:26:47 +03:00
Alexey Rogachevskiy
d9fc21773b travis: Use S3 key stored in travis environment 2020-07-09 21:14:38 +03:00
Alexey Rogachevskiy
8ef93c928a travis: Set actual S3 endpoint 2020-07-09 20:02:28 +03:00
Alexey Rogachevskiy
848e4b33f7 travis: Try enabling deployments 2020-07-09 18:50:41 +03:00
Alexey Rogachevskiy
11196f0c7d scripts: Allow apt to finish doing initial updates 2020-07-09 17:03:44 +03:00
Alexey Rogachevskiy
46064eafe2 ros_ide_vm: Be even more CI-friendly 2020-07-05 22:16:18 +03:00
Alexey Rogachevskiy
72f35a0b04 ros_ide_vm: Allocate less resources for build 2020-07-05 22:05:57 +03:00
Alexey Rogachevskiy
246ba6e5fb travis: Download base VM instead of building it 2020-07-05 22:04:16 +03:00
Alexey Rogachevskiy
9d2830bfeb base_vm: Try building in headless mode 2020-07-05 20:29:26 +03:00
Alexey Rogachevskiy
31db396477 base_vm: Use simplier hardware config 2020-07-05 18:22:54 +03:00
Alexey Rogachevskiy
8709ec5873 build: Download Packer in CI environment (hack) 2020-07-05 18:05:59 +03:00
Alexey Rogachevskiy
691cdde431 travis: Bump Virtualbox version 2020-07-05 17:58:23 +03:00
Alexey Rogachevskiy
e2c6d709db travis: Try running Packer in CI 2020-07-05 17:54:11 +03:00
21 changed files with 215 additions and 454 deletions

View File

@@ -1,31 +0,0 @@
name: Build image
on:
push:
branches: [ '*' ]
pull_request:
branches: [ master ]
release:
types: [ created ]
workflow_dispatch:
jobs:
build:
runs-on: macos-12 # Using macOS as https://github.com/actions/virtual-environments/issues/183
steps:
- uses: actions/checkout@v2
- name: Download base image
run: |
mkdir output-virtualbox-iso
wget --progress=dot:giga https://clovervm.ams3.digitaloceanspaces.com/base-focal.ova -O output-virtualbox-iso/clover-devel.ova
- name: Build
run: ./build.sh
- name: Image size
run: ls -lh output-virtualbox-ovf
- name: Upload
if: ${{ github.event_name == 'release' }}
# Not using ready S3 actions, because they either don't run on macOS machines or don't support changing the endpoint
run: |
AWS_ACCESS_KEY_ID=${{secrets.S3_KEY}} AWS_SECRET_ACCESS_KEY=${{secrets.S3_SECRET_KEY}} aws s3 sync . s3://clovervm/ --acl public-read --endpoint-url https://ams3.digitaloceanspaces.com --no-progress
echo Uploaded https://clovervm.ams3.digitaloceanspaces.com/$(ls)
working-directory: output-virtualbox-ovf

View File

@@ -4,21 +4,20 @@ before_install:
- wget https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key - wget https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key
add - && sudo sh -c "echo deb https://download.virtualbox.org/virtualbox/debian add - && sudo sh -c "echo deb https://download.virtualbox.org/virtualbox/debian
bionic contrib >> /etc/apt/sources.list" && sudo apt-get update && sudo apt-get bionic contrib >> /etc/apt/sources.list" && sudo apt-get update && sudo apt-get
install build-essential gcc make linux-headers-$(uname -r) virtualbox-6.0 && sudo install build-essential gcc make linux-headers-$(uname -r) virtualbox-6.1 && sudo
usermod -aG vboxusers $(whoami) usermod -aG vboxusers $(whoami)
- mkdir output-virtualbox-iso && pushd output-virtualbox-iso && wget --progress=dot:giga https://clovervm.ams3.digitaloceanspaces.com/base-focal.ova -O clover-devel.ova - mkdir output-virtualbox-iso && pushd output-virtualbox-iso && wget --progress=dot:giga https://github.com/sfalexrog/clever_vm/releases/download/v0_base_vm/clever-devel.ova
&& popd && popd
- sudo apt install -y xvfb
script: script:
- "xvfb-run ./build.sh" - "./build.sh"
# deploy: deploy:
# provider: s3 provider: s3
# access_key_id: XOJXX4IOM66XN7VZAFYX access_key_id: XOJXX4IOM66XN7VZAFYX
# secret_access_key: $S3_SECRET_KEY secret_access_key: $S3_SECRET_KEY
# bucket: clovervm bucket: clovervm
# local-dir: output-virtualbox-ovf local-dir: output-virtualbox-ovf
# acl: public_read acl: public_read
# on: on:
# all_branches: true all_branches: true
# skip_cleanup: true skip_cleanup: true
# endpoint: https://ams3.digitaloceanspaces.com endpoint: https://ams3.digitaloceanspaces.com

21
LICENSE
View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2020 Copter Express Technologies
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,19 +0,0 @@
# Clover drone VM image
The generator of Clover developer virtual machine image (`.ova` file) to simplify working with Clover and Clover simulation.
Download the latest image in [Releases](https://github.com/CopterExpress/clover_vm/releases/latest) section.
<img src=https://clover.coex.tech/assets/simulator.jpg width=600>
Image contains:
* Ubuntu 20.04 Focal.
* ROS Noetic.
* PX4 autopilot, QGroundControl.
* Preinstalled [Clover](https://github.com/CopterExpress/clover) and Clover simulation packages.
* Shortcuts for running Clover simulator.
* VSCode.
* Useful robotics-related software.
See detailed information in [Clover drone documentation](https://clover.coex.tech/en/simulation_vm.html).

View File

@@ -1 +0,0 @@
unknown

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<channel name="xfce4-power-manager" version="1.0">
<property name="xfce4-power-manager" type="empty">
<property name="power-button-action" type="empty"/>
<property name="lock-screen-suspend-hibernate" type="empty"/>
<property name="logind-handle-lid-switch" type="empty"/>
<property name="blank-on-ac" type="empty"/>
<property name="blank-on-battery" type="empty"/>
<property name="dpms-enabled" type="bool" value="false"/>
<property name="dpms-on-ac-sleep" type="empty"/>
<property name="dpms-on-ac-off" type="empty"/>
<property name="dpms-on-battery-sleep" type="empty"/>
<property name="dpms-on-battery-off" type="empty"/>
<property name="show-panel-label" type="empty"/>
<property name="inactivity-sleep-mode-on-ac" type="empty"/>
<property name="inactivity-sleep-mode-on-battery" type="empty"/>
<property name="show-tray-icon" type="bool" value="false"/>
</property>
</channel>

View File

@@ -1,7 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Link
Name=Clover Drone Kit Tools
Comment=Open web based Clover tools
Icon=user-bookmarks
URL=http://localhost/

View File

@@ -1,10 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Gazebo Clover
Comment=Run Clover drone simulation in Gazebo
Exec=/bin/bash -c 'source /home/clover/catkin_ws/devel/setup.bash; roslaunch clover_simulation simulator.launch'
Icon=gazebo
Path=
Terminal=true
StartupNotify=false

View File

@@ -0,0 +1,10 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Gazebo PX4
Comment=Fully-featured Gazebo simulation with default PX4 settings
Exec=/bin/bash -c 'source /home/clever/catkin_ws/devel/setup.bash; roslaunch clover_simulation simulator.launch'
Icon=gazebo
Path=
Terminal=true
StartupNotify=false

View File

@@ -1,8 +1,8 @@
[Desktop Entry] [Desktop Entry]
Name=VS Code Name=VS Code + ROS
Comment=Code Editing. Redefined. Comment=Code Editing. Redefined.
GenericName=Text Editor GenericName=Text Editor
Exec=/bin/bash -c "source /home/clover/catkin_ws/devel/setup.bash; /usr/share/code/code --no-sandbox --unity-launch %F" Exec=/bin/bash -c "source /home/clever/catkin_ws/devel/setup.bash; /usr/share/code/code --no-sandbox --unity-launch %F"
Icon=/usr/share/pixmaps/com.visualstudio.code.png Icon=/usr/share/pixmaps/com.visualstudio.code.png
Type=Application Type=Application
StartupNotify=false StartupNotify=false

View File

@@ -0,0 +1,10 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=jMAVSim
Comment=A lightweight PX4 simulator
Exec=/bin/bash -c 'cd ~/Firmware; make px4_sitl jmavsim'
Icon=openjdk-8
Path=
Terminal=true
StartupNotify=false

View File

@@ -3,7 +3,7 @@ Type=Application
Name=QGroundControl Name=QGroundControl
GenericName=Ground Control Station GenericName=Ground Control Station
Comment=UAS ground control station Comment=UAS ground control station
Icon=/home/clover/Pictures/qgroundcontrol.png Icon=/home/clever/Pictures/qgroundcontrol.png
Exec=/home/clover/QGroundControl.AppImage Exec=/home/clever/QGroundControl.AppImage
Terminal=false Terminal=false
Categories=Utility; Categories=Utility;

View File

@@ -1,36 +1,40 @@
diff --git a/src/gazebo_gps_plugin.cpp b/src/gazebo_gps_plugin.cpp diff --git a/include/gazebo_opticalflow_plugin.h b/include/gazebo_opticalflow_plugin.h
index 1195f5e..6540596 100644 index 4fbeab2..18a192b 100644
--- a/src/gazebo_gps_plugin.cpp --- a/include/gazebo_opticalflow_plugin.h
+++ b/src/gazebo_gps_plugin.cpp +++ b/include/gazebo_opticalflow_plugin.h
@@ -41,7 +41,6 @@ GpsPlugin::~GpsPlugin() @@ -40,7 +40,7 @@
if (updateSensorConnection_) #include "flow_px4.hpp"
updateSensorConnection_->~Connection();
parentSensor_.reset(); #define DEFAULT_RATE 20
- world_->Reset(); -#define HAS_GYRO TRUE
+#define HAS_GYRO true
using namespace cv;
using namespace std;
diff --git a/src/gazebo_geotagged_images_plugin.cpp b/src/gazebo_geotagged_images_plugin.cpp
index 050558f..7029199 100644
--- a/src/gazebo_geotagged_images_plugin.cpp
+++ b/src/gazebo_geotagged_images_plugin.cpp
@@ -581,7 +581,8 @@ void GeotaggedImagesPlugin::_send_capture_status(struct sockaddr* srcaddr)
0, // video status (Idle)
interval, // image interval
0, // recording_time_s
- available_mib); // available_capacity
+ available_mib, // available_capacity
+ _imageCounter);
_send_mavlink_message(&msg, srcaddr);
} }
void GpsPlugin::Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf) diff --git a/src/gazebo_mavlink_interface.cpp b/src/gazebo_mavlink_interface.cpp
diff --git a/src/gazebo_groundtruth_plugin.cpp b/src/gazebo_groundtruth_plugin.cpp index 5d29017..d4dd6a7 100644
index 441ebd9..dd66e12 100644 --- a/src/gazebo_mavlink_interface.cpp
--- a/src/gazebo_groundtruth_plugin.cpp +++ b/src/gazebo_mavlink_interface.cpp
+++ b/src/gazebo_groundtruth_plugin.cpp @@ -1039,7 +1039,7 @@ void GazeboMavlinkInterface::VisionCallback(OdomPtr& odom_message) {
@@ -51,7 +51,6 @@ GroundtruthPlugin::~GroundtruthPlugin()
{
if (updateConnection_)
updateConnection_->~Connection();
- world_->Reset();
}
void GroundtruthPlugin::Load(physics::ModelPtr _model, sdf::ElementPtr _sdf) odom.time_usec = odom_message->time_usec();
diff --git a/src/gazebo_lidar_plugin.cpp b/src/gazebo_lidar_plugin.cpp
index 38374e6..1b2fbf8 100644
--- a/src/gazebo_lidar_plugin.cpp
+++ b/src/gazebo_lidar_plugin.cpp
@@ -47,7 +47,6 @@ LidarPlugin::~LidarPlugin()
newLaserScansConnection_->~Connection();
newLaserScansConnection_.reset();
parentSensor_.reset();
- world_->Reset();
}
///////////////////////////////////////////////// - odom.frame_id = MAV_FRAME_VISION_NED;
+ odom.frame_id = 16 /*MAV_FRAME_VISION_NED*/;
odom.child_frame_id = MAV_FRAME_BODY_FRD;
odom.x = position.X();

View File

@@ -0,0 +1,3 @@
{
"python.pythonPath": "/usr/bin/python2.7"
}

View File

@@ -1,8 +1,8 @@
{ {
"variables" : { "variables" : {
"user": "clover", "user": "clever",
"password": "clover", "password": "clever",
"vm-name": "clover-devel" "vm-name": "clever-devel"
}, },
"builders": [{ "builders": [{
"type": "virtualbox-iso", "type": "virtualbox-iso",
@@ -17,10 +17,10 @@
["storageattach", "{{.Name}}", "--storagectl", "SATA Controller", "--port", "0", "--nonrotational", "on", "--discard", "on"] ["storageattach", "{{.Name}}", "--storagectl", "SATA Controller", "--port", "0", "--nonrotational", "on", "--discard", "on"]
], ],
"headless": "false", "headless": "true",
"iso_url": "http://archive.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/current/legacy-images/netboot/mini.iso", "iso_url": "http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/current/images/netboot/mini.iso",
"iso_checksum": "0e79e00bf844929d40825b1f0e8634415cda195ba23bae0b041911fde4dfe018", "iso_checksum": "bed8a55ae2a657f8349fe3271097cff3a5b8c3d1048cf258568f1601976fa30d",
"iso_checksum_type": "sha256", "iso_checksum_type": "sha256",
"ssh_password": "{{user `password`}}", "ssh_password": "{{user `password`}}",

View File

@@ -1,51 +1,25 @@
#!/bin/bash #!/bin/bash
set -ex
# FIXME: Use system Packer if possible # FIXME: Use system Packer if possible
#PACKER=$(which packer) #PACKER=$(which packer)
echo "--- Fill version asset"
# if [[ $GITHUB_REF == refs/tags/*-rc* ]]; then
# remove rc label
# VERSION=${GITHUB_REF#refs/tags/}
# VERSION=${VERSION/-rc*/}
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
else
VERSION=$(git describe --always)
fi
echo $VERSION > assets/clover_vm_version
#if [ "x${PACKER}" == "x" ]; then #if [ "x${PACKER}" == "x" ]; then
PACKER="./packer" PACKER="./packer"
if [ ! -f ${PACKER} ]; then if [ ! -f ${PACKER} ]; then
echo "Packer not found; downloading v1.5.4 from Hashicorp" echo "Packer not found; downloading v1.5.4 from Hashicorp"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then wget --progress=dot:giga https://releases.hashicorp.com/packer/1.5.4/packer_1.5.4_linux_amd64.zip
OS=linux unzip packer_1.5.4_linux_amd64.zip
elif [[ "$OSTYPE" == "darwin"* ]]; then rm packer_1.5.4_linux_amd64.zip
OS=darwin
fi
wget --progress=dot:giga https://releases.hashicorp.com/packer/1.5.4/packer_1.5.4_${OS}_amd64.zip
unzip packer_1.5.4_${OS}_amd64.zip
rm packer_1.5.4_${OS}_amd64.zip
fi fi
echo "--- Using Packer version $(${PACKER} --version)" echo "--- Using Packer version $(${PACKER} --version)"
if [ ! -f output-virtualbox-iso/clover-devel.ova ]; then echo "--- Building base image"
echo "--- Building base image"
${PACKER} build -only=virtualbox-iso base_vm.json || true ${PACKER} build -only=virtualbox-iso base_vm.json
fi
echo "--- Building extended image" echo "--- Building extended image"
${PACKER} build ros_ide_vm.json ${PACKER} build ros_ide_vm.json
echo "--- Marking the VM"
VM_NAME="clover-devel_${VERSION}.ova"
mv ./output-virtualbox-ovf/clover-devel.ova ./output-virtualbox-ovf/${VM_NAME}
ls -l output-virtualbox-ovf
echo "--- All done!" echo "--- All done!"

View File

@@ -7,7 +7,7 @@ d-i debconf debconf/frontend select Noninteractive
d-i debian-installer/locale string en_US.utf8 d-i debian-installer/locale string en_US.utf8
### Hardware enablement kernel ### Hardware enablement kernel
d-i base-installer/kernel/override-image string linux-generic-hwe-20.04 d-i base-installer/kernel/override-image string linux-generic-hwe-18.04
### Keyboard selection ### Keyboard selection
d-i console-setup/ask_detect boolean false d-i console-setup/ask_detect boolean false
@@ -25,7 +25,7 @@ ubiquity console-keymaps-at/variant select us
d-i kbd-chooser/method select British English d-i kbd-chooser/method select British English
### Network ### Network
d-i netcfg/get_hostname string clover-devel d-i netcfg/get_hostname string clever-devel
d-i netcfg/get_domain string unassigned-domain d-i netcfg/get_domain string unassigned-domain
### Clock and time zone setup ### Clock and time zone setup
@@ -41,10 +41,10 @@ d-i partman/choose_partition select finish
d-i partman/confirm boolean true d-i partman/confirm boolean true
### Account setup ### Account setup
d-i passwd/user-fullname string clover d-i passwd/user-fullname string clever
d-i passwd/username string clover d-i passwd/username string clever
d-i passwd/user-password password clover d-i passwd/user-password password clever
d-i passwd/user-password-again password clover d-i passwd/user-password-again password clever
d-i passwd/auto-login boolean true d-i passwd/auto-login boolean true
d-i user-setup/encrypt-home boolean false d-i user-setup/encrypt-home boolean false
d-i user-setup/allow-password-weak boolean true d-i user-setup/allow-password-weak boolean true

View File

@@ -1,8 +1,8 @@
{ {
"variables": { "variables": {
"user": "clover", "user": "clever",
"password": "clover", "password": "clever",
"vm-name": "clover-devel", "vm-name": "clever-devel",
"scriptsDir": "scripts", "scriptsDir": "scripts",
"assetsDir": "assets" "assetsDir": "assets"
}, },
@@ -13,7 +13,7 @@
"format": "ova", "format": "ova",
"guest_additions_mode": "disable", "guest_additions_mode": "disable",
"headless": "false", "headless": "true",
"vboxmanage": [ "vboxmanage": [
["modifyvm", "{{.Name}}", "--memory", "6144", "--vram", "128", "--mouse", "usbtablet", "--rtcuseutc", "on", "--nictype1", "virtio"], ["modifyvm", "{{.Name}}", "--memory", "6144", "--vram", "128", "--mouse", "usbtablet", "--rtcuseutc", "on", "--nictype1", "virtio"],
@@ -41,17 +41,17 @@
"provisioners": [{ "provisioners": [{
"type": "file", "type": "file",
"source": "{{user `assetsDir`}}/background/", "source": "{{user `assetsDir`}}/background/",
"destination": "/home/{{user `user`}}/Pictures" "destination": "/home/clever/Pictures"
}, },
{ {
"type": "file", "type": "file",
"source": "{{user `assetsDir`}}/pictures/", "source": "{{user `assetsDir`}}/pictures/",
"destination": "/home/{{user `user`}}/Pictures" "destination": "/home/clever/Pictures"
}, },
{ {
"type": "file", "type": "file",
"source": "{{user `assetsDir`}}/desktop/", "source": "{{user `assetsDir`}}/desktop/",
"destination": "/home/{{user `user`}}/Desktop" "destination": "/home/clever/Desktop"
}, },
{ {
"type": "file", "type": "file",
@@ -64,13 +64,13 @@
"destination": "/tmp" "destination": "/tmp"
}, },
{ {
"type": "file", "type": "shell",
"source": "{{user `assetsDir`}}/clover_vm_version", "script": "scripts/installSoftware.sh",
"destination": "/tmp/clover_vm_version" "execute_command": "PASSWORD='{{user `password`}}' bash '{{.Path}}'"
}, },
{ {
"type": "shell", "type": "file",
"script": "scripts/install_software.sh", "source": "{{user `assetsDir`}}/vscode/",
"execute_command": "PASSWORD='{{user `password`}}' bash '{{.Path}}'" "destination": "/home/clever/.config/Code/User/"
}] }]
} }

106
scripts/installSoftware.sh Normal file
View File

@@ -0,0 +1,106 @@
#!/usr/bin/env bash
set -e
echo "--- Current environment:"
/usr/bin/env
echo "Enabling passwordless sudo"
echo "${PASSWORD}" | sudo -E -S sh -c 'echo "clever ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers'
echo "--- Allowing apt to perform its updates"
sudo -E sh -c 'apt update; while fuser /var/lib/dpkg/lock ; do sleep 0.5 ; done'
echo "--- Installing open-vm-tools"
echo "${PASSWORD}" | sudo -E -S sh -c 'apt update; apt install -y open-vm-tools open-vm-tools-desktop'
echo "--- Installing ROS desktop packages"
echo "${PASSWORD}" | sudo -E -S sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
echo "${PASSWORD}" | sudo -E -S sh -c 'apt-key adv --keyserver "hkp://keyserver.ubuntu.com:80" --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654'
echo "${PASSWORD}" | sudo -E -S sh -c 'apt update; apt install -y python-rosdep python-rosinstall-generator python-wstool build-essential ros-melodic-desktop'
echo "${PASSWORD}" | sudo -E -S sh -c 'rosdep init'
rosdep update
echo "--- Downloading PX4 and installing its dependencies"
git clone -b v1.10.1-clever https://github.com/CopterExpress/Firmware ${HOME}/Firmware
echo "${PASSWORD}" | sudo -E -S sh -c '${HOME}/Firmware/Tools/setup/ubuntu.sh'
echo "${PASSWORD}" | sudo -E -S sh -c 'echo "2" | update-alternatives --config java'
echo "${PASSWROD}" | sudo -E -S sed -i -e '/^assistive_technologies=/s/^/#/' /etc/java-*-openjdk/accessibility.properties
echo "--- Prebuilding PX4 SITL configuration"
make -C ${HOME}/Firmware px4_sitl
echo "--- Patching gazebo plugins for SITL"
cd ${HOME}/Firmware/Tools/sitl_gazebo
patch -p1 < /tmp/patches/sitl_gazebo.patch
echo 'export SVGA_VGPU10=0' >> /home/clever/Firmware/Tools/setup_gazebo.bash
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
echo "--- Installing Visual Studio Code"
echo "${PASSWORD}" | sudo -E -S sh -c 'apt update; apt install -y curl'
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > ${HOME}/packages.microsoft.gpg
echo "${PASSWORD}" | sudo -E -S sh -c 'install -o root -g root -m 644 ${HOME}/packages.microsoft.gpg /usr/share/keyrings'
rm ${HOME}/packages.microsoft.gpg
echo "${PASSWORD}" | sudo -E -S sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
echo "${PASSWORD}" | sudo -E -S sh -c 'apt install -y apt-transport-https; apt update; apt install -y code'
code --install-extension ms-python.python
code --install-extension DavidAnson.vscode-markdownlint
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/python2.7 -m pip install -U "pylint<2.0.0" --user
/usr/bin/python3.6 -m pip install -U pylint --user
echo "--- Cloning and installing Clever packages"
mkdir -p ${HOME}/catkin_ws/src
git clone -b clover_description https://github.com/CopterExpress/clover ${HOME}/catkin_ws/src/clover
git clone https://github.com/CopterExpress/ros_led ${HOME}/catkin_ws/src/ros_led
# Make PX4 and Gazebo plugins visible in the workspace
ln -s ${HOME}/Firmware ${HOME}/catkin_ws/src/Firmware
ln -s ${HOME}/Firmware/Tools/sitl_gazebo ${HOME}/catkin_ws/src/sitl_gazebo
rosdep install --from-paths ${HOME}/catkin_ws/src --ignore-src --rosdistro melodic -y
curl https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh -o ${HOME}/install_geographiclib_datasets.sh
chmod a+x ${HOME}/install_geographiclib_datasets.sh
echo "${PASSWORD}" | sudo -E -S sh -c '${HOME}/install_geographiclib_datasets.sh'
source /opt/ros/melodic/setup.bash
cd ${HOME}/catkin_ws && catkin_make
echo "source /home/clever/catkin_ws/devel/setup.bash" >> ~/.bashrc
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
sudo systemctl enable roscore.service
echo "--- Installing QGroundControl"
echo "${PASSWORD}" | sudo -E -S sh -c "usermod -a -G dialout $USER"
echo "${PASSWORD}" | sudo -E -S sh -c 'apt remove -y modemmanager; apt install -y gstreamer1.0-plugins-bad gstreamer1.0-libav'
curl https://s3-us-west-2.amazonaws.com/qgroundcontrol/latest/QGroundControl.AppImage -o ${HOME}/QGroundControl.AppImage
chmod a+x ${HOME}/QGroundControl.AppImage
echo "--- Installing Firefox web browser"
echo "${PASSWORD}" | sudo -E -S sh -c 'apt update; apt install -y firefox'
echo "--- Installing Monkey web server"
sudo apt install -y /tmp/packages/monkey_1.6.9-1_amd64.deb
sed "s/pi/${USER}/g" ${HOME}/catkin_ws/src/clover/builder/assets/monkey | sudo tee /etc/monkey/sites/default
sudo cp ${HOME}/catkin_ws/src/clover/builder/assets/monkey.service /etc/systemd/system/monkey.service
sudo systemctl enable monkey
echo "--- Installing additional packages"
sudo -E sh -c 'apt update; apt install -y sshfs gvfs-fuse gvfs-backends python3-opencv byobu ipython ipython3 byobu nmap lsof tmux vim ros-melodic-rqt-multiplot'
echo "--- Personalizing VM"
echo "${PASSWORD}" | sudo -E -S sh -c 'mv /etc/xdg/autostart/light-locker.desktop /etc/xdg/autostart/light-locker.desktop.old'
echo "${PASSWORD}" | sudo -E -S sh -c 'cp /usr/share/xfce4/backdrops/xubuntu-wallpaper.png /usr/share/xfce4/backdrops/xubuntu-wallpaper-old.png; cp /home/clever/Pictures/Logo_COEX_2019_white_on_black.png /usr/share/xfce4/backdrops/xubuntu-wallpaper.png'
echo "${PASSWORD}" | sudo -E -S sh -c 'hostnamectl set-hostname clever-dev; sed -i "s/ubuntu/clever-dev clever-dev.local/g" /etc/hosts'
echo "export ROS_HOSTNAME=\`hostname\`.local" >> ${HOME}/.bashrc
chmod a+x /home/clever/Desktop/*
echo "--- Cleaning up"
echo "${PASSWORD}" | sudo -E -S sh -c 'apt-get -y autoremove; apt-get -y autoclean; apt-get -y clean; fstrim -v /'

View File

@@ -1,236 +0,0 @@
#!/usr/bin/env bash
set -ex
echo "--- Current environment:"
/usr/bin/env
echo "Enabling passwordless sudo"
echo "${PASSWORD}" | sudo -E -S sh -c "echo '${USER} ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers"
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 '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'
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 "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source /opt/ros/noetic/setup.bash
echo "--- Updating rosdep"
sudo -E sh -c 'rosdep init'
rosdep update
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.13.3 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/
echo "--- Installing PX4 dependencies"
echo "progress=dot:giga" > ~/.wgetrc # make wget don't spam to log
~/PX4-Autopilot/Tools/setup/ubuntu.sh --no-nuttx
rm ~/.wgetrc
pip3 install --user toml
# sudo -E sh -c 'apt-get install -y ant openjdk-11-jdk' # Additional packages for jMAVSim
echo "--- Patching mavlink_sitl_gazebo"
# See https://github.com/PX4/PX4-SITL_gazebo/pull/872
cd ~/PX4-Autopilot/Tools/sitl_gazebo
patch -p1 < /tmp/patches/sitl_gazebo.patch
echo "--- Addding Gazebo initialization to bashrc"
echo "source /usr/share/gazebo/setup.sh" >> ~/.bashrc
echo "export SVGA_VGPU10=0" >> ~/.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 "--- Build mavlink"
cd ~/catkin_ws
catkin_make mavlink_c_generate -DCATKIN_WHITELIST_PACKAGES="px4" # at first build PX4's mavlink to enforce mavlink_sitl_gazebo using it
ln -s "." build/mavlink/mavlink # fix https://github.com/PX4/PX4-Autopilot/pull/19964
echo "--- Building the workspace"
catkin_make -DCATKIN_WHITELIST_PACKAGES=""
echo "--- Running tests"
catkin_make run_tests && catkin_test_results
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'
rm ${HOME}/packages.microsoft.gpg
sudo -E sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo -E sh -c 'apt-get install -y apt-transport-https; apt-get update; apt-get install -y code'
code --install-extension ms-python.python
code --install-extension DavidAnson.vscode-markdownlint
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 additional Python packages"
/usr/bin/python3 -m pip install -U pylint pyzbar --user
echo "--- Exposing examples"
ln -s ${HOME}/catkin_ws/src/clover/clover/examples ${HOME}/
[[ -d ${HOME}/examples ]] # test symlink is valid
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
tar -xzf node-$NODE_VERSION-linux-x64.tar.gz
sudo cp -R node-$NODE_VERSION-linux-x64/* /usr/local/
rm -rf node-$NODE_VERSION-linux-x64 node-$NODE_VERSION-linux-x64.tar.gz
echo "--- Reconfiguring npm to use local prefix"
mkdir ${HOME}/.npm-global
npm config set prefix "${HOME}/.npm-global"
export PATH=${HOME}/.npm-global/bin:$PATH
echo 'export PATH='${HOME}'/.npm-global/bin:$PATH' >> ${HOME}/.bashrc
echo "--- Installing gitbook and building docs"
cd ${HOME}/catkin_ws/src/clover
builder/assets/install_gitbook.sh
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 "--- 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
sudo systemctl enable roscore.service
echo "--- Installing QGroundControl"
sudo -E sh -c "usermod -a -G dialout $USER"
sudo -E sh -c 'apt-get remove -y modemmanager; apt-get install -y gstreamer1.0-plugins-bad gstreamer1.0-libav'
curl https://s3-us-west-2.amazonaws.com/qgroundcontrol/latest/QGroundControl.AppImage -o ${HOME}/QGroundControl.AppImage
chmod a+x ${HOME}/QGroundControl.AppImage
echo "--- Installing Firefox web browser"
sudo -E sh -c 'apt-get update; apt-get install -y firefox'
echo "--- Installing Monkey web server"
sudo apt-get install -y /tmp/packages/monkey_1.6.9-1_amd64.deb
sed "s/pi/${USER}/g" ${HOME}/catkin_ws/src/clover/builder/assets/monkey | sudo tee /etc/monkey/sites/default
sudo -E sh -c "sed -i 's/SymLink Off/SymLink On/' /etc/monkey/monkey.conf"
sudo cp ${HOME}/catkin_ws/src/clover/builder/assets/monkey.service /etc/systemd/system/monkey.service
sudo systemctl enable monkey
rosrun clover www # create directory to serve
echo "--- Installing additional packages"
sudo -E sh -c 'apt-get update; apt-get install -y sshfs gvfs-fuse gvfs-backends python3-opencv byobu ipython3 byobu nmap lsof tmux vim ros-noetic-usb-cam ros-noetic-rqt-multiplot ros-noetic-image-view'
echo "--- Personalizing VM"
sudo -E sh -c 'cp /usr/share/xfce4/backdrops/xubuntu-wallpaper.png /usr/share/xfce4/backdrops/xubuntu-wallpaper-old.png; cp ${HOME}/Pictures/Logo_COEX_2019_white_on_black.png /usr/share/xfce4/backdrops/xubuntu-wallpaper.png'
sudo -E sh -c 'hostnamectl set-hostname clover-dev; sed -i "s/ubuntu/clover-dev clover-dev.local/g" /etc/hosts'
echo "export ROS_HOSTNAME=\`hostname\`.local" >> ${HOME}/.bashrc
chmod a+x ${HOME}/Desktop/*
echo "--- Creating /etc/clover_vm_version"
sudo -E sh -c 'mv /tmp/clover_vm_version /etc/clover_vm_version'
cat /etc/clover_vm_version
echo "--- Cleaning up"
sudo -E sh -c 'apt-get -y autoremove; apt-get -y autoclean; apt-get -y clean; fstrim -v /'
echo "--- Validating"
# python --version # python-is-python3
python2 --version
python3 --version
# ipython --version
ipython3 --version
gazebo --version || true # FIXME: Gazebo exits with 255 on --version somehow
node -v
npm -v
byobu --version
git --version
vim --version
pip --version
pip3 --version
monkey --version
systemctl --version
roscore -h
rosversion px4
rosversion clover
rosversion aruco_pose
rosversion mavros
rosversion mavros_extras
rosversion ws281x
rosversion led_msgs
rosversion dynamic_reconfigure
rosversion tf2_web_republisher
# rosversion compressed_image_transport
# rosversion rosbridge_suite
rosversion cv_camera
rosversion web_video_server
rosversion nodelet
rosversion image_view
echo "--- Validating PX4 builds"
cd ~/PX4-Autopilot
make px4_sitl # regular sitl build
# sudo -E sh -c 'apt-get install -y gcc-arm-none-eabi'
# make px4_fmu-v4_default
make clean
echo "--- Run Clover's Python and shell tests"
source ~/catkin_ws/devel/setup.bash
export VM=1
$HOME/catkin_ws/src/clover/builder/test/tests.py
$HOME/catkin_ws/src/clover/builder/test/tests_py3.py
$HOME/catkin_ws/src/clover/builder/test/tests.sh
echo "--- Versions of all installed ROS packages"
set +x
rospack list-names | while read line; do echo $line `rosversion $line`; done
set -x
echo "--- Largest packages installed"
sudo -E sh -c 'apt-get install -y debian-goodies'
dpigs -H -n 30
echo "--- Trying running the Gazebo simulator, check the output"
timeout --preserve-status 30 roslaunch clover_simulation simulator.launch gui:=false --screen
echo "--- Trying running jMAVSim, check the output"
# cd ~/PX4-Autopilot
# HEADLESS=1 timeout --preserve-status 30 make px4_sitl jmavsim
HEADLESS=1 timeout --preserve-status 30 roslaunch clover_simulation simulator.launch type:=jmavsim gui:=false --screen