We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback
00:00

Formal Metadata

Title
SLAM A 02
Title of Series
Number of Parts
76
Author
License
CC Attribution - NonCommercial - NoDerivatives 3.0 Germany:
You are free to use, copy, distribute and transmit the work or content in unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
1
Thumbnail
04:51
2
Thumbnail
07:18
3
Thumbnail
12:07
4
Thumbnail
05:59
5
Thumbnail
03:20
6
Thumbnail
09:38
7
Thumbnail
07:46
8
9
10
11
12
13
14
15
16
17
18
19
Thumbnail
09:38
20
Thumbnail
08:03
21
Thumbnail
05:55
22
Thumbnail
07:00
23
Thumbnail
05:58
24
Thumbnail
21:58
25
Thumbnail
17:22
26
Thumbnail
08:50
27
Thumbnail
10:06
28
Thumbnail
13:47
29
Thumbnail
04:59
30
Thumbnail
11:21
31
Thumbnail
00:08
32
Thumbnail
05:57
33
Thumbnail
06:28
34
Thumbnail
14:21
35
Thumbnail
04:28
36
Thumbnail
17:03
37
Thumbnail
13:05
38
Thumbnail
00:44
39
Thumbnail
02:50
40
Thumbnail
04:11
41
Thumbnail
03:36
42
Thumbnail
06:17
43
Thumbnail
10:12
44
Thumbnail
04:45
45
Thumbnail
05:37
46
Thumbnail
12:54
47
Thumbnail
00:07
48
Thumbnail
00:06
49
Thumbnail
00:03
50
Thumbnail
00:06
51
Thumbnail
00:02
52
Thumbnail
00:03
53
Thumbnail
06:59
54
Thumbnail
00:24
55
Thumbnail
03:08
56
Thumbnail
03:12
57
Thumbnail
06:55
58
Thumbnail
03:41
59
Thumbnail
02:31
60
Thumbnail
05:53
61
Thumbnail
17:09
62
Thumbnail
01:35
63
Thumbnail
16:58
64
Thumbnail
04:25
65
Thumbnail
05:05
66
Thumbnail
05:08
67
Thumbnail
02:55
68
Thumbnail
15:18
69
Thumbnail
02:26
70
Thumbnail
04:26
71
Thumbnail
07:50
72
Thumbnail
07:27
73
Thumbnail
17:17
74
Thumbnail
08:03
75
Thumbnail
02:52
76
Thumbnail
03:39
Arithmetic meanAreaRange (statistics)RoboticsSurface of revolutionCountingNumberCodierung <Programmierung>NeuroinformatikGame controllerTerm (mathematics)Metropolitan area networkComputer fileJSONXML
CodeArithmetic meanLine (geometry)Execution unitNumberRoboticsCodierung <Programmierung>Set (mathematics)Reading (process)Computer fileMultiplication signRight angleInformationOrder (biology)Network topologyCategory of beingState of matterComputer virusPoint (geometry)2 (number)Computer animation
Plot (narrative)Reading (process)File formatComputer fileXMLComputer animation
Plot (narrative)File formatData modelOpen setLine (geometry)RoboticsComputer fileMultiplication signRight anglePosition operatorLetterpress printingOpen setComputer animation
Gastropod shellPlot (narrative)Reading (process)File formatCommon Intermediate LanguageLine (geometry)Electronic mailing listXMLComputer animation
Plot (narrative)File formatElectronic mailing listLine (geometry)NumberComputer animation
Plot (narrative)DivisorFile formatString (computer science)NumberHeegaard splittingComputer animation
Plot (narrative)File formatHacker (term)Reading (process)Module (mathematics)PredictabilityTunisElectronic mailing listTexture mappingString (computer science)IntegerComputer animation
Twin primeGastropod shellPlot (narrative)File formatModule (mathematics)Reading (process)Electronic mailing listComputer animation
Gastropod shellPlot (narrative)File formatOrder (biology)PlotterCodierung <Programmierung>CodeElectronic mailing listSource codeXML
File formatPlot (narrative)PlotterElectronic mailing listRight angleBitRoboticsBlock (periodic table)Computer animation
BitTrajectoryRoboticsCodierung <Programmierung>Right angleNumberAbsolute valueVideo projectorDiagram
InformationNumberAbsolute valueSocial classComputer fileDifferent (Kate Ryan album)XML
Default (computer science)InformationRow (database)Order (biology)Data loggerSocial classDifferent (Kate Ryan album)Equaliser (mathematics)Computer fileXML
Gastropod shellLetterpress printingInformationSocial classComputer animation
Gastropod shellDifferent (Kate Ryan album)Multiplication signComputer animation
BitRoboticsDifferent (Kate Ryan album)Computer animation
Gastropod shellLetterpress printingRoboticsBitMeasurementDifferent (Kate Ryan album)Multiplication signService (economics)Computer animation
Meta elementGastropod shellXMLComputer animation
Plot (narrative)Order (biology)PlotterBlock (periodic table)RoboticsCodierung <Programmierung>Computer animationDiagram
Transcript: English(auto-generated)
Now that we ran our robot through our arena, let's look at motor control. So this is our robot, here is our LiDAR, the scanner, which will scan somewhere in that range and will have an invisible area here. And these are two motors. And the two motors drive these axes, meaning if they go at a certain speed, the robot
will also go at this speed. And if one of them goes faster, then the robot will somehow make a turn. Now these motors, they do have wheel encoders, meaning there is encoders that count the number of turns, actually not single turns, but they count many ticks for a single revolution.
This tick count is sent to our control computer. Our control computer just locks all those values. Here is one of those lock files. And this lock file is also in the set of files that you have for the current unit.
So this file is called robot4 underscore motors dot text. And we made some code at the start of each line. So here we are writing M for motor, motor information, and then all the data. So from this data I actually don't need very much. So this is a timestamp.
So this means that millisecond 204, the motor readings were as follows. This number here is the encoder value for the left motor. And we don't need these three values. And this is for the right motor we'll encounter. And there's actually a third motor, which would be this one, but which we are not using.
So all the other values are not interested. If you want to read this file, just keep in mind, what we need is we have to check if this is an M, so this will be the motor readings, we could use the milliseconds here. Then we need this value and that value. Meaning if we count, this is 0, 1, 2, 3, 4, 5, and 6.
So we are actually just interested in the value 2 and in the value 6. So also, if you look at this, the encoder values, they do not start at 0. So they start at a certain number. And then when the robot moves forward, they start to increment at a certain point in time.
So remember, left, that's the second column. And right, that's the sixth column we are interested in. So now let's try to read out the motor file. So in this file, we have those lines, which are M, then a timestamp, then the position left,
then three other values, which we are not interested in, and then the position right, both in ticks. So first of all, let's open the file. The file is robot4motors.txt. And so we open it, and first of all, let's just print out all the values.
So we say, for line in file, print the line. Then we run it. And you can see, it brings out those lines that we've just seen on the last slide. So now let's read out the left and the right motor ticks.
So I start by making a left list, which is empty, and a right list, which is empty. And then I have to split up the line into its columns. So I say, sp is a split up of the line. In fact, let's just print sp to see what happens.
The split command splits up the string in parts, and it will have the M, column number zero, column number one, two, three, and so on. And so we can just grab the columns we'd like to have. So we take the left list, but actually we're interested in the integer and not in the string.
So we convert it to an integer. And we append to the right list the sixth column. Let's try this. It works, but we can't see anything. So let's just ask for left list. So this is all values of the left encoder.
So now that we have this, let's just plot this. In order to plot, we import PyLab, and then we just plot both lists, plot left list and plot right list. Let's run it. So that's the outcome. So these are the values of the two incremental encoders.
So the left one starts at a little bit more than 20,000. The right one starts at more than 15,000. And then the robot starts to move, and they just increment. And we can see that the left one starts at a higher value, but in the end, it ends up in a lower value.
So this means the right wheel encoder has more ticks along the entire trajectory than the left one. So the robot does a left turn. So the absolute tick numbers are not really so meaningful. And so it's hard to interpret the drawings that we just made. So let us build the difference of ticks.
And now we could just program this, but I'll show you something else. So there is a class which is in the package that you downloaded for this course, which is called Lego log file. You can import that. And the purpose of this class is to import all different kinds of records
that we will produce throughout this class. So in order to read a file, you can just say log file equals Lego log file, and then just read it like that. And if you run that, now we have this class. And for example, we can ask for the motor ticks.
And those ticks are the differences from one time step to the next one. So let's just print out the first 20 motor ticks. And here they are. As you can see, in the beginning, the robot does not move.
And then after a while, it starts to move, it starts to accelerate, it gets faster. And then here's a little bit of difference. So the left motor goes one tick faster than the right motor. And then we're also having something else here. We do have some time lag. And due to this time lag,
we have zero zero values spread across our measurements. If I make that longer, you will see that occurs more often. See, at about every five movements or so, we have a zero zero. Now let's plot those values in order to see what's going on. So I'm adding the import from PyLab, and then it is as simple
as just adding the plot command down here. Now let's see what happens. Now in this plot, we can see the incremental values for the motor encoders. And we see those spikes going down to zero, which is not what we actually want.
But we can also see the robot drives straight and then the right motor gets faster, whereas the left motor gets slower. So the robot makes a turn, then it goes straight again, and so on. So you also can use this to have a closer look.

Recommendations