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.

As you can see, sleep isn't always real accurate:

$ 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

> My first pass on getting my lathe turret working went okay. It turns out
> that shell scripts are way too slow for what I was trying to do.
>
> The plan was to, using an M101 script, energize the rotator solenoid,
> which raises the turret table and starts it rotating. I then monitor the
> four bit binary position input for a match between the requested tool
> position and the current tool position. As soon as a match occurs, I
> activate the stop dog solenoid, wait for the table to settle, deactivate
> the rotator solenoid, wait for the table to descend and lock, and
> finally deactivate the stop solenoid. On most of the steps, the table
> would rotate two or more positions before an action took place.
>
> So, I went back to my pre-feedback plan. I setup the script to only
> rotate the table one position - rotate, sleep .1, stop, sleep .1,
> de-rotate, sleep .1, de-stop, check for match, repeat till done or
> tender. It actually works pretty well.
>
> The problem is that scripts are interpreted or compiled while the
> program executes. Python is the same way, I believe, so it would have
> the same speed issues?
>
> I may convert my script to C and then call the C program from an M101
> script.
>
> 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

Reply via email to