Changes between Version 26 and Version 27 of ControlSystems/SoftwareTeam/Training/GettingStarted/IntroRobotJava


Ignore:
Timestamp:
Oct 29, 2019, 12:24:52 AM (6 years ago)
Author:
David Albert
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ControlSystems/SoftwareTeam/Training/GettingStarted/IntroRobotJava

    v26 v27  
    191191Note: you'll need to manually turn the left wheel forward and backward to see the Encoder values change. Try turning the wheel 360 degrees to see what value is equivalent to a full revolution of the wheel.  Notice that the raw count reports the sum of both A and B channels of the quadrature encoder.
    192192
    193 == Sixth program: Autonomous Control!
     193== Sixth program: Autonomous
    194194In the examples above, we learned to apply power to the wheel motors and to see how far the wheel has turned using encoders.  Now we're going to put them together to drive the robot a controlled distance.  We're also going to learn about autonomous mode.  Every FRC match starts with a 15 second autonmous period where the robot drives itself and tries to accomplish some task with no human driver.  For this example, our task is just to drive 3 feet and then stop (harder than it sounds).
    195195
     
    265265
    266266Extra credit: See if you can make it go straight.
     267
     268== Seventh program: Closed Loop Control
     269In the last example, we saw why robot programming is challenging: robots work in the real world where wheels slip, motors have different powers, wheels aren't inflated equally, and floors aren't perfectly level.  The robot didn't go straight and didn't stop at exactly 36".  What makes robots interesting and powerful is their ability to sense their environment and respond to it.  In the basic Autonomous example, one wheel was turning faster than the other so the robot turned.  Since the encoders were reporting this, we can modify our program to compensate.  The simplest way to do this is to proportionally increase the motor power of the wheel that's going slower.  Add the following to the autonomousPeriodic() method from the previous example:
     270
     271{{{
     272
     273}}}
    267274
    268275