Hello,

I have been following this thread.  I wrote some code that runs on an RPI that can read a quadrature encoder, I have a few of them, with different resolutions.

I also have a few encoders that came with some stepper motors I got my hands on, still have to play with those to see what it is they exactly do.


I saw this thread about "HAL programming", I don't know much about linux-cnc/HAL, if anything, but is there some "general" interface so one could 'feed' linux cnc

data from an encoder?


I started  playing/messing with these things, because it seems that linux-cnc has a hard time keeping up with these encoders and there's not a whole lot I could find

about how to make a spindle encoder work with linux cnc


Ron


On 5/24/20 3:41 PM, John Dammeyer wrote:
The
http://linuxcnc.org/docs/html/examples/spindle.html#_spindle_feedback
document lists this example code with a footnote on the use of encoder.3

"In this example, we will assume that some encoders have already been issued to 
axes/joints 0, 1, and 2. So the next encoder available for us to attach to the spindle 
would be number 3. Your situation may differ."

The document isn't clear to me on this.  If I do not have encoders issued for 
axes/joints 0,1,2 then can the spindle use encoer.0?  Or are those numbers reserved 
for the existing axis anyway?  Which I guess doesn't make sense because then there 
would also have to be encoders for axis a,b & c and the spindle would start at 
6.  I've probably answered my own question.

But if the spindle encoder is declared in the hal file first, as encoder.0, does 
that make x,y & z then encoder.1, encoder.2 and encoder.3?

Or by default if encoders are used with x,y &z are they then by default 0,1 & 2?  
And even if declared in the hal file in a different order must be allocated as 0, 1 & 2?

Enquiring minds need to know.
Thanks
John


# add the encoder to HAL and attach it to threads.
loadrt encoder num_chan=1
addf encoder.update-counters base-thread
addf encoder.capture-position servo-thread

# set the HAL encoder to 100 pulses per revolution.
setp encoder.3.position-scale 100

# set the HAL encoder to non-quadrature simple counting using A only.
setp encoder.3.counter-mode true

# connect the HAL encoder outputs to LinuxCNC.
net spindle-position encoder.3.position => motion.spindle-revs
net spindle-velocity encoder.3.velocity => motion.spindle-speed-in
net spindle-index-enable encoder.3.index-enable <=> motion.spindle-index-enable

# connect the HAL encoder inputs to the real encoder.
net spindle-phase-a encoder.3.phase-A <= parport.0.pin-10-in
net spindle-phase-b encoder.3.phase-B
net spindle-index encoder.3.phase-Z <= parport.0.pin-11-in





_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to