View unanswered posts | View active topics It is currently Sat Dec 20, 2014 12:00 pm






Reply to topic  [ 5 posts ] 
Encoder Value for 1 rotation 
Author Message
Rookie

Joined: Sun Nov 17, 2013 11:09 pm
Posts: 2
Post Encoder Value for 1 rotation
Hi I am with team 133 the Arrows,
Right now we are trying to use encoders on our motors. This is the first year we have tried to use these but we are having trouble getting our wheels to turn exactly one rotation. Here is an example of the code we tested.
while(nmotorencoder[motor1] < 360)
{
motor[motor1] = 50;
)
motor[motor1] = 0

this code works, but the wheel only rotates ~ 1/3 of a rotation

in all of the example code I've seen on cs2n.org 360 degrees is supposed to be one rotation of the motor shaft but this doesnt work on our robot.
I don't know whether we installed the encoder incorrectly or the value of on rotation is something different but i would like to know if anyone else has had this problem or knows a solution
thanks team 133 - the arrows :biggrin:


Sun Nov 17, 2013 11:15 pm
Profile
Rookie
User avatar

Joined: Thu Nov 14, 2013 11:38 pm
Posts: 4
Location: Portland, OR
Post Re: Encoder Value for 1 rotation
Is this for a TETRIX DC Motor or a LEGO NXT Motor? For TETRIX DC Motor 1 revolution = 1440 encoder ticks. For a LEGO motor the logic you are using will work fine.

_________________
Team 4855 - Batteries In Black
http://www.facebook.com/FTCBatteriesInBlack


Sun Nov 17, 2013 11:55 pm
Profile WWW
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1368
Post Re: Encoder Value for 1 rotation
Team4855 wrote:
For TETRIX DC Motor 1 revolution = 1440 encoder ticks.

Only if you use 360-line optical discs. There are 250-line discs. In that case, it would be 1000 encoder ticks. Quadrature encoders are always counting 4 times the number of lines.


Mon Nov 18, 2013 3:03 am
Profile
Rookie

Joined: Sun Nov 17, 2013 11:09 pm
Posts: 2
Post Re: Encoder Value for 1 rotation
Thanks for the replies we are using tetrix dc motors and I have tried 1440 and it goes over by a decent amount, the closest we have gotten to one rotation was with about 1020 degrees


Mon Nov 18, 2013 8:43 am
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1368
Post Re: Encoder Value for 1 rotation
It sounds like you have a 250-line optical disc on your encoder. If so, you will have a COUNT_PER_REVOLUTION of 1000.
You can determine this by the following code:
Code:
task main()
{
    nMotorEncoder[motor1] = 0;
    while (true)
    {
        nxtDisplayTextLine(2, "Enc=%d", nMotorEncoder[motor1]);
        wait1Msec(100);
    }
}

Mark your wheel or end-effector with a piece of tape before starting the program, then run the program and hand rotate the wheel or end-effector approximately one revolution. Then look at the value on the display. Now be mindful if you have any gears between the motor and the wheel or end-effector. If so, the "counts per revolution" will also account for the gear ratio.


Mon Nov 18, 2013 4:48 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.