1
00:00:00,600 --> 00:00:02,550
Welcome to your second project.

2
00:00:02,580 --> 00:00:06,180
This project will deal with creating your own launch files.

3
00:00:06,390 --> 00:00:07,830
As you saw in the previous lecture.

4
00:00:07,860 --> 00:00:13,860
Launch files help so that with one command we can automatically run all nodes we are interested in and

5
00:00:13,860 --> 00:00:16,140
configure them with parameter values.

6
00:00:16,650 --> 00:00:22,380
In the previous project, a few lectures back we created two nodes, one which publishes the RPM of

7
00:00:22,380 --> 00:00:28,530
our robot and another which publishes the calculated speed of our robot based on that RPM value and

8
00:00:28,530 --> 00:00:30,300
our robots wheel radius.

9
00:00:30,630 --> 00:00:36,180
So now I want you to create a launch file so that with one command you can configure your parameter

10
00:00:36,180 --> 00:00:42,540
such as the RPM value for the RPM publisher node and a wheel radius parameter for our speed calculator

11
00:00:42,540 --> 00:00:42,810
node.

12
00:00:42,810 --> 00:00:48,420
When launching them, then I want to be able to see the speed topic being published to the screen.

13
00:00:48,420 --> 00:00:55,200
So I also want you to configure the launch file so it runs a ROS two topic echo terminal command to

14
00:00:55,200 --> 00:00:58,290
print the values coming in from the speed topic.

15
00:00:58,950 --> 00:01:02,250
So let's break down what this project structure will look like.

16
00:01:02,820 --> 00:01:08,460
In this project, you will create a launch file that when run in terminal, will run your RPM publisher,

17
00:01:08,460 --> 00:01:14,850
node and speed calculator node as well as set your wheel radius parameter for the speed calc node to

18
00:01:14,850 --> 00:01:15,750
utilize.

19
00:01:15,900 --> 00:01:21,750
This way with one single terminal command utilizing the launch file, we can run multiple nodes and

20
00:01:21,750 --> 00:01:23,250
configure our parameter.

21
00:01:24,780 --> 00:01:30,090
As always, remember when attempting this project to make sure you recompile your workspace when you

22
00:01:30,090 --> 00:01:36,750
make changes, such as adding new launch files and ensure your terminal is source to your workspace.

23
00:01:37,620 --> 00:01:42,390
With that, pause the video and give yourself about 10 minutes to give this project a go.

24
00:01:47,720 --> 00:01:48,530
How'd it go?

25
00:01:48,650 --> 00:01:54,050
I hope you are able to enjoy using just one terminal to launch the entire project rather than having

26
00:01:54,050 --> 00:01:56,900
three terminal tabs open running different commands.

27
00:01:57,080 --> 00:01:59,420
Let me show you one of the ways which you could have done it.

28
00:02:00,900 --> 00:02:02,450
All right with VTS code Open.

29
00:02:02,460 --> 00:02:05,880
The first thing I will do is create a new launch file.

30
00:02:06,210 --> 00:02:10,930
I will go ahead and call mine Speed Project launch dot pie.

31
00:02:12,570 --> 00:02:16,860
And I'll go ahead and copy the contents we made from our previous launch file.

32
00:02:19,370 --> 00:02:25,460
Since we need to launch the RPM node, we can leave this node as is, but I will go ahead and copy it.

33
00:02:26,830 --> 00:02:29,620
And add a second node to the launch description list.

34
00:02:29,620 --> 00:02:34,630
This node will be our speed calc node so we can keep the package name the same, but we will change

35
00:02:34,630 --> 00:02:37,740
the executable to speed pub py.

36
00:02:37,780 --> 00:02:40,870
I'll also change the name of this node to speed pub node.

37
00:02:40,960 --> 00:02:41,410
Great.

38
00:02:41,410 --> 00:02:43,270
With that, I'm almost done now.

39
00:02:43,270 --> 00:02:46,310
All I have to do is set my wheel radius parameter.

40
00:02:46,330 --> 00:02:51,670
I can do this with the parameter argument which I set equal to a list of objects or better known in

41
00:02:51,670 --> 00:02:57,020
python as dictionaries which contain the name of the parameters and its values.

42
00:02:57,040 --> 00:03:02,230
In this case, the parameter I want to set is the wheel underscore radius, and I'll just set it 2.5

43
00:03:02,230 --> 00:03:07,120
to show that the value I set in the launch file will overtake the default value we set in our speed

44
00:03:07,390 --> 00:03:07,960
node.

45
00:03:07,990 --> 00:03:12,430
Note that you cannot set a parameter value in the launch file unless you have declared the parameter

46
00:03:12,430 --> 00:03:13,570
within your code.

47
00:03:13,570 --> 00:03:14,350
But all right.

48
00:03:14,350 --> 00:03:19,360
With that, this is all I need to launch the entire Speed Calc project in one command, so I'll go ahead

49
00:03:19,360 --> 00:03:25,600
and save the file and go to terminal run build task to recompile our workspace.

50
00:03:25,600 --> 00:03:27,910
Since we created a new launch file.

51
00:03:29,350 --> 00:03:29,560
All right.

52
00:03:29,560 --> 00:03:31,420
So that's gone ahead successfully.

53
00:03:31,740 --> 00:03:39,940
Now, go ahead and open up my terminal, and then I'll go ahead and source my setup file and run this

54
00:03:39,940 --> 00:03:42,550
new speed project file.

55
00:03:43,780 --> 00:03:48,100
Here we can see printed to the screen that our two nodes have indeed been launched.

56
00:03:48,130 --> 00:03:51,310
We can double check this by opening a new terminal tab.

57
00:03:52,070 --> 00:03:54,860
And running the Ross to Node list command.

58
00:03:55,430 --> 00:03:57,610
And here we can see our two nodes are running.

59
00:03:57,620 --> 00:04:01,310
We can even subscribe to our speed topic for a good measure.

60
00:04:03,080 --> 00:04:04,250
And we see it's running.

61
00:04:04,790 --> 00:04:09,140
Now let's double check that our parameter for our speed node was properly set, so I can use the RAA

62
00:04:09,140 --> 00:04:10,630
two parameter list command.

63
00:04:10,640 --> 00:04:16,250
And here we see under the speed node, the wheel radius parameter, which I can get with raw super ram

64
00:04:16,250 --> 00:04:16,700
get.

65
00:04:18,080 --> 00:04:25,550
And here we see the value is 0.5, which is what we set in our launch file, which supersedes the default

66
00:04:25,550 --> 00:04:28,910
value, which should be 0.125.

67
00:04:29,590 --> 00:04:29,860
All right.

68
00:04:29,860 --> 00:04:33,270
With that, congratulations on completing another roster project.

69
00:04:33,280 --> 00:04:38,620
You've successfully created a launch file that launches multiple nodes and initializes our parameter

70
00:04:38,620 --> 00:04:41,830
values all within one command in one terminal.

71
00:04:41,830 --> 00:04:46,510
So it really helps minimize the workload that we have to do manually in other terminals.

72
00:04:48,390 --> 00:04:48,810
All right.

73
00:04:48,810 --> 00:04:52,010
Congratulations on completing another raw soup project.

74
00:04:52,020 --> 00:04:58,260
You have successfully created a launch file that launches multiple nodes, initializes parameter values,

75
00:04:58,260 --> 00:05:03,270
and can execute various commands all within a single terminal command.
