-
Notifications
You must be signed in to change notification settings - Fork 0
/
snode.bash
82 lines (72 loc) · 1.59 KB
/
snode.bash
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
#!/bin/bash
run_gazebo() {
export TURTLEBOT3_MODEL=burger
roslaunch turtlebot3_gazebo turtlebot3_world.launch
}
run_rviz() {
export TURTLEBOT3_MODEL=burger
roslaunch turtlebot3_gazebo turtlebot3_gazebo_rviz.launch
}
maybe_run_builtin_pkg() {
if [ $1 == "gazebo" ]; then
run_gazebo
return
fi
if [ $1 == "rviz" ]; then
run_rviz
return
fi
echo "Illegal ros package and node"
}
get_package() {
pkg=""
if [ $1 == "s" ]; then
pkg="sensors"
elif [ $1 == "k" ]; then
pkg="kinematics"
elif [ $1 == "p" ]; then
pkg="perception"
fi
}
get_file() {
file=""
if [ $1 == "m" ]; then
file="measurement.py"
elif [ $1 == "p" ]; then
file="processing.py"
elif [ $1 == "v" ]; then
file="view.py"
elif [ $1 == "r" ]; then
file="record.py"
elif [ $1 == "a" ]; then
file="diffaction.py"
elif [ $1 == "mc" ]; then
file="movement_control.py"
elif [ $1 == "dg" ]; then
file="dummy_gazebo.py"
elif [ $1 == "ld" ]; then
file="line_detection.py"
fi
}
maybe_run_custom_pkg() {
get_package $1
get_file $2
if [ "$pkg" != "" ] && [ "$file" != "" ]; then
source devel/setup.bash
rosrun $pkg $file
else
echo "Illegal ros package and node"
fi
}
check_params_and_run() {
if [ "$#" == 1 ]; then
maybe_run_builtin_pkg $@
return
fi
if [ "$#" == 2 ]; then
maybe_run_custom_pkg $@
return
fi
echo "Illegal number of parameters"
}
check_params_and_run $@