Go to Post just flat out, full force, take no prisoners driving - spears312 [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Spotlight this post!  
Unread 17-01-2016, 19:30
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,561
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Using Encoder to Drive a Certain Distance

Quote:
Originally Posted by curtis0gj View Post
Just curious about the set distance per pulse function. Is this function the ratio between how far each pulse will take the robot?

For example if I were to calculate the circumference of the wheel (in inches). Then divide the circumference of the wheel by the number of pulses in a full revolution (which is 1440 I think if I am using x4 encoding). Then set the distance per pulse to the circumference/number of pulses in one revolution would it make one full revolution move the robot one inch?

Sorry if this is not clear enough I can try to clarify if it makes zero sense.
That's the right process. However, wpilib normalizes pulses, so it won't change by decoding type. You should use 360 pulses in a full revolution, but it will increment in 1/4 increments in 4x mode. In addition, you'll want to take into account any gearing between the encoder and the wheel.

Code:
	//Encoder Distance Constants
    public static final double wheelDiameter = 6;
    public static final double pulsePerRevolution = 360;
    public static final double encoderGearRatio = 3;
    public static final double gearRatio = 64.0/20.0;
    public static final double Fudgefactor = 1.0;


final double distanceperpulse = Math.PI*wheelDiameter/pulsePerRevolution /
        		encoderGearRatio/gearRatio * Fudgefactor;
driveTrainEncoderL.setDistancePerPulse(distanceperpulse);
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:24.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi