-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcandybot_vr.sh
executable file
·73 lines (56 loc) · 1.93 KB
/
candybot_vr.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
#script for running candybot_vr docker container with candybot_v2 ROS package
# commands:
#
# run_package [-d] - run candybot_v2 ROS package, -d - as daemon
#
# run_roscore [-d] - run roscore in container, -d - as daemon
#
# attach - attach to running candybot_vr container
#
# commit - commit last runned candybot_vr container
#
# run_node [-d] <node_name> - run candybot_v2 ROS package node, -d - as daemon
#
# update_package - update candybot_v2 package from github repository
ROS_PACKAGE_NAME="candybot_v2"
DOCKER_IMAGE_NAME="candybot_gui"
function run_package(){
key="-ti"
if [ "$1" == "-d" ]
then
key="-d"
fi
sudo docker run "$key" -p 11311:11311 -p 9090:9090 -w="/root/catkin_ws" --privileged --device /dev:/dev "$DOCKER_IMAGE_NAME" /bin/bash -c "source /opt/ros/kinetic/setup.bash; roslaunch $ROS_PACKAGE_NAME run.launch"
}
function run_roscore(){
key="-ti"
if [ "$1" == "-d" ]
then
key="-d"
fi
sudo docker run "$key" -p 11311:11311 -p 9090:9090 -w="/root/catkin_ws" --privileged --device /dev:/dev "$DOCKER_IMAGE_NAME" /bin/bash -c "source /opt/ros/kinetic/setup.bash; roscore"
}
case $1 in
"enter_package" )
sudo docker run -ti -p 11311:11311 -p 9090:9090 -w="/root/catkin_ws" --privileged --device /dev:/dev "$DOCKER_IMAGE_NAME"
;;
"run_package" )
run_package $2
;;
"run_roscore" )
run_roscore $2
;;
"attach" )
sudo docker exec -ti $(sudo docker ps -lq --filter "ancestor=$DOCKER_IMAGE_NAME") /bin/bash
;;
"commit" )
sudo docker commit $(sudo docker ps -lq --filter "ancestor=$DOCKER_IMAGE_NAME") "$DOCKER_IMAGE_NAME"
;;
"run_node" )
sudo docker run -w="/root/catkin_ws" -ti -p 11311:11311 -p 9090:9090 --privileged --device /dev:/dev "$DOCKER_IMAGE_NAME" /bin/bash -c "source /opt/ros/kinetic/setup.bash; roslaunch $ROS_PACKAGE_NAME $2.launch"
;;
*)
sudo docker run -w="/root/catkin_ws" -ti -p 11311:11311 -p 9090:9090 --privileged --device /dev:/dev "$DOCKER_IMAGE_NAME" /bin/bash -c "$1"
;;
esac