Required Java Skills: Arithmetic calculations
Sample code available for educators. Get Access
The setWheelVelocities() 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 wheel speeds the same. If the speed of the left wheel is different from the speed of the right wheel, the robot will turn.
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 255. The robot should turn for 5 seconds with the speed of the left wheel equal to the entered speed 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.