On Thu, 2007-08-23 at 17:24 +0000, ben lipkowitz wrote: > This really sounds like a perfect job for classicladder. If you arent > interested in learning ladder logic, then writing a custom hal component > might be easier, since you seem comfortable with C. I think the issue here > is that your script is not running realtime, and so the timing is off.
The turret rotates at about one revolution per second, giving 125ms per tool position. My guess is that if I can process four or five position samples in that time, it should work. The problem is that, I think it is taking around 200ms to do it. If I were using a precompiled program, I think I should be able to do tens or hundreds of samples per position even in userspace(?). > > As you can see, sleep isn't always real accurate: It should be accurate enough were I would like to use it - that being, just after solenoid commands to let the mechanical parts to come to equilibrium. Originally, I had no sleep between "rotate", "sample", "activate stop". After the stop, sleeps for the park procedure were all minimum times. > > $ firefox; time sleep 0.1 > real 0m0.313s > > A C or python program would have the same problem: > #include <unistd.h> > int main(){ usleep(100000); } > > $time ./test > real 0m0.151s > > import time > time.sleep(0.1) > > $time python test.py > real 0m0.140s > > you could also try running your script with a higher priority. (renice) > btw you are actually having a problem right? or are you just informing us > of what you did? > > --fenn I still have a problem, sort of. I had to fall back on a less desirable method to get it to work. It now does a complete single tool position change using only solenoid commands and sleep - no position processing. After the turret parks, I sample the position and if the requested position and current position don't match, I have it jump to the next position, park and test again until I get a match. What I would prefer, is to process the location during rotation and only stop and park after I get a match. Bottom line (I think), how can I get enough processing done in 30ms to decode and match two (32 bit unsigned?) words? (By the way, this is how I decode the position bits: halcmd show inputs grep and cut change each bit, ones, twos, fours, eights from "T" or "F" to 1 or 0 current_tool=$((ones+(2*twos)+(4*fours)+(8*eights))) I visit Grandma on the way) Kirk Wallace ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users