team116 / ed2017

1 stars 0 forks source link

Mobility drive distance #5

Closed cartycrabber closed 7 years ago

cartycrabber commented 7 years ago

Mobility needs a function to drive straight a certain distance. It should have a parameter for the distance we want to drive, positive being forward and negative being backward. It will need to use the encoders on the drive system to keep track of how far it has driven. It may also want to use the drive straight function to make sure it is driving straight

Reference The DriveDistance command from ed2016 DriveDistance.h DriveDistance.cpp

screenstepslive page on encoders

WPILib reference for quad encoders

cartycrabber commented 7 years ago

You might want to use a PID controller for this as well, similar to the one used in for drive straight (#3) and turn degrees (#4). I haven't thought about the implementation too much but you could probably have the input be the current distance traveled, the output be the what to set the motors to, and the setpoint would then just be the distance to travel. You would have to reset the encoder distance before each drive straight operation. The only weird thing I see is what the input range would be. Maybe 0 to the longest distance the robot would travel? Or maybe you want to change the input range each time you do drive distance, having the min be 0 and the max be the total distance you want to move.

cartycrabber commented 7 years ago

Test this to make sure it works with various distances. Make sure to test edge cases like moving 0 inches, moving a small distance, and moving a very large distance