View Single Post
  #1   Spotlight this post!  
Unread 03-15-2016, 06:46 PM
acrilex acrilex is offline
Registered User
AKA: Alexandre Croteau
FRC #5179 (Sénateurs)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: Drummondville, QC, CA
Posts: 9
acrilex is an unknown quantity at this point
Drive forward to x inches

Hello,

I have a problem. We are trying to achieve a function to drive to a specific distance, for exemple 10 inches. What I would like to be able to do is call driveToDistance(leftDistance, rightDistance).

We are using encoders, and they are well calibrated. For exemple, if we manually push the robot during 10 feets, RobotMap.driveTrainEncoderLeft.getDistance(); really return 120 inches for the left encoder.

How could we make a function so the robot goes forward to 10 feets using information returned by the encoders? I'm trying to understand PID, but a code exemple would help greatly.

For your information, in our code,
Code:
Left encoder is RobotMap.driveTrainEncoderLeft ;
Right encoder is RobotMap.driveTrainEncodeRight ;

Left motor is RobotMap.driveTrainLeftController ;
Right motor is RobotMap.driveTrainRightController ;

RobotDrive is RobotMap.driveTrainRobotDrive ;
(for tankDrive and arcadeDrive)

Thanks,
Acrilex
Reply With Quote