|
Page 1 of 1
|
[ 14 posts ] |
|
Author |
Message |
todorangrg
Rookie
Joined: Mon Jul 06, 2009 2:59 pm Posts: 13 Location: Baia Mare, Romania
|
 nMotorEncoder reset
Hello, I realised during my testing that the nMotorEncoder resets after the nMotorEncoderTarget command. My project requires a nMotorEncoder that never resets(unless I tell so). Can I do something about that?I tried to find the function in the include files to modify it but with no success. What I am needing is like "total tach" from the debugger window. So far I built a task that keeps the count but in fast oscilative movements(with other tasks working) it skips some ticks  . Any help would be highly apreciated. Best Regards, George T.
|
Thu Jul 23, 2009 3:46 pm |
|
 |
Jeff McBride
Professor
Joined: Fri Sep 19, 2008 1:22 am Posts: 200
|
 Re: nMotorEncoder reset
The solution is to not use the nMotorEncoderTarget feature and do the tests yourself. I suggest creating your own array of target values and having a separate task that loops forever checking the position of each encoder and stopping any motor(s) that have met or exceeded their target. That way you can use it just like the built in behavior but without the reset feature. You will need to think about how to deal with the counters wrapping and other similar boundry conditions.
_________________ Jeff McBride Benson Robotics Club
|
Thu Jul 23, 2009 6:41 pm |
|
 |
todorangrg
Rookie
Joined: Mon Jul 06, 2009 2:59 pm Posts: 13 Location: Baia Mare, Romania
|
 Re: nMotorEncoder reset
I understand what you say but nMotorEncoderTarget is very good because it has that slow-to-stop movement that skips in the worst case 1 tick. That is why I tried to change the nMotorEncoder.But how does nMotorEncoderTarget slows?that´s why I asked for the include.Is it using PID based algorithm?
Best Regards, George T.
|
Fri Jul 24, 2009 2:41 am |
|
 |
Jeff McBride
Professor
Joined: Fri Sep 19, 2008 1:22 am Posts: 200
|
 Re: nMotorEncoder reset
I don't know for sure what method it is using but I would guess that it uses PID. Are you using standard LEGO motors? The code for Tetrix motors is likely to be quite different since the encoders have about 10x the resolution of the LEGO motors.
_________________ Jeff McBride Benson Robotics Club
|
Fri Jul 24, 2009 12:22 pm |
|
 |
todorangrg
Rookie
Joined: Mon Jul 06, 2009 2:59 pm Posts: 13 Location: Baia Mare, Romania
|
 Re: nMotorEncoder reset
I am using standard Lego motors. But one question still remains: Where is the file with the code of the nMotorEncoderTarget and nMotorEncoder?
Best Regards, George T.
|
Fri Jul 24, 2009 1:29 pm |
|
 |
Ford Prefect
Guru
Joined: Sat Mar 01, 2008 12:52 pm Posts: 1030
|
 Re: nMotorEncoder reset
there is no certain file. It's a hidden obscured undocumented function, certainly a feature, not a bug 
_________________ 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)}
|
Fri Jul 24, 2009 1:38 pm |
|
 |
todorangrg
Rookie
Joined: Mon Jul 06, 2009 2:59 pm Posts: 13 Location: Baia Mare, Romania
|
 Re: nMotorEncoder reset
 Sarcastic as usual...
|
Fri Jul 24, 2009 1:43 pm |
|
 |
todorangrg
Rookie
Joined: Mon Jul 06, 2009 2:59 pm Posts: 13 Location: Baia Mare, Romania
|
 Re: nMotorEncoder reset
well I've built a PD algorithm that works theoretically. But when I try to add the Integral part everyting goes messy(the motor runs endlessly). I used the constants that were apearing in the robotc debugging window(450,50,650) and divided the whole PID ecuation by 100. Are these the correct constants that the nMotorEncoderTarget is using? If not I haven't found a good way of finding them. Trial and error sounds a bit to time consuming so if anyone knows a theoretical way of finding them(or a more theoretical trial and error) it would be really apreciated. I read about the Ziegler–Nichols algorithm but calculating the oscilation period of the motor is quite triky because it oscilates very fast. All in all this is what I wrote so far: There may be some syntax errors because I worte it from my rememberings(i don't have my laptop with my files right now). EDITED by Miki to add code tags around code section
Last edited by miki on Thu Apr 26, 2012 6:26 am, edited 1 time in total.
adding BBCode tags around code section. Please use them :-)
|
Thu Jul 30, 2009 1:43 pm |
|
 |
miki
Moderator
Joined: Thu Dec 22, 2011 7:42 am Posts: 43
|
 Re: nMotorEncoder reset
Hi todorangrg, I would say this code is part of the firmware released with RobotC and can't be find (as source code) in programs running over it. Miki.
_________________Visit my project RainBot v0.11 on source forge, a 6 wheels robot featuring A* & Dijkstra's path finding, motors & sensors emulation, small font, fifo & sorted list libraries, using Xander's drivers for HT Compass, and documented with doxygen.
|
Thu Apr 26, 2012 4:39 am |
|
 |
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 Re: nMotorEncoder reset
Um, not to be rude Miki, but why did you revive a thread of 3-years age?
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
Fri Apr 27, 2012 10:09 pm |
|
 |
miki
Moderator
Joined: Thu Dec 22, 2011 7:42 am Posts: 43
|
 Re: nMotorEncoder reset
well  just after I rescued my PC, I tested it a bit to check if everything was ok. I went on RobotC forum and answered to this new topic. then I updated the PC clock Miki.
_________________Visit my project RainBot v0.11 on source forge, a 6 wheels robot featuring A* & Dijkstra's path finding, motors & sensors emulation, small font, fifo & sorted list libraries, using Xander's drivers for HT Compass, and documented with doxygen.
|
Sat Apr 28, 2012 5:07 am |
|
 |
magicode
Moderator
Joined: Tue Sep 14, 2010 9:19 pm Posts: 496
|
 Re: nMotorEncoder reset
Aha, I was wondering about that. I was curious that I'd never seen this thread before, and then I noticed Ford Perfect had posted, and after much surprise, I noticed the date. Does phpBB really work off of your system time? 
_________________ sudo rm -rf /
|
Sat Apr 28, 2012 8:24 am |
|
 |
miki
Moderator
Joined: Thu Dec 22, 2011 7:42 am Posts: 43
|
 Re: nMotorEncoder reset
Hum. you may be right.  The fact my PC believed we were in 2002 doesn't explain anything. It is possible that I saw a new post (the one stamped April 24th, 2012, 12:41 pm) of todorangrg and then I navigate in his posts without paying attention to their date. April 24th, 2012, 12:41 pm
_________________Visit my project RainBot v0.11 on source forge, a 6 wheels robot featuring A* & Dijkstra's path finding, motors & sensors emulation, small font, fifo & sorted list libraries, using Xander's drivers for HT Compass, and documented with doxygen.
|
Sat Apr 28, 2012 10:41 am |
|
 |
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 Re: nMotorEncoder reset
I hereby award you the prize for longest unintended thread bump in history!!!!!
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
Sat Apr 28, 2012 10:53 am |
|
|
|
Page 1 of 1
|
[ 14 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
|
|