Go to Post Just wondering what types of food you have been living off of while working on your robot? Our team has had pizza almost 3-4 times a week or more. Just wondering. SGS DRAGONS - sgsdragons [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 23-03-2008, 18:57
KevinReid's Avatar
KevinReid KevinReid is offline
Registered User
FRC #2609 (Beaver worX)
Team Role: Mentor
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Guelph
Posts: 48
KevinReid is a splendid one to beholdKevinReid is a splendid one to beholdKevinReid is a splendid one to beholdKevinReid is a splendid one to beholdKevinReid is a splendid one to beholdKevinReid is a splendid one to beholdKevinReid is a splendid one to behold
RobotC and Quad Encoders

Could anyone using quad encoders and RobotC please enlighten me about programming, reading and using them? Our efforts have only resulted in 1's and 0's that do not reliably change... Hoping someone has had success and can point us in the correct direction.

Kevin Reid
Team 2609
  #2   Spotlight this post!  
Unread 24-03-2008, 21:44
KevinReid's Avatar
KevinReid KevinReid is offline
Registered User
FRC #2609 (Beaver worX)
Team Role: Mentor
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Guelph
Posts: 48
KevinReid is a splendid one to beholdKevinReid is a splendid one to beholdKevinReid is a splendid one to beholdKevinReid is a splendid one to beholdKevinReid is a splendid one to beholdKevinReid is a splendid one to beholdKevinReid is a splendid one to behold
Re: RobotC and Quad Encoders

Thats Quadrature encoders...
  #3   Spotlight this post!  
Unread 02-04-2008, 18:42
mluckham's Avatar
mluckham mluckham is offline
Registered User
FRC #0758 (Sky Robotics)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2006
Location: Ontario, Canada
Posts: 116
mluckham will become famous soon enoughmluckham will become famous soon enough
Re: RobotC and Quad Encoders

We use Grayhill 61K128 quadrature encoders, for wheels and anything else that needs position or speed information. Quad encoders provide direction of rotation, whereas the geartooth sensors in the KOP do not.

The encoders have two output signal wires (plus ground and 5 volts) which are connected to two Digital Inputs on the Robot Controller. EasyC has a nice Quad Encoder function, you just tell it which digital inputs you are using and it counts the pulses for you - use the same function to read the current count value, which increases with forward motion of the encoder, decreases with reverse motion.

If you want to calculate speed using encoders, your software loop should run at a fixed frequency - say once every 50 msec (or - the standard 18.2 msec, if you prefer).

Encoder count = distance
Distance MINUS previous Distance = speed (ticks)
Speed MINUS previous Speed = acceleration (ticks)

If you want your motors to run at a particular speed, adjust the PWM output up or down depending on whether the Speed is too slow or too fast. Often a PID Control Loop is used for this http://www.simbotics.org/files/first...amming-pid.pdf.

Problems arise if your encoder fails or one of the Digital Input wires fall off ... your control loop sees the encoder count NOT CHANGING and assumes the motor is not moving ... when in actuality your robot wheel is turning at max speed and the 'bot is spinning in a circle


If you want your motor to move an arm to a particular position, use the encoder count and a home limit switch connected to a Digital Input. Rotate your mechanism backward using PWM value until the home limit switch closes, then reset the Encoder COUNT to zero. Now you can rotate the mechanism forward and stop the motor when the Encoder COUNT reaches a particular value.
  #4   Spotlight this post!  
Unread 03-04-2008, 13:56
Mr. Lim Mr. Lim is offline
Registered User
AKA: Mr. Lim
no team
Team Role: Leadership
 
Join Date: Jan 2004
Rookie Year: 1998
Location: Toronto, Ontario
Posts: 1,125
Mr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond repute
Re: RobotC and Quad Encoders

Quote:
Originally Posted by KevinReid View Post
Could anyone using quad encoders and RobotC please enlighten me about programming, reading and using them? Our efforts have only resulted in 1's and 0's that do not reliably change... Hoping someone has had success and can point us in the correct direction.

Kevin Reid
Team 2609
Sorry Kevin,

Can't be of any help there with RobotC, but if you're interested in getting all your code over to MPLAB. Give me a call or e-mail, and we'll get you cooking with gas.
__________________
In life, what you give, you keep. What you fail to give, you lose forever...
  #5   Spotlight this post!  
Unread 03-04-2008, 15:07
tdlrali tdlrali is offline
Registered User
FRC #0469 (Las Guerrillas)
Team Role: Programmer
 
Join Date: Sep 2006
Rookie Year: 2006
Location: MI
Posts: 377
tdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud oftdlrali has much to be proud of
Re: RobotC and Quad Encoders

Quote:
Distance MINUS previous Distance = speed (ticks)
Speed MINUS previous Speed = acceleration (ticks)
those should both be divided by time since the previous loop

(Distance - previous Distance)/time = speed (ticks)
(Speed - previous Speed)/time = acceleration (ticks)
  #6   Spotlight this post!  
Unread 03-04-2008, 21:55
mluckham's Avatar
mluckham mluckham is offline
Registered User
FRC #0758 (Sky Robotics)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2006
Location: Ontario, Canada
Posts: 116
mluckham will become famous soon enoughmluckham will become famous soon enough
Re: RobotC and Quad Encoders

Quote:
Originally Posted by tdlrali View Post
those should both be divided by time since the previous loop

(Distance - previous Distance)/time = speed (ticks)
(Speed - previous Speed)/time = acceleration (ticks)
Yes, we do that. Our loop is constrained to run at a fixed rate, 50 msec intervals. So the speeds are ticks-per-50msec-interval.
  #7   Spotlight this post!  
Unread 03-04-2008, 22:00
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: RobotC and Quad Encoders

I would also be willing to help port your code to easyC, you can use the syntax editor instead of blocks if you wish.
__________________
FIRST Team 501 PowerKnights - Mentor
FIRST Team 40 Checkmate - Mentor Alum
FIRST Team 146 Blue Lightning - Alumni
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wiring Gyros and Encoders? SuspectZero Electrical 3 03-02-2008 15:30
FTC - Quad Quandary Challenge and Practice Kit Components Mark McLeod FIRST Tech Challenge 0 19-10-2007 11:06
Encoders and putdata theycallhimtom Programming 3 09-02-2006 19:24
EEPROM and Encoders Bharat Nain Electrical 7 01-12-2005 10:06
Testing and Cause of Failure for Encoders and Hall Effect sensors ChrisH Electrical 28 19-09-2005 01:07


All times are GMT -5. The time now is 01:45.

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