1
00:00:00,930 --> 00:00:05,550
In this lecture, we are going to take a break from coding and go over Ross bag files.

2
00:00:05,760 --> 00:00:10,860
Bag files are used to record data coming in over Ross so that you can play it back at a later time.

3
00:00:11,010 --> 00:00:15,960
Bank files are incredibly useful when it comes to robots, which are difficult to deploy and test,

4
00:00:15,960 --> 00:00:20,730
as well as review how your developed robot code responded to certain situations.

5
00:00:21,090 --> 00:00:26,310
We're going to first go ahead and create our own bank file and then the resources section.

6
00:00:26,310 --> 00:00:31,920
I will also have available a bank file from an autonomous surface vehicle I worked on a while back so

7
00:00:31,920 --> 00:00:36,000
you can see data from a real robot play back as it did when we deployed it.

8
00:00:37,510 --> 00:00:39,400
So far back file we are going to create.

9
00:00:39,400 --> 00:00:44,590
We're just going to record information from the nodes we created in the previous sections project where

10
00:00:44,590 --> 00:00:50,500
we created in RPM and Speed Publisher Node, which had values we could change via parameters.

11
00:00:50,800 --> 00:00:52,270
So I can go ahead and open up.

12
00:00:52,270 --> 00:00:54,490
VISCO just to remind you of what this looked like.

13
00:00:56,100 --> 00:01:01,650
So in this launch file, I ran two different nodes our RPM, pub node and our speed pub node, and we

14
00:01:01,650 --> 00:01:05,010
can change parameters such as the wheel radius.

15
00:01:05,370 --> 00:01:12,600
So I'll go ahead and open up a terminal, change into my workspace directory, source it and launch

16
00:01:12,600 --> 00:01:13,380
the project.

17
00:01:16,800 --> 00:01:22,890
Now I'm going to open a new terminal tab and double check that our code is running properly by listing

18
00:01:22,890 --> 00:01:29,040
our topics and we can see them there and we can check that it's publishing using the RAS two topic Echo

19
00:01:29,040 --> 00:01:29,460
Command.

20
00:01:32,810 --> 00:01:35,900
All right, So our publishers are running, so let's open a new terminal.

21
00:01:36,740 --> 00:01:38,930
Where we will record our bank file.

22
00:01:40,010 --> 00:01:43,790
To record the bank file, we're going to use the Ross to bag record command.

23
00:01:44,060 --> 00:01:50,090
You can see what type of options we have with the ROS commands on the corresponding ROS index page.

24
00:01:50,420 --> 00:01:56,060
We'll discuss packages and the ROS index page in the upcoming lecture, but for now we're just going

25
00:01:56,060 --> 00:01:59,540
to quickly go through some of these Ros to bag commands.

26
00:01:59,570 --> 00:02:04,180
For now, I'm going to use the dash a flag to record all topics.

27
00:02:04,190 --> 00:02:08,200
If we only wanted to record certain topics we would type them out instead.

28
00:02:08,210 --> 00:02:12,440
So for example, slash speed or slash RPM.

29
00:02:13,190 --> 00:02:15,970
But again, for now I'm just going to use the dash a flag.

30
00:02:15,980 --> 00:02:22,970
Then I'm going to use the dash o flag to specify the output name, which in this case I'll set to test

31
00:02:22,970 --> 00:02:29,330
dot bag because if not, the default name will be the current date and time stamp.

32
00:02:29,690 --> 00:02:33,050
Note that it will save the bag in our current terminal directory.

33
00:02:33,050 --> 00:02:37,790
So in this case I'm actually within our ROS to py workspace directory.

34
00:02:37,970 --> 00:02:44,150
I'm actually going to quickly go ahead and change into our home directory and I'm going to go ahead

35
00:02:44,150 --> 00:02:45,470
and hit enter.

36
00:02:46,320 --> 00:02:50,430
So you'll see it begin subscribing to all of the different topics.

37
00:02:50,430 --> 00:02:54,860
Let's create some variety in our bag file by changing our wheel size parameter.

38
00:02:54,870 --> 00:02:58,530
So I'm going to go open up a another terminal tab.

39
00:03:00,030 --> 00:03:03,540
And run Ra Super am set to change our wheel radius side.

40
00:03:08,790 --> 00:03:11,870
Oh, and make sure to set it to a double instead of an integer.

41
00:03:12,260 --> 00:03:17,660
So we set the parameter successfully and we see that it's gone ahead and changed here in our file,

42
00:03:17,660 --> 00:03:21,440
and we could go ahead and change that one more time just to add some more variety.

43
00:03:22,590 --> 00:03:24,270
And we see it change again.

44
00:03:24,270 --> 00:03:27,390
So I'm going to go ahead and stop this bag file by hitting control C.

45
00:03:28,410 --> 00:03:34,860
And we can go ahead and stop these other terminals from running the launch file and echoing the topic

46
00:03:34,860 --> 00:03:35,730
information.

47
00:03:35,760 --> 00:03:37,350
So let's go ahead and clear this up.

48
00:03:37,350 --> 00:03:39,390
So go ahead and clear the screens.

49
00:03:43,230 --> 00:03:45,740
And I'll go ahead and close these first two terminals.

50
00:03:46,070 --> 00:03:48,140
So now if we go into our home directory.

51
00:03:48,830 --> 00:03:56,330
We can see this test bag folder and if we open it up, it has two files in it metadata, a L and a DB

52
00:03:56,330 --> 00:04:00,050
three file, which is an SQLite version of what a saving are.

53
00:04:00,050 --> 00:04:01,280
Ros data.

54
00:04:02,150 --> 00:04:08,510
So to find more information about what's in this bag, we can use the Ross to bag info command on that

55
00:04:08,510 --> 00:04:09,200
bag file.

56
00:04:10,930 --> 00:04:14,210
And here we can see things such as the bag size.

57
00:04:14,230 --> 00:04:16,780
We can see the storage type is sky three.

58
00:04:16,780 --> 00:04:18,730
The duration of the bag file.

59
00:04:18,730 --> 00:04:25,270
When we took the bag file as well as the number of messages, topic information and a little bit of

60
00:04:25,270 --> 00:04:27,880
information into each individual topic.

61
00:04:27,880 --> 00:04:33,340
So in this case we see we got information from ROS out RPM and the speed topics.

62
00:04:33,460 --> 00:04:35,590
So keep in mind I stopped at my speed publisher.

63
00:04:35,590 --> 00:04:42,190
So if I do ROS two topic list, we don't see that speed in RPM topic being published to.

64
00:04:42,640 --> 00:04:46,120
Let's go ahead and play this bag file back to get the information from it.

65
00:04:46,120 --> 00:04:52,150
So go ahead and clear the screen and do Ros to bag play and I will do dash L which will loop the bag

66
00:04:52,150 --> 00:04:53,050
file once it finishes.

67
00:04:53,050 --> 00:04:56,140
It'll go back to the beginning and I do test dot bag.

68
00:04:57,470 --> 00:05:00,110
So we can see that our ROS bag is playing.

69
00:05:00,110 --> 00:05:09,110
And now if I do Ross to topic list again, we see that now we have our RPM and speed topics that are

70
00:05:09,110 --> 00:05:12,200
coming from the bag file and we can actually go ahead and echo them.

71
00:05:16,930 --> 00:05:23,050
So here we see the initial value that was coming from our speed publisher, and eventually we should

72
00:05:23,050 --> 00:05:29,170
see the values change because we changed the parameters midway through recording this back file.

73
00:05:29,650 --> 00:05:35,380
So here we see it changes to 5.23, and then we should see it change again to.

74
00:05:36,260 --> 00:05:37,650
10.47.

75
00:05:37,670 --> 00:05:37,940
All right.

76
00:05:37,940 --> 00:05:39,170
So go ahead and stop these.

77
00:05:41,430 --> 00:05:46,500
Now, I know this isn't the coolest bag file ever, so I prepared a bag file with data from an autonomous

78
00:05:46,500 --> 00:05:50,730
surface vehicle I worked with a while back, which I have in my downloads folder.

79
00:05:50,730 --> 00:05:51,930
So go ahead and clear the screen.

80
00:05:55,540 --> 00:05:58,270
And again, you can just grab this from the resources folder.

81
00:05:58,630 --> 00:06:02,410
So I have it here in my downloads folder, this marine surface vehicle bag, I've already gone ahead

82
00:06:02,410 --> 00:06:05,230
and unzipped it, so if I go into my downloads folder.

83
00:06:07,460 --> 00:06:08,450
We can see it there.

84
00:06:08,450 --> 00:06:14,150
And again, I'm not playing anything in the background, so if I do Ross to topic list, we only get

85
00:06:14,150 --> 00:06:15,200
our basic topics out.

86
00:06:15,200 --> 00:06:22,820
But if I do Ross to bag Play, Dash L and the name of the bag file, we can see it playing.

87
00:06:22,820 --> 00:06:28,670
And now if I run Ross to topic list again, we see several different topics such as Things for the Fix,

88
00:06:28,670 --> 00:06:35,300
which is the GPS of the robot, the IMU information, as well as the velocity and camera information

89
00:06:35,300 --> 00:06:38,240
that was coming from this particular robotic system.

90
00:06:38,390 --> 00:06:45,020
And of course, we can always go ahead and check this out by doing a Ross two topic echo slash fix.

91
00:06:47,750 --> 00:06:51,680
Here we can see latitude and longitude coordinates of this particular robot.

92
00:06:51,680 --> 00:06:53,000
So as a little side challenge.

93
00:06:53,030 --> 00:06:57,030
See if you can figure out where this robot was when this bag file was being taken.

94
00:06:57,050 --> 00:06:59,150
So go ahead and stop this with control C.

95
00:07:02,550 --> 00:07:06,660
And now notice we have camera information, but we can't just really echo that, right?

96
00:07:06,660 --> 00:07:12,930
If I do, Ross, too, topic Echo and I do this when the front camera, USB camera.

97
00:07:14,820 --> 00:07:17,880
We had a series of numbers just being printed to this screen endlessly.

98
00:07:17,890 --> 00:07:23,160
Now this is the actual pixel information and color mappings within the image.

99
00:07:23,250 --> 00:07:29,100
But in the next lecture, we'll be learning how to utilize tools to help us visualize some of this type

100
00:07:29,100 --> 00:07:31,740
of information we may be getting from our robots.

101
00:07:33,270 --> 00:07:39,330
Then the last thing I want to cover were some of the improvements made related to bag files in the latest

102
00:07:39,330 --> 00:07:41,190
Ross Humboldt distribution.

103
00:07:42,640 --> 00:07:47,320
If you head over to the Ross to Humble page, you will see the changes made since Fox in Galactic and

104
00:07:47,320 --> 00:07:48,640
in the Ross to back section.

105
00:07:48,640 --> 00:07:53,830
We see there is now support for setting the start time of a bag file as well as playing in pausing bag

106
00:07:53,830 --> 00:07:55,570
files as well as a burst mode.

107
00:07:55,570 --> 00:07:59,020
If you're doing things such as training or testing neural network models.

108
00:07:59,230 --> 00:08:05,170
You can also edit bag files to do things such as remove certain topics or merge multiple bag files together.

109
00:08:06,390 --> 00:08:06,930
All right.

110
00:08:06,930 --> 00:08:10,200
With that, let's review what we learned about bag files.

111
00:08:11,510 --> 00:08:16,880
In this lecture, we learned how to use the bank file terminal commands in ROS two.

112
00:08:17,060 --> 00:08:24,320
This includes the ROS two bag record command, which we can specify topics or use the dash a flag to

113
00:08:24,320 --> 00:08:30,080
record all topics and then use the dash o flag to name the bag file output.

114
00:08:30,110 --> 00:08:35,660
We also learned about the ROS to bag info command which will give us information about a bag file.

115
00:08:36,080 --> 00:08:42,200
Then we can actually go ahead and play the bag file back using the ROS to bag play command.

116
00:08:42,230 --> 00:08:47,630
We use the dash WL flag for this command to loop the playback over so the bag file doesn't just stop

117
00:08:47,630 --> 00:08:49,260
playing once it reaches the end.

118
00:08:49,280 --> 00:08:51,710
Instead recycles back at the beginning.
