-
Notifications
You must be signed in to change notification settings - Fork 1
/
make-pkg.sh
74 lines (52 loc) · 1.58 KB
/
make-pkg.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
#!/bin/bash
BASEDIR=${PWD}
echo "current folder [workspace folder will be created here]: $BASEDIR"
echo "Enter ROS Distro Name [e.g. foxy. default is foxy] :"
read ros_distro
echo "Enter Workspace Name [without _ws suffix] :"
read wsName
wsName+="_ws"
echo "workspace directory will be created as $wsName"
echo "Enter Package Name to be created inside the workspace :"
read pkgName
echo "package name : $pkgName"
echo "Enter Node Name to be created inside the workspace :"
read nodeName
echo "Node name : $nodeName"
prBuildType="ament_python"
echo "Enter programming language - python [default] or cpp:"
read prLanguage
echo "language name : $prLanguage"
if [ "$prLanguage" == "" ] || [ "$prLanguage" == "python" ] || [ "$prLanguage" == "Python" ]; then
prBuildType="ament_python"
else
prBuildType="ament_cmake"
fi
dirpath="${BASEDIR}"
echo "updated dirpath:: $dirpath"
dirpath+="/${wsName}/src"
#echo "basdir::$BASEDIR wsname::$wsName"
echo "following workspace folders will be created:$dirpath"
mkdir -p $dirpath
cd $wsName
echo "sourcing ROS environment..."
source /opt/ros/$ros_distro/setup.bash
cd src
pwd
echo "creating a package..."
echo "buildtype::$prBuildType pkgname::$pkgName"
if [ "$nodeName" != "" ]; then
ros2 pkg create --build-type $prBuildType --node-name $nodeName $pkgName --dependencies rclpy std_msgs
else
ros2 pkg create --build-type $prBuildType $pkgName --dependencies rclpy std_msgs
fi
cd $pkgName
pwd
mkdir launch
mkdir world
echo "changing back to workspace root folder::$wsName"
cd $dirpath
cd ..
pwd
echo "running colcon build..."
colcon build