Would someone perhaps be able to describe simply (like MachineKit for Dummy's) 
how exactly the step pulse and direction shows up on the Beagle pin relative to 
the motion command from a G00 X1.0 where current X position is 0.0.
 
Clearly we accelerate and move and then decelerate to arrive at the end point 
of 1.0.  I do this in my ELS code inside the interrupt routine which happens at 
a 20kHz rate.  If a step is required I set the output at the beginning of the 
routine and then clear it at the end after a whole bunch of other stuff is 
done.  
 
Whether to step or not is done by the equivalent of a trajectory planner.  For 
example in simple terms if the motor could accelerate instantly and the step 
rate was 10kHz then every second interrupt the axis is pulsed.  Also for every 
pulse the position is incremented if going in the positive direction.  
Decremented if going in the other direction.  When it matches the end position 
the stepping is terminated and we have a move to position.
 
Inside my ELS interrupt code I do the accel/decel too.  The interrupt routine 
changes the number of 20kHz intervals between step rates and also tracks the 
half way point.  If we're not up to speed yet but the halfway point is reached 
then deceleration is started and by the time the stepping rate reaches 0 the 
motor has also reached it's desired position.
 
Otherwise once the step output pulse rate matches the desired velocity the 
acceleration part is terminated and the number of steps it took recorded, and 
now a pulse happens every second interrupt (for 10kHz step rate).  When the 
destination location minus the time it took to accelerate is reached 
deceleration begins.  And since we decelerate at the same rate as accelerating 
and we have that same distance to move, once we reach 0 speed we've also 
reached the destination.
 
Now this could all be done outside the interrupt routine in a trajectory 
planner.  One could determine that it will take time X to reach either target 
speed or midpoint of the distance to move.  Broken into the 20kHz steps then 
the information could be fed into a FIFO so no math is done at all inside the 
interrupt routine.  It's only task would be to read this from FIFO one byte 
during each interrupt and write it to the port.   The interrupt routine could 
then run 40kHz and clear the port of step signals every second pulse.    If 
there is no motion the FIFO, flagged as empty, holds the last entry for the 
port and it's just mirrored out to the port.  
 
So how is it done in the Beaglebone with MachineKit.  Is there a function that 
reads a FIFO filled by the trajectory planner or is it done yet some other way? 
  I would look it up but don't even know where to start.
 
Obviously there's probably more going on under the covers to deal with hard 
limits.  Seems like soft limits are dealt with before motion starts with the 
option to not move because it will exceed machine limits.
 
Thanks
John Dammeyer
 
 
 

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/023801d5fd7e%242a472570%247ed57050%24%40autoartisans.com.

Reply via email to