View unanswered posts | View active topics It is currently Sat Jan 21, 2017 7:49 pm

 Page 1 of 1 [ 4 posts ]
 Print view Previous topic | Next topic
Encoders are Inaccurate?
Author Message
Rookie

Joined: Sun Feb 27, 2011 3:41 pm
Posts: 20
Encoders are Inaccurate?
Hello guys,

It is my first time posting in this forum. I am from FTC Team Unlimited 0001. We were wondering if it is just us who has trouble with the DC Motor Encoders. Whenever we make an autonomous and finish, our encoder always acts up the next time and we need to tweak it a little again (by like 3 inches). Is there a way to get super accurate readings each time? Here's how i do it...
 Code:float convert(float inches){  //In this part, you convert the inches to encoder rotations and you return that value//  return (inches* 140);}//You can use this function to move the robot a set amount of inches with a set speed//void goInches(float inches, int speed){  //reset the encoders...  nMotorEncoder[RightDrive] = 0;  //start up the motors...  motor[LeftDrive] = speed;  motor[RightDrive] = speed;  //you go move until you reach the desired amount of encoder counts...  while (abs(nMotorEncoder[RightDrive]) < (convert(inches)) || abs(nMotorEncoder[LeftDrive]) < (convert(inches))){ }  //You stop the motors after the while loop...  motor[LeftDrive] = 0;  motor[RightDrive] = 0;  wait1Msec (1000);}

Now, we are using two encoders and it is still being bad. Before we also tried with one encoder.

Sun Feb 27, 2011 3:46 pm
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Re: Encoders are Inaccurate?
 rkrishnan2012 wrote:our encoder always acts up the next time and we need to tweak it a little again (by like 3 inches).

Don't know what you meant by acting up and have to tweak it again, but your algorithm is not accurate to start with. First, you only reset the right encoder at the beginning, but you did not reset the left one. Secondly, even if you applied equal power to both wheels, the wheels are not running at the same rate, so your robot will probably not going straight and will most likely overshoot because you won't stop until both encoders traveled at least x inches. You may consider using some of the RobotC bult-in facilities such as Sync the wheels or even PID control drive. There are many threads about this in this forum. You can search for them.

Sun Feb 27, 2011 11:36 pm
Rookie

Joined: Wed Feb 18, 2009 4:06 pm
Posts: 12
Re: Encoders are Inaccurate?
We have seen the exact same behavior. My own theory is that sometimes it takes a long time for the zeroing of the encoder to take place (I don't have any idea why this should happen?). So if you look at your program, you reset the encoder and immediately start the motors. The encoder may not really reset until the motor has been running for some time.

Insert a delay after reseting the encoder (250 msec?). Also instead of reseting the encoder, you could just read it's current value and use that as the starting reference.

We haven't had time to figuire this out, so I would be curious with regard to your fix.

Mon Feb 28, 2011 6:02 pm

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Re: Encoders are Inaccurate?
I will often add a 100-200ms delay after resetting the tachos. When they're reset, it's not immediate due to a few internal things that need to be reset as well.

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]

Tue Mar 01, 2011 2:12 am
Display posts from previous:  Sort by
 Page 1 of 1 [ 4 posts ]

#### Who is online

Users browsing this forum: No registered users and 2 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    Mini Urban Challenge    CS2N Robot Virtual Worlds Competitions       VEX Skyrise Competition 2014-2015       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions Virtual Brick Robotics Discussions    General Discussions    Project Discussions Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC    2013 Robotics Summer Of Learning       VEX Toss Up Programming Challenge       FTC Ring It Up! Programming Challenge    International Forums       Spanish Forums          ROBOTC for MINDSTORMS          ROBOTC for VEX       French Forums          ROBOTC pour Mindstorms          ROBOTC pour IFI VEX       Japanese Forums （日本語のフォーラム）       German Forums    2015 Spring Carnival Event    PLTW (Project Lead The Way)    Robotics Merit Badge    2014 Robotics Academy Summer of Learning