Commit 2334d8fb authored by Pierre Bürki's avatar Pierre Bürki
Browse files

Update install scripts

parent c06f2996
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
#!/bin/bash

DIR=`dirname "$0"`
# Find the process of the tracker using the camera
PID=`pgrep the-hole`

# Kill tracker (have to kill the script and its children)
pkill -P $(cat "$DIR/pid")
# Kill tracker (15 = SIGTERM)
sudo kill -15 $PID

# Run calibrator
$DIR/../the-hole-calibrator
/home/encor/thehole/the-hole-calibrator
# Relaunch tracker
sleep 1
$DIR/startup.sh &

scripts/configure.sh

0 → 100644
+49 −0
Original line number Diff line number Diff line
# set startup.sh to launch on encor session open
mkdir -p ~/.config/autostart
cat << EOF > ~/.config/autostart/thehole.desktop
[Desktop Entry]
Name=The Hole
Type=Application
Exec=lxterminal -e "/home/encor/thehole/scripts/startup.sh"
Terminal=true
EOF

# Prevent auto-sleep
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

# Create user for calibration
sudo adduser --quiet --home /home/calib --shell /bin/bash calib << EOF
 
 





Y
EOF

sudo groupadd thehole
sudo adduser encor thehole
sudo adduser calib thehole
sudo adduser calib sudo

sudo chown -R encor:thehole ~encor/thehole

# Allow anyone in groupe thehole to kill each other's processes
echo "%thehole localhost=(%thehole) NOPASSWD:/bin/kill" | sudo EDITOR="tee -a" visudo

# install xRDP for remote control
# thanks to https://askubuntu.com/questions/580415/how-to-remote-desktop-from-windows-to-lubuntu
# for the black screen fix
apt install -y xrdp
# restore mouse and keyboard input for local session (https://c-nergy.be/blog/?p=13390)
apt install -y xserver-xorg-input-all
echo "lxsession -e LDXE -s Lubuntu" | sudo tee ~calib/.xsession > /dev/null


# Add desktop shortcut for calibration
sudo mkdir ~calib/Desktop
sudo cp scripts/Calibration\ tool ~calib/Desktop
sudo chown -R calib:calib ~calib/Desktop
sudo chmod a+x ~calib/Desktop/Calibration\ tool
+33 −0
Original line number Diff line number Diff line
#!/bin/bash

# install dependencies
apt -y install curl libglfw3{,-dev} libglew-dev libopencv-{core,imgproc,objdetect}-dev libfreeimage-dev libboost-filesystem-dev libpugixml-dev libopenni{,2}-dev
# remove automatically installed package -y
apt -y purge openni-utils -y

# install RealSense SDK 2.35
apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo bionic main" -u
apt-get -y install librealsense2-dev

# prepare to install Nuitrack
wget https://launchpad.net/~ubuntu-security/+archive/ubuntu/ppa/+build/15108504/+files/libpng12-0_1.2.54-1ubuntu1.1_amd64.deb -O libpng.deb
dpkg -i libpng.deb
rm libpng.deb

# fix logname error on Lubuntu 18.04
mv /usr/bin/logname{,bckp}
cat << EOF > /usr/bin/logname
#!/bin/bash
echo encor
EOF
chmod a+x /usr/bin/logname

# install Nuitrack
wget http://download.3divi.com/Nuitrack/platforms/nuitrack-ubuntu-amd64.deb -O nuitrack.deb
dpkg -i nuitrack.deb
rm nuitrack.deb

# restore actual logname program
mv /usr/bin/logname{bckp,}
+13 −54
Original line number Diff line number Diff line
#!/bin/bash

# This script assumes the OS to be Lubuntu 18.04.4 LTS
# and the user to be named "encor"

# install dependencies
apt -y install curl libglfw3{,-dev} libglew-dev libopencv-{core,imgproc,objdetect}-dev libfreeimage-dev libboost-filesystem-dev libpugixml-dev libopenni{,2}-dev
# remove automatically installed package -y
apt -y purge openni-utils -y

# install RealSense SDK 2.35
apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo bionic main" -u
apt-get -y install librealsense2-dev

# prepare to install Nuitrack
wget https://launchpad.net/~ubuntu-security/+archive/ubuntu/ppa/+build/15108504/+files/libpng12-0_1.2.54-1ubuntu1.1_amd64.deb -O libpng.deb
dpkg -i libpng.deb
rm libpng.deb

# fix logname error on Lubuntu 18.04
mv /usr/bin/logname{,bckp}
cat << EOF > /usr/bin/logname
#!/bin/bash
echo encor
EOF
chmod a+x /usr/bin/logname

# install Nuitrack
wget http://download.3divi.com/Nuitrack/platforms/nuitrack-ubuntu-amd64.deb -O nuitrack.deb
dpkg -i nuitrack.deb
rm nuitrack.deb

# restore actual logname program
mv /usr/bin/logname{bckp,}

# install xRDP for remote control
# thanks to https://askubuntu.com/questions/580415/how-to-remote-desktop-from-windows-to-lubuntu
# for the black screen fix
apt install -y xrdp
echo "lxsession -e LDXE -s Lubuntu" > ~/.xsession

# display the calibrator script on the desktop for ease of access
cp Calibration\ tool ~/Desktop

# set startup.sh to launch on session open
mkdir -p ~/.config/autostart
cat << EOF > ~/.config/autostart/thehole.desktop
[Desktop Entry]
Name=The Hole
Type=Application
Exec=lxterminal -e "/home/encor/Desktop/thehole/scripts/startup.sh"
Terminal=true
EOF

echo Setup terminé. Lancez startup.sh pour tester, ou bien redémarrez.
cd ~/thehole
chmod a+x the-hole* realsense-model scripts/*.sh

scripts/install_deps.sh
scripts/configure.sh

echo "You should run nuitrack_license_tool to activate a D415 camera on this computer if you intend to use it."
echo "Setup done. Run ~/thehole/scripts/startup.sh to test the tracker."
echo "Calibrate this station from the Windows PC by connecting to the following address :"
echo
ip addr show | grep 192
echo
echo "On next restart, this station will run autonomously."
+3 −3
Original line number Diff line number Diff line
@@ -2,9 +2,6 @@

DIR=`dirname $0`

# Save PID for interruptions due to calibration
echo $$ > $DIR/pid

MODEL=$($DIR/../realsense-model)
echo "Model : $MODEL"

@@ -17,6 +14,9 @@ else
	exit 1
fi

# Save PID for interruptions due to calibration
echo $$ > $DIR/pid

export LD_LIBRARY_PATH="/usr/local/lib/nuitrack"
until $DIR/../$COMMAND; do
	echo "Tracker crashed. Relaunching in 1 second"