Skip to 0 minutes and 1 secondOK, this video will show you what I did in order to solve the two exercises for this week, which is relevant if you couldn't, for some reason, do the exercises, or you want to compare what you did with how I did.
Skip to 0 minutes and 17 secondsRight, first, investigation. Let's do a few things. So if I put in 4 and 4 for both motors, press start, we see the robot spinning around. And that's because of the business of the fact that, as looked from the outside, if you put a positive number, the wheel will turn clockwise. So the right wheel is going clockwise, as is the left wheel, which means the right is going forward, the left wheel backwards. So that he can go in a straight line, I have to make the left motor minus 4, which I can also do by making the left motor minus 4, but reversing the left motor connection like so. If I want-- stop it.
Skip to 1 minute and 3 secondsIf I want the robot to go backwards, I can make both of these minus 4. Press start, and then it's going backwards. If I make it minus 12, in both cases, it goes back more quickly. OK, I want to turn, so if I put a 4 and a 0, press start. The left motor is going forward, because of the reverse connection. So we should see, correctly, that the robot is turning around. And, obviously, if you do the opposite, then it turns in the other direction. So these are some of the experiments I did, just to find out what's going on.
Skip to 1 minute and 59 secondsSo here is the second exercise, where we're going to build on what's going on. So let's define a few speeds. I'm going to go forward, but quite quickly. I'm going to put 12 and 12. I'm going to do the reverse left motor connection, because I think that's more logical. I want to turn, but I'm going to turn slowly, so I'll put just 2 in there. And to go backwards, well, let's go back quite quickly, shall we? Minus 8, minus 8. And, as we can see, if I press f, it goes forward nice and quickly. If I turn right, it's turning quite slowly. I then go forward again, and turn left. Go backwards, go forward.
Skip to 2 minutes and 42 secondsSo all of these things are working quite nicely in this particular track. And obviously, if you put it into stop mode-- if I were to reverse the left motor, then I could make that minus 12, minus 2, and plus 8. And it now does forward, turn right, turn left in the same way. Either way of doing it is fine. Let's scroll up, and put the racetrack in, and go racing. Here, it's going forward. I'm going to actually control it with the keyboard, because it's easier, I find.
Skip to 3 minutes and 26 secondsForward, forward, and it's getting there. Yeah, 18.8 seconds. That's quite good. I wonder whether you did it quicker. If you got faster speeds here, you might actually have done so. Do a return race, compare that. Go racing again. Now, I've got to remember to turn left.
Skip to 3 minutes and 58 secondsYeah, I'm going to get there in about the same time. So, did you do better?
What you should expect to see in the simulations
Hopefully you were able to use the simulations and found them interesting. If for some reason you were unable to get the simulations to work, or you would like to compare what you did with how Richard approaches the exercises, then take a look at this video.