Welcome to your second project.
This project will deal with creating your own launch files.
As you saw in the previous lecture.
Launch files help so that with one command we can automatically run all nodes we are interested in and
configure them with parameter values.
In the previous project, a few lectures back we created two nodes, one which publishes the RPM of
our robot and another which publishes the calculated speed of our robot based on that RPM value and
our robots wheel radius.
So now I want you to create a launch file so that with one command you can configure your parameter
such as the RPM value for the RPM publisher node and a wheel radius parameter for our speed calculator
node.
When launching them, then I want to be able to see the speed topic being published to the screen.
So I also want you to configure the launch file so it runs a ROS two topic echo terminal command to
print the values coming in from the speed topic.
So let's break down what this project structure will look like.
In this project, you will create a launch file that when run in terminal, will run your RPM publisher,
node and speed calculator node as well as set your wheel radius parameter for the speed calc node to
utilize.
This way with one single terminal command utilizing the launch file, we can run multiple nodes and
configure our parameter.
As always, remember when attempting this project to make sure you recompile your workspace when you
make changes, such as adding new launch files and ensure your terminal is source to your workspace.
With that, pause the video and give yourself about 10 minutes to give this project a go.
How'd it go?
I hope you are able to enjoy using just one terminal to launch the entire project rather than having
three terminal tabs open running different commands.
Let me show you one of the ways which you could have done it.
All right with VTS code Open.
The first thing I will do is create a new launch file.
I will go ahead and call mine Speed Project launch dot pie.
And I'll go ahead and copy the contents we made from our previous launch file.
Since we need to launch the RPM node, we can leave this node as is, but I will go ahead and copy it.
And add a second node to the launch description list.
This node will be our speed calc node so we can keep the package name the same, but we will change
the executable to speed pub py.
I'll also change the name of this node to speed pub node.
Great.
With that, I'm almost done now.
All I have to do is set my wheel radius parameter.
I can do this with the parameter argument which I set equal to a list of objects or better known in
python as dictionaries which contain the name of the parameters and its values.
In this case, the parameter I want to set is the wheel underscore radius, and I'll just set it 2.5
to show that the value I set in the launch file will overtake the default value we set in our speed
node.
Note that you cannot set a parameter value in the launch file unless you have declared the parameter
within your code.
But all right.
With that, this is all I need to launch the entire Speed Calc project in one command, so I'll go ahead
and save the file and go to terminal run build task to recompile our workspace.
Since we created a new launch file.
All right.
So that's gone ahead successfully.
Now, go ahead and open up my terminal, and then I'll go ahead and source my setup file and run this
new speed project file.
Here we can see printed to the screen that our two nodes have indeed been launched.
We can double check this by opening a new terminal tab.
And running the Ross to Node list command.
And here we can see our two nodes are running.
We can even subscribe to our speed topic for a good measure.
And we see it's running.
Now let's double check that our parameter for our speed node was properly set, so I can use the RAA
two parameter list command.
And here we see under the speed node, the wheel radius parameter, which I can get with raw super ram
get.
And here we see the value is 0.5, which is what we set in our launch file, which supersedes the default
value, which should be 0.125.
All right.
With that, congratulations on completing another roster project.
You've successfully created a launch file that launches multiple nodes and initializes our parameter
values all within one command in one terminal.
So it really helps minimize the workload that we have to do manually in other terminals.
All right.
Congratulations on completing another raw soup project.
You have successfully created a launch file that launches multiple nodes, initializes parameter values,
and can execute various commands all within a single terminal command.