Course 6 / Lecture 4:

Calculate the speed of the robot

In this lecture you will learn to work with speed. You will see how time and distance form the base of speed measurement. You will see that if the speed is greater, the travelled distance within the same time frame is increased proportionately. You will also learn the relation between time and speed.


Figure 1 - Calculate your Sniffer's speed in this lecture

Requirements

Task #1:

Import your 'stopwatch_upgrade' project you exported in the previous lecture!

In the previous lecture you created your own stopwatch program using SNAP and exported it into a .snap file. Please open SNAP and click on the sheet icon at the top of the screen. After that choose the 'Import...' option from the list. When you click on it, a pop-up window will appear where you can search your .snap file in your system. After you found it, select it and click on the 'Open' button like Figure 2 demonstrates. If you did everything well, you should see your stopwatch program.


Figure 2 - Import the project you have finished in the last lecture

Task #2:

Modify your program so that it moves your robot when you start measuring the time and stops it when you stop the measurement!

After you imported your stopwatch program, you should modify it to start and stop your Sniffer's motors. In this lecture you should start your Sniffer when you press the 's' key of the keyboard and stop it when you press the 't' key. You can start your Sniffer by placing a 'Start motor [motors] at [speed] %' after the block which sets the start variable's value. Please select the A+D motors for the 'motors' field of previous block and set the 'speed' one to 100 to start the Sniffer's motors at 100 percent. Finally, please place a 'Stop motor [motors]' at the end of the other blocks to stop the Sniffer's motors after you stopped the stopwatch. The results of these steps are shown in Figure 3.


Figure 3 - Control the Sniffer's motors

Task #3:

Start then stop the stopwatch to measure the distance traveled!


STEP 1: Start then stop the stopwatch

You can start your stopwatch in the same way you started it in the previous lecture, so please press the 's' key. After that you should see your Sniffer is started to move and the value of the 'passed' variable is continuously increasing. You can see its momentary value of the variable on the canvas if you checked it inside the 'Variables' category as you can see it on Figure 4. Finally press the 't' key to stop your stopwatch and your Sniffer at the same time.


Figure 4 - Run your stopwatch

STEP 2: Measure the distance

After you have run and stopped your program, you should see that your Sniffer moved by a distance and the stopwatch has stopped. On the canvas you can see how much time has passed. You will need to measure how far your Sniffer rolled, because in following lecture you will calculate its speed. Please measure the distance between the start and stop points using a ruler.


Figure 5 - Measure the traveling distance of your robot

Task #4:

Calculate the speed of the robot by using the measured distance and passed time!

After you measured the passed time by using your stopwarch program and you have also measured your Sniffer's travel distance using your ruler, you can calculate the speed of your robot. First, you should convert the measured distance to meters to calculate the speed in meter/seconds. Due to this, the traveled distance is needed in meters and the passed time is needed in seconds. After that you can calculate your Sniffer's speed by dividing the distance in meters by the passed time in seconds as you can see on Figure 6. Finally it is good to know that the speed unit used in this lecture is meter/second, although traditional vehicles measure it in kilometer/hour.


Figure 6 - Calculating the motor's speed


Program code


Figure 7 - This program code measures time while moving the robot

More information


Next


Copyright © 2000- |Ozeki Ltd | info@ozekirobot.com |
Page: 6093 | 3.141.35.60 | 79.99.42.43 | Login