Go to Post IS THAT A CLUE, DAVE?!?!? - Joe Matt [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 07-05-2006, 12:25
Ctx32 Ctx32 is offline
Registered User
no team
 
Join Date: Apr 2006
Location: Florida
Posts: 10
Ctx32 is an unknown quantity at this point
Encoders

I got the Ultrasonics working, But can someone help me with programming encoders.
I understand how they work, But I don't understand how to program them so they will track the motor to a certain spot then return to the starting spot.
Calvin
  #2   Spotlight this post!  
Unread 07-05-2006, 17:20
Francis-134's Avatar
Francis-134 Francis-134 is offline
Lifer
FRC #0190 (Gompei and the Herd)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Worcester, MA
Posts: 602
Francis-134 has a reputation beyond reputeFrancis-134 has a reputation beyond reputeFrancis-134 has a reputation beyond reputeFrancis-134 has a reputation beyond reputeFrancis-134 has a reputation beyond reputeFrancis-134 has a reputation beyond reputeFrancis-134 has a reputation beyond reputeFrancis-134 has a reputation beyond reputeFrancis-134 has a reputation beyond reputeFrancis-134 has a reputation beyond reputeFrancis-134 has a reputation beyond repute
Re: Encoders

What you need to do is to make a program that makes the robot go in whatever direction you wish UNTIL a certian number of encoder clicks is reached. For example, if you wanted to go five rotations of the wheel forward, then you would tell the robot to go forward until the encoder count reached 450 clicks (90 clicks per rotation * 5 rotations). In order to go back the same ammount, you have to preset the encoder to zero (the Vex encoders don't know whether you are going backwards or forwards) and set the motor to go backwards until it reads another 450 clicks (using the example above).

If you want to see how many clicks it is to a certian spot, download the "ENCODERTEST" program from the test code folder. Then, bring up the terminal window and see what the reading is once you reach a certian spot. If you need help specificaly about the encoder blocks, take a look in the help file which explains them very nicely. I hope this helps you, but if it dosen't, come on back and I'm sure someonw can help you.
__________________

Email | Twitter | Facebook | YouTube | Twitch
iTunes Podcast | Snapchat

A proud alumnus of teams 134 and 40 || Mentor of Team 190 || Director of Fun for BattleCry@WPI
  #3   Spotlight this post!  
Unread 07-05-2006, 19:25
Ctx32 Ctx32 is offline
Registered User
no team
 
Join Date: Apr 2006
Location: Florida
Posts: 10
Ctx32 is an unknown quantity at this point
Re: Encoders

Quote:
Originally Posted by Francis-134
What you need to do is to make a program that makes the robot go in whatever direction you wish UNTIL a certian number of encoder clicks is reached. For example, if you wanted to go five rotations of the wheel forward, then you would tell the robot to go forward until the encoder count reached 450 clicks (90 clicks per rotation * 5 rotations). In order to go back the same ammount, you have to preset the encoder to zero (the Vex encoders don't know whether you are going backwards or forwards) and set the motor to go backwards until it reads another 450 clicks (using the example above).

If you want to see how many clicks it is to a certian spot, download the "ENCODERTEST" program from the test code folder. Then, bring up the terminal window and see what the reading is once you reach a certian spot. If you need help specificaly about the encoder blocks, take a look in the help file which explains them very nicely. I hope this helps you, but if it dosen't, come on back and I'm sure someonw can help you.

Thats my problem, How do you tell the motor to go forward say 90 clicks?
Is this how: Begin - Start Encoder - Get encoder - motor module clockwise
If -encoder ==90 - stop motor.

Is this correct?
and how do you reverse it?
I'm sorry I'm really lost.
Thanks for your help.
Calvin
  #4   Spotlight this post!  
Unread 11-05-2006, 13:02
Andrew Schreiber Andrew Schreiber is offline
Joining the 900 Meme Team
FRC #0079
 
Join Date: Jan 2005
Rookie Year: 2000
Location: Misplaced Michigander
Posts: 4,069
Andrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond repute
Re: Encoders

On the topic of Encoders, would it be possible to use a grayhill op encoder on a vex system? If i recall correctly the grayhills run on 5v and just use an interupt port on the full size controller.

As the ports are the same (i believe but i have not found a pin out or anything to tell me if they are exactly alike) so i think it is possible. The reason is our team has several older grayhills around and none of the vex encoders. As i am doing vex as a class and focusing on the programming aspect i would like to know if the sensors could be made to work for vex as well.

The same question also goes for pots.

As for easyC im not very sure. I prefer to write the code by hand as i find it faster and more open ended.
  #5   Spotlight this post!  
Unread 11-05-2006, 13:32
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: Encoders

The Greyhills encoders would work with easyC but would only count up and not up and down.
  #6   Spotlight this post!  
Unread 13-05-2006, 21:33
Ctx32 Ctx32 is offline
Registered User
no team
 
Join Date: Apr 2006
Location: Florida
Posts: 10
Ctx32 is an unknown quantity at this point
Re: Encoders

How do you tell an encoder, How many clicks you want the motor to turn?
  #7   Spotlight this post!  
Unread 13-05-2006, 21:45
Andrew Schreiber Andrew Schreiber is offline
Joining the 900 Meme Team
FRC #0079
 
Join Date: Jan 2005
Rookie Year: 2000
Location: Misplaced Michigander
Posts: 4,069
Andrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond repute
Re: Encoders

Since they would work in easyC it is valid to assume that it would also work in normal C. correct?
  #8   Spotlight this post!  
Unread 13-05-2006, 22:42
Tristan Lall's Avatar
Tristan Lall Tristan Lall is offline
Registered User
FRC #0188 (Woburn Robotics)
 
Join Date: Aug 2001
Rookie Year: 1999
Location: Toronto, ON
Posts: 2,484
Tristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond reputeTristan Lall has a reputation beyond repute
Re: Encoders

Quote:
Originally Posted by Ctx32
How do you tell an encoder, How many clicks you want the motor to turn?
With programming. If you work in C (for the Microchip C18 compiler), check out Kevin Watson's site, and download the FRC encoder module.

Really, this is a job that is better suited for a stepper motor (which are currently illegal in FIRST). The Grayhills and Kevin's code can be made to simulate this sort of behaviour quite effectively, though.
  #9   Spotlight this post!  
Unread 13-05-2006, 23:54
GeorgeTheEng's Avatar
GeorgeTheEng GeorgeTheEng is offline
Former Lord of the Vex
AKA: George Marchant
FRC #0087 (Red Devils)
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 2000
Location: Mount Laurel, NJ
Posts: 166
GeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud ofGeorgeTheEng has much to be proud of
Send a message via AIM to GeorgeTheEng
Re: Encoders

Quote:
Originally Posted by Ctx32
Thats my problem, How do you tell the motor to go forward say 90 clicks?
Is this how: Begin - Start Encoder - Get encoder - motor module clockwise
If -encoder ==90 - stop motor.

Is this correct?
and how do you reverse it?
I'm sorry I'm really lost.
Thanks for your help.
Calvin
That is basically correct. Start the encoder when you want it to start. Inside some sort of loop, get the encoder value. Compare that to 90. If it's less, drive the motor forward. Stop it when it gets to 90 or above.

The encoders do not detect direction. So no matter what way it moves, the value will increase. Depending on how your code is set up, to reverse it, you have two choices. 1) reverse the motor direction and keep counting the encoder until it hits 180. Then stop. 2) reset the encoder and in a separate loop, do the same thing as forward, except you need to reverse the motor direction.

Try this...
create a variable, count = 0
Start Encoder
While (count <= 90)
Set motor forward
Set motor to neutral
Stop Encoder
Start Encoder
While (count <= 90)
Set motor reverse
Set motor to neutral
__________________
George Marchant - Lockheed Martin Engineer & General Nut Case
FIRST Credentials: Team 87 Mentor | Former Director FIRST Vex Challenge
NJ FIRST Planning Committee Member & NJ FVC Committee Member
Philadelphia Alliance Regional Corporate Advisory Board Member |
FRC and FTC volunteer at too many places to list (NJ, VA, DE, PA, NY, Championship)|


"Hi my name is George and I'm a FIRST-aholic. I've been a FIRST-aholic since 2000..."
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
Encoders and putdata theycallhimtom Programming 3 09-02-2006 19:24
Vex navigation with ultrasonic and encoders GlennGraham Electrical 4 13-01-2006 12:58
encoders stephenthe1 Programming 61 09-02-2005 15:05
Mechanical Wheel Encoders? Jaine Perotti Electrical 15 04-12-2004 22:46
Who used wheel encoders CyberWolf_22 Technical Discussion 12 04-05-2003 15:37


All times are GMT -5. The time now is 23:02.

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