Purpose:

The purpose of this lab is to dig a little deeper into the control of the drive motors on the robot. Along the way we will tie in some concepts from our discussions of slope and dead reckoning. From a science skills perspective we will be exploring some ideas about calibration that are central to the practice of science.

 

Procedure:

This lab will use various modifications of the code you created in the previous lab. You may find it useful to create specific versions of the motor control sketch for each of the individual parts.

  • The first question I want us to address is whether the speed setting we use for the motors scales smoothly. In other words does analogWrite(5, 100); make the motor go twice as fast as analogWrite(5, 50);. To test this I'd like you to measure the speed of the robot when your 'dimmer switch' is set to 50, 100, 150, and 200. After you have determined these speeds plot them on an x-y plot where the horizontal axis is 'dimmer setting' and the vertical axis is speed in cm/s.
  • The second question that needs to be answered is whether the motorOffset needs to change to keep the robot going straight at different speeds. You will probably notice the answer to this question as you do the previous test. You will need to figure out the motor offsets for some specific speeds in the next step.
  • In your current motor control sketch you set the motor speed with something like this - int motorSpeed = 100; I would like you to set up 3 variables that represent 3 motor speeds (slow, med, and fast) with thoughtful names like motorSpeedSlow etc etc. You can choose the speeds you want as long as Fast is NOT greater than 225 on the dimmer switch and Slow is NOT less than 25 on the dimmer switch. Create appropriate offsets so that the robot will run reasonably straight at each of those speeds.
  • Task I: Program your robot to travel along a rectangle that is 50 cm x 100 cm. The robot must travel at one speed on the short side and a different speed on the long side. It should travel 'forward' all the time. This is just a modification of your the motor control sketch from last time so that it goes forward all the time and has different speeds on each side. Be sure to pause for 3-5 s between each iteration of the rectangle.
  • Task II: Program your robot to travel along the path defined in the first 3 steps of the dead reckoning HW problem. IF you're extra enthusiastic you can do the whole thing but it is not required and will NOT get you extra credit:) This is a little more aggravating because there is no repeated pattern. Your speeds don't need to be an exact match to the HW problem but they should be close. Be sure to pause at the end of your path for 5 - 10 s before it goes off to do it again.
  • All done!

 

LAB DELIVERABLES: (Turn in on Bb)

I) Insert your plot of the robot speed as a function of the 'dimmer setting' into your lab report and describe what it is telling your about the relationship between the two. If the plot is a straight line it means one thing, if it curls up or down it has a different meaning.

II) Paste the loop(){ } portion of your code for the rectangular path into your lab report..

III) Paste the loop(){ } portion of your code for the Dead Reckoning HW into your lab report.

IV) Submit your lab report to the Bb assignment.