How Accurate is the Wait Time command?
Design a simple experiment to gain a better understanding of how the Wait Time command works and how accurate it is. Think about question 1 as you are working on this question
Hypothesis:
The Wait Time command should be very accurate. Essentially, it can be used to specify a length of time for executing a certain command. Since the wait time is specified in milliseconds, it should, theoretically, be able to handle something that is as close as, say, 1/10th of a second.
I believe that the accuracy of the Wait time command will also depend on certain factors, such as the complexity of the command and the battery life of the robot.
Materials:
- Stopwatch
- iRobot Create
- Computer
Procedure:
- First, send a command that causes the Create to light up the basic LED to red for 5 seconds. Then create a script that sends two LED and a wait commands to the Create. The first should cause it to turn green for 4 seconds. The second should cause it to turn red for 1 second.
- Have the script loop by placing the 153 opCode as the last byte of the script.
- The following code should do what was described above:
- 152 13 139 2 0 255 155 40 139 2 255 255 155 10 153
- 128 131 139 2 255 255 155 50
- As soon as the LED goes from red to green, start the stopwatch. It may also be convenient if the Create beeps at this time by playing a note/song.
- Stop the watch as soon as the LED turns off. While the stopwatch is running, you should be keeping track to see if the wait time is on par. At every 5 seconds interval on the stopwatch, the LED should go from red to green. Keep the watch running until the LED goes through 5 cycles (25 seconds)
- Repeat these steps 4 times to collect enough data and to wash out possible errors that might have occurred on one trial.
- Repeat the experiment, but this time have the green LED light up for 7 seconds and make the red LED light up for 1 second. Then do it once more with Green LED for 9 seconds, and red LED for 1 second.
Data Table:
| Trial Num
| 5-second Wait Time
| 8-second Wait Time
| 10-second Wait Time
|
| 1
| 25.31
| 40.25
| 50.38
|
| 2
| 25.21
| 40.16
| 50.40
|
| 3
| 25.19
| 40.31
| 50.41
|
| 4
| 25.25
| 40.31
| 50.60
|
| Average
| 25.24
| 40.26
| 50.45
|
|
| 5-second Wait Time
| 8-second Wait Time
| 10-second Wait Time
|
| Average
| 25.24
| 40.26
| 50.45
|
| Ideal
| 25.00 s
| 40.00 s
| 50.00 s
|
| Deviation
| .24
| .26
| .45
|
| % Deviation
| +.096%
| +.06%
| +.09%
|
Observations/Conclusions:
It can be seen from this lab that the Wait time is very accurate. For instance, the ideal time for one of the trials was 25 seconds long. It took the Create, on average, 25.24 seconds to complete this trial, which means that it was only off by .24 seconds. At 40 seconds, it only deviated .26 seconds, and at 50 seconds, it deviated .45 seconds. On average, the deviation was only less than 1% of the ideal time. For longer times, I noted that the the deviation was greater, but it stayed proportionate to the time. What I mean is that the percent deviation was fairly consistent despite the time specified.
While the results seem accurate, there are two important possible sources of error that must be considered. The first is human error. It is impossible to be able to start and stop the stopwatch at exactly the right moment, so the times could be slightly off. However, having numerous trials somewhat accounts for that by making it clear if a certain trial was way off.
The second possible source of error is the fact that we assumed that consecutive commands would be executed instantaneously after another, with no time in between to process or send the command to the Create. We know that it is impossible for this to be instantaneous. We could account for that by taking the data from Question 1 of this Lab and implementing it into this lab. We'd count how many commands there were and then multiply it by the time in between consecutive commands and then subtract it from our wait time deviation.
Problem 5: What is the relationship between the Drive Direct and the Drive Command?
My Code
Comments
Back to Our Lab Group Page