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

MHTS

Guru

Joined: Sun Nov 15, 2009 5:46 amPosts: 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

pbesen

Rookie

Joined: Wed Feb 18, 2009 4:06 pmPosts: 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.

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