-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart_server.sh
executable file
·46 lines (36 loc) · 1.88 KB
/
start_server.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
#!/bin/bash
SESSION="server" # So we can reference $SESSION later
SERVERNAME="/controlServer" # Name of the yarp server for controlling the robot
CURRENT_DIR=$(pwd)
# Options
CONFIG="$CURRENT_DIR/config/ergocub_gazebo_sim.ini"
PORT="/ergocubSim"
URDF="$CURRENT_DIR/../robotology-superbuild/src/ergocub-software/urdf/ergoCub/robots/ergoCubGazeboV1/model.urdf"
WORLD="$CURRENT_DIR/gazebo/worlds/ergocub_test.sdf"
# Create first window & panel
tmux new-session -d -s $SESSION # Start new session with given name
tmux rename-window -t 0 'Server' # Give a name to this window
# Divide up the screen (default pane 0)
#######################################
# # #
# # 1 #
# # #
# 0 ####################
# # #
# # 2 #
# # #
#######################################
# Split Pane 1 to the right, run YARP
tmux split-window -h
tmux send-keys -t $SESSION "yarpserver --write" Enter
# Split Pane 2, launch Gazebo
if pidof -x "gzserver" >/dev/null; then
killall -9 gzserver
fi
tmux split-window -v
tmux send-keys -t $SESSION "gazebo $WORLD" Enter
# Select Pane 0, launch the yarp server
tmux select-pane -t 0
tmux send-keys -t $SESSION "sleep 4" Enter # Wait for Gazebo to launch
tmux send-keys -t $SESSION "$CURRENT_DIR/build/command_server $SERVERNAME $PORT $URDF $CONFIG" Enter
tmux attach-session -t $SESSION:0 # REQUIRED or the above won't execute