forked from xwavex/py-flex-assembly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathverify_demo.zsh
executable file
·116 lines (100 loc) · 3.69 KB
/
verify_demo.zsh
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/zsh
DIR_SCRIPT=$(dirname $0)
#TODO: setup correct gripper file
#GRIPPER_USB_DEVICE="/dev/ttyUSB0"
GRIPPER_USB_DEVICE="/dev/ttyUSB0"
#TODO: enter sunrise and fri ip addresses!
NETWORK_ADDRESSES=(172.31.1.10 192.170.10.2)
############## CHECK GRIPPER ########################################
echo -n "CHECK gripper device file $GRIPPER_USB_DEVICE..."
if ! [[ -e $GRIPPER_USB_DEVICE ]]; then
echo "FAIL"
echo "Gripper device file $GRIPPER_USB_DEVICE is not available!"
echo "Maybe the USB cable is not connected?"
exit 1
fi
if [[ -r $GRIPPER_USB_DEVICE && -w $GRIPPER_USB_DEVICE ]]; then
echo "OKAY"
else
echo "FAIL"
echo "Gripper device file is not read/write accessible."
echo "Please enter the sudo password to execute:"
echo "sudo chmod o+rw $GRIPPER_USB_DEVICE"
sudo chmod u+rw,g+rw,o+rw $GRIPPER_USB_DEVICE || exit 1
fi
echo
############## CHECK NETWORK #########################################
echo "CHECK network connections..."
for ADDRESS in $NETWORK_ADDRESSES
do
echo -n "CHECK $ADDRESS..."
ping -q -c 1 -W 1 $ADDRESS > /dev/null
if [ $? -gt 0 ]
then
echo "FAIL"
echo "$ADDRESS could not be reached!"
echo "Verify that all cables are connected to the correct ports!"
exit 1
else
echo "OKAY"
fi
done
echo
############## CHECK CAMERA ##########################################
echo -n "CHECK camera..."
${DIR_SCRIPT}/verify_realsense.py
CAM_AVAILABLE=$?
if [ $CAM_AVAILABLE -eq 0 ]; then
echo "OKAY"
else
echo "FAIL"
echo "Connection to the realsense camera could not be established."
echo "Please connect the USB cable and start again."
exit 1
fi
############## START TMUX SESSION #####################################
#attach() {
#if ! [ -n "${TMUX}" ]; then
#tmux attach-session -t ${SESSION_NAME}
#else
#tmux switch-client -t ${SESSION_NAME}
#fi
#}
##test if session is already running and if yes connect/switch to it
#tmux has-session -t ${SESSION_NAME}
#if [ $? = "0" ]; then
#attach
#exit 0
#fi
## create session
#tmux new-session -d -s ${SESSION_NAME} -c ${BASE_DIR}
## start roscore in window 0
#tmux new-window -d -t ${SESSION_NAME}:0 -n roscore -c ${BASE_DIR}
#tmux rename-window -t ${SESSION_NAME}:0 "roscore"
#tmux send-keys -t ${SESSION_NAME}:0 "source /opt/ros/noetic/setup.zsh" Enter
#tmux send-keys -t ${SESSION_NAME}:0 "roscore" Enter
## create window for gripper server
#tmux new-window -d -t ${SESSION_NAME}:1 -c ${BASE_DIR}
#tmux rename-window -t ${SESSION_NAME}:1 "gripper"
#tmux send-keys -t ${SESSION_NAME}:1 "source devel/setup.zsh" Enter
#tmux send-keys -t ${SESSION_NAME}:1 "$COMMAND_GRIPPER_SERVER" Enter
## create window for movement server
#tmux new-window -d -t ${SESSION_NAME}:2 -c ${BASE_DIR}
#tmux rename-window -t ${SESSION_NAME}:2 "movement"
#tmux send-keys -t ${SESSION_NAME}:2 "source devel/setup.zsh" Enter
#tmux send-keys -t ${SESSION_NAME}:2 "source /opt/xbot/setup.zsh" Enter
#tmux send-keys -t ${SESSION_NAME}:2 "$COMMAND_MOVEMENT_SERVER" Enter
## create window for vision
#tmux new-window -d -t ${SESSION_NAME}:3 -c ${BASE_DIR}
#tmux rename-window -t ${SESSION_NAME}:3 "vision"
#tmux send-keys -t ${SESSION_NAME}:3 "source devel/setup.zsh" Enter
#tmux send-keys -t ${SESSION_NAME}:3 "$COMMAND_VISION" Enter
## create window for gui control
#tmux new-window -d -t ${SESSION_NAME}:4 -c ${BASE_DIR}
#tmux rename-window -t ${SESSION_NAME}:4 "control_gui"
#tmux send-keys -t ${SESSION_NAME}:4 "source devel/setup.zsh" Enter
#tmux send-keys -t ${SESSION_NAME}:4 "$COMMAND_CONTROL_GUI" Enter
## setup control gui window as entry point
#tmux select-window -t ${SESSION_NAME}:4
## attach to session
#attach