This repository has been archived by the owner on Jan 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·51 lines (49 loc) · 1.66 KB
/
start.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
# Checks for UV4L installation and runs it with predifined settings
function camera() {
PKG_OK=$(dpkg-query -W --showformat='${Status}\n' uv4l|grep "install ok installed")
if [ "" == "$PKG_OK" ]; then
echo "No UV4L installation found. Try running installation script"
exit 1
fi
echo "Installation OK. Startin camera"
killall uv4l
uv4l --driver raspicam --vflip --hflip --auto-video_nr --object-detection --min-object-size 80 80 --main-classifier /usr/share/uv4l/raspicam/lbpcascade_frontalface.xml --object-detection-mode accurate_detection --width 640 --height 360 --framerate 15 --encoding h264 --quality 5 --enable-server
killall uv4l
uv4l --driver raspicam --vflip --hflip --auto-video_nr --object-detection --min-object-size 80 80 --main-classifier /usr/share/uv4l/raspicam/lbpcascade_frontalface.xml --object-detection-mode accurate_detection --width 640 --height 360 --framerate 15 --encoding h264 --quality 5 --enable-server
echo "Camera initialized"
}
# Checks for NodeJS installation and Rover folder and runs it with the PM2 package
function rover() {
PKG_OK=$(dpkg-query -W --showformat='${Status}\n' nodejs|grep "install ok installed")
if [ "" == "$PKG_OK" ]; then
echo "No NodeJS installation found. Try running installation script"
exit 1
fi
RVR_OK=$(cd ../Rover/)
if [ "" == "$RVR_OK" ]; then
cd ~/rover
echo "Startin Rover..."
git pull
npm run init
npm
pm2 start index.js
else
echo "Rover not properly installed. Try running installation script"
exit 1
fi
}
# Choice between all, rover or camera
case "$1" in
all)
rover
camera
;;
rover)
rover
;;
camera)
camera
;;
*)
echo $"Usage: $0 {all|rover|camera}"
esac