Go to Post With computers, every once in a while you see something that makes you think "I could have done this, why didn't I think of it? It would have made my life so much easier." Now is one of those times. - Nadav Zingerman [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 25-01-2011, 16:35
normpearii normpearii is offline
Fledgling Programmer
AKA: Norman Pearson II
FRC #2603 (Highland Robotics Team)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Medina, Ohio
Posts: 6
normpearii is an unknown quantity at this point
Send a message via ICQ to normpearii Send a message via AIM to normpearii Send a message via MSN to normpearii Send a message via Yahoo to normpearii
Encoder Help

We are having trouble getting our motors to go forward for 10 ticks of our encoders; this is how we are testing out encoder code to make sure it works.

MyRobot.cpp (Simple Template)
Our Declaration
Code:
Encoder encoderR;
Encoder encoderL;
double dblRight;
Our Init
Code:
encoderR(13,12),
encoderL(10,11)
Our Autonomous drive code
Code:
encoderR.Start();
encoderL.Start();
dblRight=encoderR.GetDistance();

if(dblRight>-10)
{
myRobot.Drive(0.5, 0.0); 	
dblRight=encoderR.GetDistance();
}
 				
else if(dblRight<=-10)
{
myRobot.Drive(0.0, 0.0); 	
dblRight=encoderR.GetDistance();
}
Reply With Quote
  #2   Spotlight this post!  
Unread 25-01-2011, 19:26
1jbinder 1jbinder is offline
Registered User
FRC #0852
 
Join Date: Jan 2008
Location: Athenian School
Posts: 35
1jbinder is an unknown quantity at this point
Re: Encoder Help

We can't help you if you can't describe the problem. Also, ten ticks is a very small distance. Like a 30th of a rotation.
Julian Binder
Reply With Quote
  #3   Spotlight this post!  
Unread 25-01-2011, 19:57
jwakeman jwakeman is offline
Registered User
FRC #0063 (Red Barons)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: 16510
Posts: 182
jwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nice
Re: Encoder Help

You will need to set SetDistancePerPulse with the proper value if you want to use GetDistance(). Maybe you did and just didn't show it here. If you just want ten ticks tho maybe you should use GetRaw()
Reply With Quote
Reply


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 14:11.

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