New Required Python Skills: Arithmetic calculations
Resources available for teachers. Login/Get Access
The wheels() method that you used to move the Finch forward and back is also used to make the Finch turn. To make the Finch move in a straight line, you kept the left and right wheels speeds the same. If the speed of the left wheel is different from the speed of the right wheel, the robot will turn.
Create a new file named “FinchTurn.py” and try out the commands shown above. It should make the Finch turn right for 3 seconds.
Try changing the time that the Finch should move. How long should the Finch move to turn 90°?
Write a program that makes the Finch move in a square. Hint: The Finch turns more accurately at low speeds.
Write a program that asks the user for the speeds of the right and left wheels and then moves the Finch for 2 seconds with those speeds. What happens when the right and left speeds are close together? What happens when they are far apart?
Write a program that asks the user for a wheel speed between 0 and 1. The robot should turn for 5 seconds with the speed of the left wheel equal to the speed entered by the user and the speed of the right wheel equal to half the entered speed. How does the radius of the turn depend on the speed entered by the user?
Write a program that asks the user for a number of seconds. The robot should turn right for number of seconds entered by the user, then move forward for twice that number of seconds, and then turn left for half of that number of seconds.