View unanswered posts | View active topics It is currently Tue Sep 29, 2020 1:54 pm






Reply to topic  [ 7 posts ] 
Encoder min steps 
Author Message
Rookie

Joined: Tue Apr 27, 2010 11:29 am
Posts: 3
Post Encoder min steps
Hi everyone,

i have problems with encoder steps : i want to get the smallest encoder steps possible, but motors only move reliably with steps >= 20...why is that ? With encoder target values <20 the motors will move but not every time (for example if i ask the motors to move 10 times by 5 encoder steps increments the result is the motors wil move only 5 or 6 times out of 10...). I thought i could use steps of 1 to 1440 units ? Am i missing something ? Is it a RobotC issue or maybe a hardware problem ?

Ideas anyone ?

Thanks :)


Tue Apr 27, 2010 11:42 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Encoder min steps
Could you please paste the code you are trying to make work? Maybe you're using the encoder function in an inefficient or incorrect way?

- 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 Apr 27, 2010 12:16 pm
Profile WWW
Rookie

Joined: Tue Apr 27, 2010 11:29 am
Posts: 3
Post Re: Encoder min steps
Hi Xander, thanks for your response :)

here is my code :

...

int i;
int AnglePlus=20;
int ForceX=80;

for(i=0;i<150;i++)
{

nMotorEncoder(MotorD)=0;
nMotorEncoderTarget(MotorD)=AnglePlus;
Motor(MotorD)=ForceX;

while(nMotorRunState(MotorD)!=RunStateIdle)
{
}

Motor(MotorD)=0;

wait1Msec(5000);

}

...

As you can see it's very basic, do you see anything wrong ?
I've tried different values for the "AnglePlus" variable, but when the value is <20 i got erratic motor responses...

thanks
Tan


Tue Apr 27, 2010 12:53 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Encoder min steps
You're basically trying to move the motor 20 degrees at a time, is that it? I would recommend you add some gears and slow it down. Then you tell the motor to move more degrees and you'll find that you'll get much better accuracy. Use this handy site to come up with a nice ratio that suits your needs: http://sariel.pl/tools/ratios/

- 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 Apr 27, 2010 1:55 pm
Profile WWW
Expert

Joined: Mon Mar 15, 2010 4:24 pm
Posts: 124
Post Re: Encoder min steps
Another problem is that there is no delay between setting the target and testing for RunStateIdle. Try putting a delay before this and also in the while loop.

Gary


Tue Apr 27, 2010 6:21 pm
Profile
Rookie

Joined: Tue Apr 27, 2010 11:29 am
Posts: 3
Post Re: Encoder min steps
Thanks Xander & Gary for your ideas :)

I forgot to specify that it's a NXT/TETRIX system - the motors are Tetrix motors with attached encoders...maybe that makes a difference ?

Xander : my goal is to get the smallest steps possible : 0.6 degrees straight from the motors would be perfect for my project, so if i'm correct that means : 0.6 out of 360 = 2.4 out of 1440 ?
Because of the encoder minimum steps size problem i had no choice but to add several reduction gears to get smaller steps...

Gary : i already tried to add wait1Msec(10) in the loop (no success), but i didn't know about that RunStateIdle refresh delay, i'll test that tonight...

Thanks !
Tan


Wed Apr 28, 2010 5:45 am
Profile
Rookie

Joined: Tue May 04, 2010 10:10 pm
Posts: 6
Post Re: Encoder min steps
I also get a similar weird behavior when using MotorEncoderTarget. With low motor power, the motor turns way too quickly at the end - it jerks forward for the last few degees. It seems like a bug. I found that I can get around the issue by programming my own MotorEncoderTarget function. Maybe this will work for you.


Sun May 09, 2010 10:07 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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.