View unanswered posts | View active topics It is currently Thu Oct 02, 2014 7:21 am






Reply to topic  [ 43 posts ]  Go to page Previous  1, 2, 3  Next
Encoders aren't changing correctly 
Author Message
Rookie
User avatar

Joined: Thu Jan 02, 2014 11:04 pm
Posts: 15
Post Re: Encoders aren't changing correctly
thank you. I will change my wait to 100 ms and see if there is any difference. Also, if I choose to use I2C, will it tell me how fast the encoders update or can it only tell you the values coming from it?

thank you for all your help,
Kitbear23


Sat Jan 04, 2014 6:42 pm
Profile
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: Encoders aren't changing correctly
Ford Prefect wrote:
so what encoders are you actually trying to read and to sync?
Lego encoder motors plugged to the motor ports
- or -
Tetrix motors plugged to the Tetrix motor controller, plugged to a NXT sensor port (and read by I²C) ?

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Sat Jan 04, 2014 6:43 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Encoders aren't changing correctly
kitbear23 wrote:
thank you. I will change my wait to 100 ms and see if there is any difference. Also, if I choose to use I2C, will it tell me how fast the encoders update or can it only tell you the values coming from it?

thank you for all your help,
Kitbear23

I think you can only tell the value but not how often the nMotorEncoder array is updated, since this is really a function of the firmware.


Sat Jan 04, 2014 6:45 pm
Profile
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: Encoders aren't changing correctly
Ford Prefect wrote:
Ford Prefect wrote:
so what encoders are you actually trying to read and to sync?
Lego encoder motors plugged to the motor ports
- or -
Tetrix motors plugged to the Tetrix motor controller, plugged to a NXT sensor port (and read by I²C) ?

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Sat Jan 04, 2014 6:48 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Encoders aren't changing correctly
Ford Prefect wrote:
so what encoders are you actually trying to read and to sync?
Lego encoder motors plugged to the motor ports
- or -
Tetrix motors plugged to the Tetrix motor controller, plugged to a NXT sensor port (and read by I²C) ?

Since he's talking about motor D and E, they must be Tetrix motors.


Sat Jan 04, 2014 6:52 pm
Profile
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: Encoders aren't changing correctly
then they are plugged (via controller) to a sensor port, right?
and the sensor ports are switched to I²C mode, right?
then there is a I²C bus delay of about 20-30ms from each I²C read to the next, right?
so 2 encoder values can't be read faster than at least 40ms one after another (except both values of both motors are read by 1 single I²C read all at once) - CMIIW !
(even slower if there are intermediately motor control commands like change pwm)

Lego motor encoders (at motor ports) can be updated at about 3-4ms each, asynchroneously.

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Last edited by Ford Prefect on Sat Jan 04, 2014 7:03 pm, edited 1 time in total.



Sat Jan 04, 2014 6:55 pm
Profile
Rookie
User avatar

Joined: Thu Jan 02, 2014 11:04 pm
Posts: 15
Post Re: Encoders aren't changing correctly
Ford Prefect wrote:
so what encoders are you actually trying to read and to sync?
Lego encoder motors plugged to the motor ports
- or -
Tetrix motors plugged to the Tetrix motor controller, plugged to a NXT sensor port (and read by I²C) ?


I am using tetrix motors plugged into a tetrix motor controller plugged into NXT sensor port 1.

I am trying to figure out how to read them by I2C, and what all I2C can read / reply back

and
MHTS wrote:
Since he's talking about motor D and E, they must be Tetrix motors.


I'm actually a girl :lol:

and Ford Prefect are you saying I shouldn't read from I2C because there is a big delay? Would I2C be a better way to read the encoders than the nMotorEncoder function or is there something else I can do?

thanks,
kitbear23


Sat Jan 04, 2014 7:03 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Encoders aren't changing correctly
That's why I said the NXT firmware probably can't update the nMotorEncoder array fast enough for his 10 msec loop. So chances are he's sampling the same period.


Sat Jan 04, 2014 7:05 pm
Profile
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: Encoders aren't changing correctly
it's always I²C for the Tetrix Controller, all Tetrix motor commands are always I²C commands, this issue is simply obscured by the RobotC firmware.
You'll never will be able to do it faster than I described because it's a I²C hardware issue (at least 20-30 ms from 1 command to the next, in doubt rather far slower)!

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Sat Jan 04, 2014 7:05 pm
Profile
Rookie
User avatar

Joined: Thu Jan 02, 2014 11:04 pm
Posts: 15
Post Re: Encoders aren't changing correctly
Ford Prefect wrote:
it's always I²C for the Tetrix Controller, all Tetrix motor commands are always I²C commands, this issue is simply obscured by the RobotC firmware.
You'll never will be able to do it faster than I described (20-30 ms from 1 command to the next)!


Ok so even by using the nMotorEncoder function its reading I2C?

and also MHTS by adding 100 ms between my samples of the motor, it causes my robot to ramp slower because of the added wait before I change the motors to the next motor power. So is there a faster way to ramp the motors while not sampling the encoders in the same period?

thanks,
kitbear23(girl)


Sat Jan 04, 2014 7:13 pm
Profile
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: Encoders aren't changing correctly
anything you're doing with the sensor port is going through the I²C bus - how else should it work?
The sensor port may only be switched between I²C mode and analog (ADC) mode, but the Tetrix motor controller is finally a I²C device!

I had Tetrix by my own some years ago - and those motors never could be used as quick as the motors at the motor ports.
It's a hardware issue of the I²C bus.
I abandoned it finally.

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Sat Jan 04, 2014 7:22 pm
Profile
Rookie
User avatar

Joined: Thu Jan 02, 2014 11:04 pm
Posts: 15
Post Re: Encoders aren't changing correctly
what do you suggest I do to read the encoders accurately?

Thanks for your feedback,
kitbear23


Sat Jan 04, 2014 7:28 pm
Profile
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: Encoders aren't changing correctly
no chance to do it faster using Tetrix.
Try to find the limit (100, 80, 60, 40, 30 ms), but 20-30ms is definitely the fastest limit.
If possible, use Lego motors plugged to the motor ports.

(I'm now afk - good night ^^)

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Last edited by Ford Prefect on Sat Jan 04, 2014 7:35 pm, edited 1 time in total.



Sat Jan 04, 2014 7:29 pm
Profile
Rookie
User avatar

Joined: Thu Jan 02, 2014 11:04 pm
Posts: 15
Post Re: Encoders aren't changing correctly
Sadly I can't because they are used on our arm and because we are using heavy metal parts (with a gripper attached to the arm) the only motors that we can use that are heavy duty enough are the tetrix motors.

and um, goodnight and thanks for the feedback


Sat Jan 04, 2014 7:34 pm
Profile
Rookie
User avatar

Joined: Thu Jan 02, 2014 11:04 pm
Posts: 15
Post Re: Encoders aren't changing correctly
I have changed the wait in my program to 30ms instead of 10ms and the encoder values aren't repeating while running but the encoder rate is still all over the place (current encoder value - previous encoder value)
you can see in the attached (my new data with some graphs) that in the scatter plot the values are everywhere. when the robot is at a lower speed they seem to be pretty much in order. but the more power put in the motor the more out liars there are. any suggestions on how to fix this?

thank you,
kitbear23


Attachments:
RampData4.csv [9.51 KiB]
Downloaded 96 times
Sat Jan 04, 2014 8:39 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 43 posts ]  Go to page Previous  1, 2, 3  Next

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.