So we have discussed about workspace and the package.
It is a very basic thing and I assume that you understand it deeply through any Wikipedia page of Ross
or any course that you have taken.
I'm not going into deep detail how that works.
We are just going to create workspace and package in it.
So let's write the commands and I want you to be very comfortable with these commands by practice and
let's start.
So we are currently in our home folder and I'm going to create a directory.
Within argument minus V because we need a subdirectory as well.
The workspace name is going to be part planning workspace and a subdirectory inside of this workspace
is going to be source just for now.
Then we will move into this workspace and the source.
Packages are going to be created in this for sauce for you too.
So let's create a package.
I have written the command here.
We have it across to package create.
Then the name of the package will type by type dependencies are sealed by any standard messages.
Let me added just this command is hard to memorize.
So I have written it in your repository and it will be very easy for you and for me it's but so let's
created in the source folder package has been created and let's say the workspace call you can build.
I'm not going to create Simulink.
We are just going to create a simple called can build that will copy all the files into the shareholders.
So package has been created and workspace has been built.
So far things are working fine if there is an error with the call confining.
You can cancel the wiki page that I have opened here for you.
Docs not rostered or do foxy tutorials and they are in depth about all of these things.
What I am going to do is create.
A note of publisher subscriber to Tester workspace and package.
Okay, so let's open the folder that we just created.
That was part planning workspace, but planning workspace and the source folder, the maze board.
Let's add it into our voice code so our life becomes very easy as it also gives us the capability of
file managing.
Here we have baseboard resources and other stuff and I assume that you know all about this stuff through
my previous course or through Ros Vicky you can understand them.
They are very easy, by the way.
Or if you are not compatible, you will get after this course at the end of this course.
Now let's create a folder named as source folder or know its roster.
So we have this.
Ms. but we have to write all Python related scripts inside of it, so it works like a Python package.
What I am interested in is creating a publisher and subscriber to get started with What is this publisher?
Note I'm going to copy the code here and you can run the Gate Command as well to obtain the file, but
I will write the command.
Okay, let's create a new file.
I think its name was Docker Dot by.
Base the game on.
Was it a talker?
Yes, it's a publisher, so it would be a target.
And the next file is going to be a subscriber.
Where is the code?
Here is it.
I'm going.
Do not perform the second option.
And let's open up the terminal control P to bring in this command pilot terminal or sorry, we have
to press control shift B to bring the action panic dominant.
Um.
Create a terminal.
It is in the maze, Bart.
We have to bring it into another named Mes.
But name folder inside of this means to me is what?
If we list it, you can see we have the talker by and by these two, four years, I am going to be stuck
on the blue grid and it is going to download the file subscriber member function.
I'm going to rename it to be less net.
Okay.
I think the spellings are wrong, but I don't get.
We have two files, and what we need to do now is to build the package.
What executables of Python does this package needs to create?
That thing is going to be happening in the set of five.
I'm doing it fast because I want you to get started with the maze.
Solving this is just basics, but I am giving you a refresher for that and I'm going to just copy and
paste the commands from the wiki so you can get a deeper understanding from this wiki, not this lecture.
And this is the process of adding entry point into your python based package so your package can understand
what executable files to show to the ROS system and produce name is going to be Docker.
I'm going to add it to be Docker node.
This is the name that we will use to call this executable.
The name of our package is Baseboard Board.
So here we have the Mays bought.
Package name, publisher, member function and the file name which is Docker Anarchy.
So I am going to copy and paste Docker.
Docker, just docker, not the BI.
So I'm going to copy and paste it again because we have a subscriber as well.
I just need to confirm one thing.
Okay.
The name is going to be subscriber?
No.
And.
The name of the file is Listener.
The basic syntax is you give the name of the package, you give the name of the code containing file
the script.
And what function do we need to call when we run your main function?
In both of these files, we have this main function which we are calling now in setup goodbye file.
These names are actually the names we will be using to call these functions, to call these files.
So everything is fine.
Let's perform calls.
So these files get copied into the shared food.
Now let's run it across to run and the name of the files word listener dot by and they are not available.
The reason that I wanted to bring you here was we have to source our package with this source install.
In store develop.
Uh.
What was it installed?
Set up.
Bash.
What is happening here?
Let me show you.
So we have our package here.
Part planning workspace in which we have these folders automatically created.
We created just the source folder.
But to make this workspace available to all of the ROS installation in this system or a virtual environment,
we need to source a file of this workspace and that is this setup dot bash file.
So I am writing this command inside of this folder, which is what folder?
Go inside of the install folder and source this file.
Let's source it.
It has been source.
Okay.
Now we need to run those nodes that we created for us to run.
And the name of the package is the name of the package was RMS bought previously?
If I would have written me as but it should not appear.
And I give you an example of listener directly.
First, we need to write the name of the package and then name of the nodes.
I'm double pressing the tab button.
It is providing me all of the available options.
So subscriber node and let's run it.
There will be no output for one reason there is no listener.
So let's open up a new terminal.
And then.
Execute the same thing.
Me?
What I'm pressing, Gavin, is not completing.
And the reason is, whenever you open up a new terminal, you need to source the workspace you want
to access.
I know it is dieting, but I have a solution for that and.
I'll show you the solution after this video.
Ross to run maze pressing tap, I press step to confirm that it is automatically picking up the names
Maze Board and the name of the file was Docker dot by right.
If I now press enter and see the output of the subscriber, you can see both of these things are communicating
with each other that how do I know that?
Let's confirm it.
With the help of our cute graph, which is the last thing that gives us information about nodes communicating
with each other.
Okay, you just need to write it up.
No, Ross, do it on all.
Although you get so minimum publisher is publishing and subscriber is subscribing on the name of the
topic is topic.
Let's take a look on the code now.
So we have these two things.
If I try to enlarge it now, they are fine.
If I delete the command and see it in one video.
In one window.
This is the docket the talker is publishing on this topic.
And then messages are sent into the buffer.
The data type, as this time period is 0.00.5, meaning every second two packets are sent.
The data is of string data type and this is going to be stored in the data and then it is going to be
published and printed on this dominant on which this talk is coming to the next site whenever we run
the subscriber.
In an object oriented way.
It has created a subscriber.
And whenever the subscriber on this specific topic obtains any information, it is going to be calling
this function.
Listener callback.
The listener callback is just printing what it has received from.
I heard the this string and message data.
So it is giving information.
This publisher is giving information.
Hello, world two, two, two.
And this subscriber is getting information.
I heard.
Hello World.
So this was the basic publisher subscriber and our workspace and package is set.
Now we need to move towards making of the report and I am assuming that you have basic understanding
of ROS workflow.