1

00:00:05,700  -->  00:00:15,420
now we will create a ros package our first customized Ros package
now what is a Ros package? Ros package is

2

00:00:15,420  -->  00:00:22,740
an organized unit that will contain your code
if you want your code to be installed and you

3

00:00:22,740  -->  00:00:31,200
want to utilize it execute it then you need to
specify in organize manner in inside of package

4

00:00:31,200  -->  00:00:39,420
we previously have one package in our SRC we will
delete it we downloaded that package and now we

5

00:00:39,420  -->  00:00:46,920
are going to create our own package so here is a
package structure the package contains cmake list

6

00:00:47,520  -->  00:00:55,560
and include a slash package and package.xml and
SRC and the loss package can have one of the two

7

00:00:55,560  -->  00:01:03,780
build type it can be either ament python or ament
C make so we are going to use the cmake build

8

00:01:03,780  -->  00:01:10,200
type we are not going to use the python and
where we need to use this cmake because we want

9

00:01:11,040  -->  00:01:16,440
C plus plus nodes in our package if we if
you want to use python in our package we

10

00:01:16,440  -->  00:01:21,720
will consider the python build but
now we are going to use the cmake as

11

00:01:21,720  -->  00:01:28,200
the robot that we are going to make will
be using a lot of C plus plus nodes okay

12

00:01:31,380  -->  00:01:37,860
C make list dot txt that file will be
describing that how to build the code

13

00:01:37,860  -->  00:01:45,600
inside the package and there will be include and
slash package name this will be containing the

14

00:01:45,600  -->  00:01:53,100
header files and the package.xml will be
meta information about the package and the

15

00:01:53,100  -->  00:02:00,780
SRC will be containing our source code
and in the main workspace there can be

16

00:02:01,440  -->  00:02:10,020
several packages inside the SRC as you can see it
in the SRC folder there are C plus plus package

17

00:02:10,020  -->  00:02:15,840
 package and C plus plus n package
so they can be there is no limit but remember

18

00:02:17,040  -->  00:02:27,000
one package cannot be nested it means it cannot be
dependent on the ament cmake or ament python it cannot

19

00:02:27,000  -->  00:02:34,620
be dependent on the both build types okay let's
create our package I will go inside the ros2

20

00:02:34,620  -->  00:02:43,860
workspace SRC hit enter and here is the command to
create your own customized package ros2 package

21

00:02:43,860  -->  00:02:50,760
create minus minus build Type ament cmake and
then the package name but there is an optional

22

00:02:50,760  -->  00:02:57,060
argument as well that will be creating our node
consider this command ros2 package create

23

00:02:57,060  -->  00:03:04,620
minus minus build Type ament cmake and then the
node name this is the Node name and then this is

24

00:03:04,620  -->  00:03:12,600
the package we will configure this command Okay
copy that and paste it here so what we are going

25

00:03:12,600  -->  00:03:20,580
to name our package and this is going to be the
turtlesimbot the node should be like a mynode

26

00:03:20,580  -->  00:03:29,160
it's fine and we will hit enter and there we go it
has created this package right here Turtlesimbot

27

00:03:29,160  -->  00:03:35,940
and this is going to be our package on which we
will be working on and if you want to build this

28

00:03:35,940  -->  00:03:42,420
package then we will have to use colcon build or
colcon build minus minus symlink install

29

00:03:42,420  -->  00:03:50,280
if we use this command this will be building all
the packages that are residing inside the SRC

30

00:03:50,280  -->  00:03:56,820
currently we have one but if we have multiple
packages in our workspace and we want to just

31

00:03:56,820  -->  00:04:04,200
build one then there is also a command exists and
the this command name colcon build minus minus

32

00:04:04,200  -->  00:04:19,560
package Select and my package can go back and
colcon build minus minus SymLink minus install

33

00:04:24,000  -->  00:04:30,900
okay it is installed source
and so on setup dot Bash

34

00:04:34,440  -->  00:04:42,480
ros2  run Turtlesimbot and then
there was a node that was my node

35

00:04:43,140  -->  00:04:50,280
 hit enter and there you can see Hello
World Turtle Sim bot package so the Node

36

00:04:50,280  -->  00:04:57,240
has printed this line it means our Node is
working and if we open up this there are some

37

00:04:57,240  -->  00:05:03,960
bdirectories include that will contain header
files currently does not have any and inside or

38

00:05:03,960  -->  00:05:14,760
SRC it is our node and these are the cmake list
and package.xml no if we want to open up these

39

00:05:15,300  -->  00:05:24,000
files we will need an editor so I recommend you
to go to your Ubuntu store and download vs code

40

00:05:24,000  -->  00:05:32,940
that is a lot helpful if you want to use it with
ros uh code there will be some here here

41

00:05:33,720  -->  00:05:40,020
okay this is the code that you will install from
here there will be an option in my case this is

42

00:05:40,020  -->  00:05:47,160
already installed if I want to open this package
completely with the vs code what will I do I will

43

00:05:47,880  -->  00:05:56,220
click right opening terminal
and code space Dot okay

44

00:05:58,260  -->  00:06:05,820
so it has opened the folder this is
our folder so I will just open here

45

00:06:06,780  -->  00:06:11,700
and then there will be some recommendations
to you here that if you want to install

46

00:06:11,700  -->  00:06:16,080
your Ros extension then you will
come here to the extension and

47

00:06:17,700  -->  00:06:24,240
type ros there is the extension that you need to install you
will go here and in my case this is already

48

00:06:24,240  -->  00:06:29,220
installed but you will be seeing an option
here install and I will come to the files

49

00:06:32,700  -->  00:06:39,720
okay so here is the SRC and my node
and here it is a small C plus plus

50

00:06:39,720  -->  00:06:47,160
node that is just printing this and
whenever I try to run the node
