You get a bonus - 1 coin for daily activity.
Now you have 1 coin
The Task of Safe Parking
Lecture
Task - Safe parking
Safe parking Assignment The robot must find a parking space between two "cars" and pull into the space it found. If the distance between the "cars" is not enough for parking, the robot must continue straight ahead to look for a more suitable spot
Safe parking Task analysis • To detect the space between the "cars," a distance sensor aimed to the right of the robot will be used. • Assuming the robot is driving at some distance from the wall, we can expect that readings greater than this distance mean an empty space between the "cars" 15 cm. ?? cm. 15 cm.
Safe parking Program • Write a program that detects the presence of an empty space between two neighboring "cars." • After detecting the start of the empty space, the robot emits a short beep • After detecting the end of the empty space, the robot stops. The ultrasonic distance sensor has a large measurement error and does not provide reliable information, so it is not recommended to use the same values for detecting both the start and the end of the empty space. Instead, you need to leave a margin of a few centimeters. For example, start of the empty space: > 20 cm. end of the empty space: < 15 cm.
Safe parking Task analysis. Continued • To determine the distance between two neighboring cars, the motor-shaft rotation sensor (encoder) will be used. • You need to find out the robot cart's dimensions when measured in rotations or degrees. • The dimensions will be different for each 1.2 rotations / 430 degrees robot-cart, since they depend on its design and the diameter of the wheels installed
Safe parking Task analysis. Continued • After determining the boundaries of the space between the cars, you need to compare the distance between them with the robot's dimensions. 1.5 rotations 0.6 rotations 1.2 rotations
Safe parking Task analysis. Continued • Since the motor-shaft rotation sensor accumulates the total rotation since the program started, comparing it with the robot's dimensions makes no sense. • Resetting the sensor reading when detecting the start of the empty space will result in the sensor having accumulated the width of that space by the time the end of the space is detected. Reset the rotation sensor Get the sensor reading since the last reset
Safe parking Program. Continued • Modify the previous program: • Along with the beep, the robot must reset the motor-shaft rotation sensor. Which motor's sensor will be reset? • Instead of stopping the robot, it will now compare the rotation sensor reading with the robot's dimensions. • If the reading is greater than the set value, the robot must perform the parking maneuver. • Use a loop to search for another empty space suitable for parking. What will happen to the program after the robot finishes parking?
Comments
To leave a comment
If you have any suggestion, idea, thanks or comment,
feel free to write. We really value feedback and are glad to hear your opinion.
Comments