rozważania o CNC

Marzec 29, 2024, 04:01:33
Witamy, Gość. Zaloguj się lub zarejestruj.

Zaloguj się podając nazwę użytkownika, hasło i długość sesji
Strony: [1]   Do dołu
  Drukuj  
Autor Wątek: oprogramowanie enkodera w EMC2  (Przeczytany 26145 razy)
markcomp
Administrator
*****
Offline Offline

Wiadomości: 14877



WWW
« : Sierpień 17, 2011, 12:18:45 »

oprogramowanie enkodera w EMC2



Quadrature Encoder - enkoder kwadraturowy
sygnały A i B pozwalają określić przemieszczenie i kierunek przemieszczenia...
różnica faz A i B określa kierunek przesunięcia (obrotu)


z http://forum-cnc.pl/index.php/topic,600.0.html



CNC Lathe Spindle Encoder
http://members.shaw.ca/swstuff/spindle-encoder.html

Cytuj

This project was dreamed up late one evening when I decided I wanted to be able to use the CNC capabilities of my lathe to cut threads. I use EMC2 software running under a realtime patched Ubuntu kernel. In order for the lathe threading to function under computer control, the computer must know where the chuck spindle is located so that the position of the cutting tool may be phase locked to the rotation of the chuck. This project implements a homemade quadrature encoder with 360 counts/revolution and an index pulse. One of the easiest places to monitor the position of the headstock spindle is at the main drive pulley. The headstock on this lathe has a large diameter cast iron pulley that makes it quite easy to mount an encoder wheel. The first job was to cut an encoder wheel. To do this I used a 0.047" endmill to cut the encoder out of kitchen cabinet laminate (tradename Arborite). The encoder disk was bolted to the cast iron spindle pulley by drilling and taping for 6 6-32 bolts....





EMC Components
http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?EMC_Components


wątek z CNCzone
EMC2 and a rotary encoder
http://www.cnczone.com/forums/emc_linux_enhanced_machine_control/68838-emc2_rotary_encoder.html

Kod:
#############################################################
#Spindle Sensor
#############################################################
# load encoder stuff
loadrt encoder num_chan=1
loadrt scale count=1
loadrt lowpass count=1
# counter mode
setp encoder.0.counter-mode 1
# 100 counts per encoder rev
setp encoder.0.position-scale 100

# encoder reset control
# hook up motion controller's sync output
net spindle-index-enable motion.spindle-index-enable <=> encoder.0.index-enable

# hook up spindle encoder
net spindle-index parport.0.pin-15-in encoder.0.phase-Z
net SpindleEncoderA parport.0.pin-13-in encoder.0.phase-A
#net SpindleEncoderB parport.0.pin-12-in encoder.0.phase-B

# spindle speed
net spindle-pos encoder.0.position => motion.spindle-revs
net spindle-spd-rps encoder.0.velocity scale.0.in motion.spindle-speed-in
net spindle-spd-rpm scale.0.out lowpass.0.in
setp scale.0.gain 60
net spindle-spd-rpm-filt lowpass.0.out
setp lowpass.0.gain 0.01

# count spindle encoder pulses
addf encoder.update-counters base-thread
addf encoder.capture-position servo-thread
addf lowpass.0 servo-thread
addf scale.0 servo-thread



Lathe with servo drive STEP/DIR and encoder
http://www.linuxcnc.org/index.php?option=com_kunena&Itemid=20&func=view&catid=30&id=5487&lang=english

http://youtu.be/78KhQUvVncA

« Ostatnia zmiana: Sierpień 17, 2011, 02:28:45 wysłane przez markcomp » Zapisane

MARKcomp77

http://oferta.forum-cnc.pl/
Sterowniki.Silniki

markcomp
Administrator
*****
Offline Offline

Wiadomości: 14877



WWW
« Odpowiedz #1 : Sierpień 17, 2011, 10:42:21 »

Spindle Feedback
from:
http://www.linuxcnc.org/docview/html/examples_spindle.html


Spindle Synchronized Motion

Spindle feedback is needed by EMC to perform any spindle coordinated motions like threading and constant surface speed. The StepConf Wizard can perform the connections for you if you select Encoder Phase A and Encoder Index as inputs.

Hardware assumptions:
  • An encoder is connected to the spindle and puts out 100 pulses per revolution on phase A
  • The encoder A phase is connected to the parallel port pin 10
  • The encoder index pulse is connected to the parallel port pin 11

Basic Steps to add the components and configure them:
Kod:
loadrt encoder num_chan=1
addf encoder.update-counters base-thread
addf encoder.capture-position servo-thread
setp encoder.0.position-scale 100
net spindle-position encoder.0.position    motion.spindle-revs
net spindle-index-enable encoder.0.index-enable     motion.spindle-index-enable
net spindle-phase-a encoder.0.phase-A
net spindle-phase-b encoder.0.phase-B
net spindle-index encoder.0.phase-Z
net spindle-phase-a    parport.0.pin-10-in
net spindle-index    parport.0.pin-11-in
« Ostatnia zmiana: Sierpień 17, 2011, 10:49:29 wysłane przez markcomp » Zapisane

MARKcomp77

http://oferta.forum-cnc.pl/
Sterowniki.Silniki

markcomp
Administrator
*****
Offline Offline

Wiadomości: 14877



WWW
« Odpowiedz #2 : Sierpień 17, 2011, 10:53:26 »

Encoder
http://linuxcnc.org/docs/html/hal_rtcomps.html#sec:Encoder


This component provides software based counting of signals from quadrature encoders. It is a realtime component only, and depending on CPU speed, etc, is capable of maximum count rates of 10kHz to perhaps 50kHz. Figure [.] is a block diagram of one channel of encoder counter.





Installing

Kod:
emc2$ halcmd loadrt encoder [num_chan=<counters>]

<counters> is the number of encoder counters that you want to install. If numchan is not specified, three counters will be installed. The maximum number of counters is 8 (as defined by MAX_CHAN in encoder.c). Each counter is independent, but all are updated by the same function(s) at the same time. In the following descriptions, <chan> is the number of a specific counter. The first counter is number 0.



Removing

Kod:
emc2$ halcmd unloadrt encoder



Pins

Kod:
(bit) encoder.<chan>.phase-A -- Phase A of the quadrature encoder signal.
(bit) encoder.<chan>.phase-B -- Phase B of the quadrature encoder signal.
(bit) encoder.<chan>.phase-Z -- Phase Z (index pulse) of the quadrature encoder signal.
(bit) encoder.<chan>.reset -- See canonical encoder interface, section [->].
(bit) encoder.<chan>.velocity -- Estimated speed of the quadrature signal.
(bit) encoder.<chan>.index-enable -- See canonical encoder interface.
(s32) encoder.<chan>.count -- See canonical encoder interface.
(float) encoder.<chan>.position -- See canonical encoder interface.



Parameters

Kod:
(s32) encoder.<chan>.raw-count -- The raw count value, updated by update-counters().
(bit) encoder.<chan>.x4-mode -- Sets encoder to 4x or 1x mode. The 1x mode is usefull for some jogwheels.
(float) encoder.<chan>.position-scale -- See canonical encoder interface, section [->].



Functions

The component exports two functions. Each function acts on all of the encoder counters - running different counters in different threads is not supported.

Kod:
(funct) encoder.update-counters -- High speed function to count pulses (no floating point).
(funct) encoder.capture-position -- Low speed function to update latches and scale position.
« Ostatnia zmiana: Sierpień 17, 2011, 10:57:16 wysłane przez markcomp » Zapisane

MARKcomp77

http://oferta.forum-cnc.pl/
Sterowniki.Silniki

Strony: [1]   Do góry
  Drukuj  
 
Skocz do:  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC
Manuscript design by Bloc Strona wygenerowana w 0.076 sekund z 18 zapytaniami.