Tytuł: Toolchange
Wiadomość wysłana przez: markcomp Sierpnia 07, 2014, 10:56:50
Toolchange
ToolChangerImplementation http://wiki.linuxcnc.org/cgi-bin/wiki.pl?ToolChangerImplementation
Overview of the Toolchange process http://wiki.linuxcnc.org/cgi-bin/wiki.pl?ToolChange
Tool Compensation http://linuxcnc.org/docs/html/gcode/tool_compensation.html
Homann Modio http://wiki.linuxcnc.org/cgi-bin/wiki.pl?ModIO (http://wiki.linuxcnc.org/uploads/modio_tc-1a.png)
STRATEGY TO BUILD THE NORTE TOOLCHANGER http://www.vdwalle.com/Norte/Strategy%20to%20Build%20the%20Norte%20Tool%20Changer.txt
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: markcomp Sierpnia 07, 2014, 01:49:15
Setting up a tool changer http://www.linuxcnc.org/emc2/index.php/italian/forum/10-advanced-configuration/16898-setting-up-a-tool-changer
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: markcomp Sierpnia 07, 2014, 02:08:53
tool changer component integreted on a axis http://www.linuxcnc.org/emc2/index.php/english/forum/10-advanced-configuration/27250-tool-changer-component-integreted-on-a-axis
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: markcomp Sierpnia 07, 2014, 02:23:53
http://linuxcnc.org/docs/html/man/man1/iocontrol.1.html
iocontrol − accepts NML I/O commands, interacts with HAL in userspace
These pins are created by the userspace IO controller, usually found in $LINUXCNC_HOME/bin/io
The signals are turned on and off in userspace - if you have strict timing requirements or simply need more i/o, consider using the realtime synchronized i/o provided by motion(9) instead.
The inifile is searched for in the directory from which halcmd was run, unless an absolute path is specified.
iocontrol.0.coolant-flood (Bit, Out) TRUE when flood coolant is requested iocontrol.0.coolant-mist (Bit, Out) TRUE when mist coolant is requested iocontrol.0.emc-enable-in (Bit, In) Should be driven FALSE when an external estop condition exists. iocontrol.0.lube (Bit, Out) TRUE when lube is requested iocontrol.0.lube_level (Bit, In) Should be driven FALSE when lubrication tank is empty. iocontrol.0.tool-change (Bit, Out) TRUE when a tool change is requested iocontrol.0.tool-changed (Bit, In) Should be driven TRUE when a tool change is completed. iocontrol.0.tool-number (s32, Out) Current tool number iocontrol.0.tool-prep-number (s32, Out) The number of the next tool, from the RS274NGC T-word iocontrol.0.tool-prep-pocket (s32, Out) The pocket number (location in tool storage mechanism) of the next tool, as described in the tool table iocontrol.0.tool-prepare (Bit, Out) TRUE when a Tn tool prepare is requested iocontrol.0.tool-prepared (Bit, In) Should be driven TRUE when a tool prepare is completed. iocontrol.0.user-enable-out (Bit, Out) FALSE when an internal estop condition exists iocontrol.0.user-request-enable (Bit, Out) TRUE when the user has requested that estop be cleared
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: markcomp Sierpnia 07, 2014, 02:35:32
EMC2 HAL component to implement ATC toolchanging in Denford ORAC CNC lathes
http://www.mgware.co.uk/LinuxCNC/oracchanger.comp
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: markcomp Sierpnia 07, 2014, 08:24:31
http://wiki.linuxcnc.org/cgi-bin/wiki.pl?ClassicLadderExamples
Lathe Tool Turret This is an example of how to implement a tool turret on a lathe using classicladder. This example should work for any size turret, mine is an eight position one. In this example the turret is driven by a stepper motor and has a solenoid actuated locking bar and an index pulse at tool one. Note that this example uses EMC 2.3.4 and will NOT work on EMC 2.2 or earlier due to the use of newer features. Also note that this is my first experience with ladder code, and EMC also for that matter. So this example is possibly not as well done as it could be. That said, it is an example.
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: markcomp Marca 03, 2017, 02:45:44
component toolchanger "zmianiacz Karuzela, z zapadką"; pin in bit tool-change "Potrzebna zmiana narzędzia"; pin out bit tool-changed "Sygnał zakończenia zmiany narzedzia"; pin in signed tool-prep-number "numer narzedzia do przygotowania"; pin out float position-cmd "pozycja do osiągnięcia przez stepgen"; pin out signed progress_level = 0 "stan: 0=oczekiwanie;1=ruch;2=nawrót"; param rw float move = 0.05 "obrót o kawałek"; param rw float windback = 0.2 "droga nawrotu"; param rw signed tool_range = 6 "ilość narzędzi"; variable float position = 1; variable signed current_tool = 1; license "GPL"; function _ ; ;;
FUNCTION(_) { switch (progress_level){
//---->>0 - oczekiwanie na sygnał tool-change - polecenie M6 case 0: // oczekiwanie if (tool_change){ position= position_cmd+tool_prep_number-current_tool + windback/2; if (current_tool > tool_prep_number) position += tool_range; progress_level = 1; //ruch } break;
//---->>1 - position-cmd - obrót - zmiana narzędzia case 1: // ruch if (position_cmd < position) position_cmd += move; else { position_cmd = position; position -= windback; progress_level = 2; //nawrót } break;
//----> 2 - ruch wsteczny (nawrót), w celu zatrzaśnięcia zapadki case 2: // nawrót - zatrzaśnięcie if (position_cmd > position) position_cmd -= move; else { tool_changed = 1; //signał <- narzędzie zminione current_tool = tool_prep_number; progress_level = 0; //przejdź do stanu oczekiwania } break;
//----> BŁĄD case 20: // błąd break; default: rtapi_print_msg(RTAPI_MSG_ERR,"Błąd zmieniacza"); progress_level = 20; } }
break;
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: cnc101 Marca 05, 2017, 08:16:27
component toolchanger "zmieniacz Karuzela, z zapadką";
pin in bit tool-change "Potrzebna zmiana narzędzia"; pin out bit tool-changed "Sygnał zakończenia zmiany narzedzia"; pin in signed tool-prep-number "numer narzędzia do przygotowania"; pin out float position-cmd "pozycja do osiągnięcia przez stepgen";
pin out float position-fb = 0 "pozycja bierząca zmieniacza";
pin in float motor-pos-cmd "komenda z axis.1.motor-pos-cmd"; pin out float motor-pos-fb "komenda dla axis.1.motor-pos-fb";
pin in bit home=0 "sygnał z axis.1.homed o wyzerowaniu osi";
pin out signed progress_level = 0 "stan: 0=oczekiwanie;1=ruch;2=nawrót";
param rw float move = 0.05 "obrót o kawałek"; param rw float windback = 0.2 "droga nawrotu"; param rw signed tool_range = 6 "ilość narzędzi";
variable float position = 1; variable signed current_tool; //"aktualny numer narzędzia"; variable float last_motor_pos_cmd=0;
license "GPL"; function _ ; ;;
FUNCTION(_) {
motor_pos_fb = motor_pos_cmd; //przepisanie komendy pozycji dla axis if (!(motor_pos_cmd==last_motor_pos_cmd)) position_cmd=motor_pos_cmd; last_motor_pos_cmd = motor_pos_cmd; switch (progress_level){
//---->>0 - oczekiwanie na sygnał tool-change - polecenie M6 case 0: // oczekiwanie if (! home) progress_level = 10; //zerowanie narzędzia if (tool_change){ position = position_cmd+tool_prep_number-current_tool + windback/2; if (current_tool > tool_prep_number) position += tool_range; progress_level = 1; //ruch } break;
//---->>1 - position-cmd - obrót - zmiana narzędzia case 1: // ruch if (position_cmd < position) { position_cmd += move; } else { position_cmd = position; position -= windback; progress_level = 2; //nawrót } break;
//----> 2 - ruch wsteczny (nawrót), w celu zatrzaśnięcia zapadki case 2: // nawrót - zatrzaśnięcie if (position_cmd > position) { position_cmd -= move; } else { tool_changed = 1; //signał <- narzędzie zminione current_tool = tool_prep_number; progress_level = 0; //przejdź do stanu oczekiwania } break; //----> 10 - zerowanie narzędzia case 10: // wymaga ustawienia narzędzia if (home) { current_tool =1; position = position_cmd+tool_prep_number-current_tool + windback/2; if (current_tool > tool_prep_number) position += tool_range; progress_level = 1; //ruch } //ew. procedura zerowania, po zainstalowaniu switcha home break;
//----> BŁĄD case 20: // błąd break; default: // rtapi_print_msg(RTAPI_MSG_ERR,"Błąd zmieniacza"); progress_level = 20; } }
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: cnc101 Marca 05, 2017, 08:20:44
custom.hal # Tutaj dodaj swoje polecenia HAL # Ten plik nie zostanie nadpisany gdy uruchomisz ponownie Stepconf
#odłączenie domyślnych łączy zmianacza "pustego" #net tool-number <= iocontrol.0.tool-prep-number #net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed #net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared unlinkp iocontrol.0.tool-change unlinkp iocontrol.0.tool-changed unlinkp iocontrol.0.tool-prep-number unlinkp iocontrol.0.tool-prepare unlinkp iocontrol.0.tool-prepared
#wyłączenie komend dla osi Y (1) #net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd unlinkp axis.1.motor-pos-cmd unlinkp stepgen.1.position-cmd
#wyłączenie pokazania pozycji osi Y (1) #net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb unlinkp stepgen.1.position-fb unlinkp axis.1.motor-pos-fb
#załadowanie zmieniacza toolchanger loadrt toolchanger #zmieniacz do wątku sevo-thread addf toolchanger.0 servo-thread
#łącza dla zmianiacza net tool-change iocontrol.0.tool-change => toolchanger.0.tool-change net tool-changed iocontrol.0.tool-changed <= toolchanger.0.tool-changed net tool-number iocontrol.0.tool-prep-number => toolchanger.0.tool-prep-number
#zmieniacz wymusza pozycję stepgena (silnika) net pos-cmd toolchanger.0.position-cmd => stepgen.1.position-cmd
net pos-fb toolchanger.0.position-fb axis.1.motor-pos-fb
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
#oszukanie środowiska axis unlinkp axis.1.motor-pos-cmd unlinkp axis.1.motor-pos-fb
#sygnał pozycji z axis -> do net ypos-cmd-fb axis.1.motor-pos-cmd => toolchanger.0.motor-pos-cmd net ypos-fb toolchanger.0.motor-pos-fb => axis.1.motor-pos-fb
#komenda do sterowania ręcznego zmieniaczem #net yyypos-cmd-fb toolchanger.0.motor-pos-cmd
#informacja z axis o wyzerowaniu osi Y (1) - axis.1.homed
net yhomed axis.1.homed => toolchanger.0.home
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: cnc101 Marca 07, 2017, 03:41:31
component toolchanger "zmieniacz Karuzela, z zapadką";
pin in bit tool-change "Potrzebna zmiana narzędzia"; pin out bit tool-changed "Sygnał zakończenia zmiany narzedzia"; pin in signed tool-prep-number "numer narzędzia do przygotowania"; pin out float position-cmd "pozycja do osiągnięcia przez stepgen";
pin out float position-fb = 0 "pozycja bierząca zmieniacza";
pin in float motor-pos-cmd "komenda z axis.1.motor-pos-cmd"; pin out float motor-pos-fb "komenda dla axis.1.motor-pos-fb";
pin in bit home=0 "sygnał z axis.1.homed o wyzerowaniu osi";
pin out signed progress_level = 0 "stan: 0=oczekiwanie;1=ruch;2=nawrót";
param rw float move = 0.005 "obrót o kawałek"; param rw float scale = 5 "jedenostek na zmiana narzędzia o 1"; param rw float windback = 2 "droga nawrotu"; param rw signed tool_range = 6 "ilość narzędzi";
variable float position = 1; variable signed current_tool=1; //"aktualny numer narzędzia"; variable float last_motor_pos_cmd=0;
license "GPL"; function _ ; ;;
FUNCTION(_) {
//motor_pos_fb = motor_pos_cmd; //przepisanie komendy pozycji dla axis //if (!(motor_pos_cmd==last_motor_pos_cmd)) position_cmd=motor_pos_cmd; //last_motor_pos_cmd = motor_pos_cmd; switch (progress_level){
//---->>0 - oczekiwanie na sygnał tool-change - polecenie M6 case 0: // oczekiwanie if (! home) { progress_level = 10; //zerowanie narzędzia break; } if (tool_change){ position = position_cmd+scale*(tool_prep_number-current_tool)+windback/2; if (current_tool > tool_prep_number) position += scale*tool_range; progress_level = 1; //ruch } break;
//---->>1 - position-cmd - obrót - zmiana narzędzia case 1: // ruch if (position_cmd < position) { position_cmd += move; break; } position_cmd = position; position -= windback; progress_level = 2; //nawrót break;
//----> 2 - ruch wsteczny (nawrót), w celu zatrzaśnięcia zapadki case 2: // nawrót - zatrzaśnięcie if (position_cmd > position) { position_cmd -= move; break; } tool_changed = 1; //signał <- narzędzie zminione current_tool = tool_prep_number; progress_level = 0; //przejdź do stanu oczekiwania break; //----> 10 - zerowanie narzędzia case 10: // wymaga ustawienia narzędzia if (home) { current_tool =1; progress_level = 0; //oczekiwanie } //ew. procedura zerowania, po zainstalowaniu switcha home break;
//----> BŁĄD case 20: // błąd break; default: // rtapi_print_msg(RTAPI_MSG_ERR,"Błąd zmieniacza"); progress_level = 20; } }
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: cnc101 Marca 09, 2017, 03:30:30
component toolchanger "zmieniacz Karuzela, z zapadką";
pin in bit tool-change "Potrzebna zmiana narzędzia"; pin out bit tool-changed "Sygnał zakończenia zmiany narzedzia"; pin in signed tool-prep-number "numer narzędzia do przygotowania"; pin out float position-cmd "pozycja do osiągnięcia przez stepgen";
pin in float position-fb "pozycja bierząca silnika zmianiacza";
pin in float motor-pos-cmd "komenda z axis.1.motor-pos-cmd"; pin out float motor-pos-fb "komenda dla axis.1.motor-pos-fb";
pin in bit home "sygnał z axis.1.homed o wyzerowaniu osi";
pin out signed state = 0 "stan: 0=oczekiwanie;1=ruch;2=nawrót";
pin in signed current-tool "aktualny numer narzędzia";
param rw float move = 0.3 "obrót o kawałek"; param rw float scale = 4.6 "jedenostek na zmiana narzędzia o 1"; param rw float windback = 3 "droga nawrotu"; param rw signed tool_range = 6 "ilość narzędzi";
variable float position = 1; //variable signed current_tool=1; //"aktualny numer narzędzia"; variable float last_motor_pos_cmd=0;
license "GPL"; function _ ; ;;
FUNCTION(_) {
motor_pos_fb = motor_pos_cmd; //przepisanie komendy pozycji dla axis //if (!(motor_pos_cmd==last_motor_pos_cmd)) position_cmd=motor_pos_cmd; //last_motor_pos_cmd = motor_pos_cmd; switch (state){
//---->>0 - oczekiwanie na sygnał tool-change - polecenie M6 case 0: // oczekiwanie if (! home) { state = 10; //zerowanie narzędzia break; } if (tool_change){ position = position_fb+scale*(tool_prep_number-current_tool)+windback/2; if (current_tool > tool_prep_number) position += scale*tool_range; state = 1; //ruch } break;
//---->>1 - position-cmd - obrót - zmiana narzędzia case 1: // ruch if (abs(position_fb-position_cmd)>0.05) break; if (position_cmd < position) { position_cmd += move; break; } position_cmd = position; position -= windback; state = 2; //nawrót break;
//----> 2 - ruch wsteczny (nawrót), w celu zatrzaśnięcia zapadki case 2: // nawrót - zatrzaśnięcie if (abs(position_fb-position_cmd)>0.1) break; if (position_cmd > position) { position_cmd -= move; break; } tool_changed = 1; //signał <- narzędzie zminione //current_tool = tool_prep_number; state = 0; //przejdź do stanu oczekiwania break; //----> 10 - zerowanie narzędzia case 10: // wymaga ustawienia narzędzia if (home) { //current_tool =1; position = position_fb+scale*(tool_prep_number-current_tool)+windback/2; state = 1; //ruch //ew. procedura zerowania, po zainstalowaniu switcha home } break;
//----> BŁĄD case 20: // błąd break; default: // rtapi_print_msg(RTAPI_MSG_ERR,"Błąd zmieniacza"); state = 20; } }
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: cnc101 Marca 09, 2017, 03:31:05
# Tutaj dodaj swoje polecenia HAL # Ten plik nie zostanie nadpisany gdy uruchomisz ponownie Stepconf
#odłączenie domyślnych łączy zmianacza "pustego" #net tool-number <= iocontrol.0.tool-prep-number #net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed #net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared unlinkp iocontrol.0.tool-change unlinkp iocontrol.0.tool-changed unlinkp iocontrol.0.tool-prep-number unlinkp iocontrol.0.tool-prepare unlinkp iocontrol.0.tool-prepared
#wyłączenie komend dla osi Y (1) #net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd unlinkp axis.1.motor-pos-cmd unlinkp stepgen.1.position-cmd
#wyłączenie pokazania pozycji osi Y (1) #net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb unlinkp stepgen.1.position-fb unlinkp axis.1.motor-pos-fb
#załadowanie zmieniacza toolchanger loadrt toolchanger #zmieniacz do wątku sevo-thread addf toolchanger.0 servo-thread
#łącza dla zmianiacza net tool-change iocontrol.0.tool-change => toolchanger.0.tool-change net tool-changed iocontrol.0.tool-changed <= toolchanger.0.tool-changed
net tool-number iocontrol.0.tool-prep-number => toolchanger.0.tool-prep-number
net current-tool-number iocontrol.0.tool-number => toolchanger.0.current-tool
#zmieniacz wymusza pozycję stepgena (silnika) net pos-cmd toolchanger.0.position-cmd => stepgen.1.position-cmd net pos-fb toolchanger.0.position-fb <= stepgen.1.position-fb
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
#oszukanie środowiska axis unlinkp axis.1.motor-pos-cmd unlinkp axis.1.motor-pos-fb
#sygnał pozycji z axis -> do net ypos-cmd-fb axis.1.motor-pos-cmd => toolchanger.0.motor-pos-cmd net ypos-fb toolchanger.0.motor-pos-fb => axis.1.motor-pos-fb
#komenda do sterowania ręcznego zmieniaczem #net yyypos-cmd-fb toolchanger.0.motor-pos-cmd
#informacja z axis o wyzerowaniu osi Y (1) - axis.1.homed
net yhomed axis.1.homed => toolchanger.0.home
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: cnc101 Marca 09, 2017, 03:31:47
# Generated by stepconf 1.1 at Thu Mar 9 15:09:48 2017 # Jeśli zmodyfikujesz ten plik zmainy zostaną # nadpisane gdy uruchomisz ponownie Stepconf
[EMC] MACHINE = lathe_tc_02 DEBUG = 0
[DISPLAY] DISPLAY = axis EDITOR = gedit POSITION_OFFSET = RELATIVE POSITION_FEEDBACK = ACTUAL ARCDIVISION = 64 GRIDS = 10mm 20mm 50mm 100mm 1in 2in 5in 10in MAX_FEED_OVERRIDE = 1.2 MIN_SPINDLE_OVERRIDE = 0.5 MAX_SPINDLE_OVERRIDE = 1.2 DEFAULT_LINEAR_VELOCITY = 1.00 MIN_LINEAR_VELOCITY = 0 MAX_LINEAR_VELOCITY = 10.00 INTRO_GRAPHIC = linuxcnc.gif INTRO_TIME = 5 PROGRAM_PREFIX = /home/mark/linuxcnc/nc_files INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm
[FILTER] PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image PROGRAM_EXTENSION = .py Python Script png = image-to-gcode gif = image-to-gcode jpg = image-to-gcode py = python
[TASK] TASK = milltask CYCLE_TIME = 0.010
[RS274NGC] PARAMETER_FILE = linuxcnc.var
[EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 COMM_WAIT = 0.010 BASE_PERIOD = 50000 SERVO_PERIOD = 1000000
[HAL] HALFILE = lathe_tc_02.hal HALFILE = custom.hal POSTGUI_HALFILE = custom_postgui.hal
[TRAJ] AXES = 3 COORDINATES = X Y Z LINEAR_UNITS = mm ANGULAR_UNITS = degree CYCLE_TIME = 0.010 DEFAULT_VELOCITY = 1.00 MAX_VELOCITY = 10.00
[EMCIO] EMCIO = io CYCLE_TIME = 0.100 TOOL_TABLE = tool.tbl
[AXIS_0] TYPE = LINEAR HOME = 0.0 MAX_VELOCITY = 9.5 MAX_ACCELERATION = 200.0 STEPGEN_MAXACCEL = 250.0 SCALE = 2000.0 FERROR = 1 MIN_FERROR = .25 MIN_LIMIT = -10000.0 MAX_LIMIT = 10000.0 HOME_OFFSET = 0.0
[AXIS_1] TYPE = LINEAR HOME = 0.0 MAX_VELOCITY = 4.0 MAX_ACCELERATION = 15.0 STEPGEN_MAXACCEL = 18.75 SCALE = 2000.0 FERROR = 1 MIN_FERROR = .25 MIN_LIMIT = -10000.0 MAX_LIMIT = 10000.0 HOME_OFFSET = 0.000000 HOME_SEARCH_VEL = 1.500000 HOME_LATCH_VEL = 0.250000
[AXIS_2] TYPE = LINEAR HOME = 0.0 MAX_VELOCITY = 9.5 MAX_ACCELERATION = 200.0 STEPGEN_MAXACCEL = 250.0 SCALE = 2000.0 FERROR = 1 MIN_FERROR = .25 MIN_LIMIT = -10000.0 MAX_LIMIT = 10000.0 HOME_OFFSET = 0.0
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: cnc101 Marca 09, 2017, 03:32:15
# Generated by stepconf 1.1 at Thu Mar 9 15:09:48 2017 # Jeśli zmodyfikujesz ten plik zmainy zostaną # nadpisane gdy uruchomisz ponownie Stepconf loadrt trivkins loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES loadrt probe_parport loadrt hal_parport cfg="0xcf00 out 0xcd00 out" setp parport.0.reset-time 3000 loadrt stepgen step_type=0,0,0 loadrt pwmgen output_type=1
addf parport.0.read base-thread addf parport.1.read base-thread addf stepgen.make-pulses base-thread addf pwmgen.make-pulses base-thread addf parport.0.write base-thread addf parport.0.reset base-thread addf parport.1.write base-thread
addf stepgen.capture-position servo-thread addf motion-command-handler servo-thread addf motion-controller servo-thread addf stepgen.update-freq servo-thread addf pwmgen.update servo-thread
net spindle-cmd <= motion.spindle-speed-out => pwmgen.0.value net spindle-on <= motion.spindle-on => pwmgen.0.enable net spindle-pwm <= pwmgen.0.pwm setp pwmgen.0.pwm-freq 500.0 setp pwmgen.0.scale 3000.0 setp pwmgen.0.offset 0.0 setp pwmgen.0.dither-pwm true net spindle-at-speed => motion.spindle-at-speed net spindle-cw <= motion.spindle-forward net spindle-ccw <= motion.spindle-reverse net coolant-mist <= iocontrol.0.coolant-mist net coolant-flood <= iocontrol.0.coolant-flood
net spindle-pwm => parport.0.pin-01-out net xstep => parport.0.pin-02-out setp parport.0.pin-02-out-reset 1 net xdir => parport.0.pin-03-out net ystep => parport.0.pin-04-out setp parport.0.pin-04-out-reset 1 net ydir => parport.0.pin-05-out net zstep => parport.0.pin-06-out setp parport.0.pin-06-out-reset 1 net zdir => parport.0.pin-07-out setp parport.0.pin-08-out-invert 1 net xenable => parport.0.pin-08-out net coolant-mist => parport.0.pin-09-out net coolant-flood => parport.0.pin-14-out net spindle-cw => parport.0.pin-16-out net spindle-ccw => parport.0.pin-17-out
net home-y <= parport.0.pin-12-in
setp stepgen.0.position-scale [AXIS_0]SCALE setp stepgen.0.steplen 1 setp stepgen.0.stepspace 0 setp stepgen.0.dirhold 20000 setp stepgen.0.dirsetup 20000 setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb net xstep <= stepgen.0.step net xdir <= stepgen.0.dir net xenable axis.0.amp-enable-out => stepgen.0.enable
setp stepgen.1.position-scale [AXIS_1]SCALE setp stepgen.1.steplen 1 setp stepgen.1.stepspace 0 setp stepgen.1.dirhold 20000 setp stepgen.1.dirsetup 20000 setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb net ystep <= stepgen.1.step net ydir <= stepgen.1.dir net yenable axis.1.amp-enable-out => stepgen.1.enable net home-y => axis.1.home-sw-in
setp stepgen.2.position-scale [AXIS_2]SCALE setp stepgen.2.steplen 1 setp stepgen.2.stepspace 0 setp stepgen.2.dirhold 20000 setp stepgen.2.dirsetup 20000 setp stepgen.2.maxaccel [AXIS_2]STEPGEN_MAXACCEL net zpos-cmd axis.2.motor-pos-cmd => stepgen.2.position-cmd net zpos-fb stepgen.2.position-fb => axis.2.motor-pos-fb net zstep <= stepgen.2.step net zdir <= stepgen.2.dir net zenable axis.2.amp-enable-out => stepgen.2.enable
net estop-out <= iocontrol.0.user-enable-out net estop-out => iocontrol.0.emc-enable-in
net tool-number <= iocontrol.0.tool-prep-number net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: cnc101 Marca 10, 2017, 03:34:28
component toolchanger "zmieniacz Karuzela, z zapadką";
pin in bit tool-change "Potrzebna zmiana narzędzia"; pin out bit tool-changed "Sygnał zakończenia zmiany narzedzia"; pin in signed tool-prep-number "numer narzędzia do przygotowania"; pin out float position-cmd "pozycja do osiągnięcia przez stepgen";
pin in float position-fb "pozycja bierząca silnika zmianiacza";
pin in float motor-pos-cmd "komenda z axis.1.motor-pos-cmd"; pin out float motor-pos-fb "komenda dla axis.1.motor-pos-fb";
pin in bit home "sygnał z axis.1.homed o wyzerowaniu osi";
pin out signed state = 0 "stan: 0=oczekiwanie;1=ruch;2=nawrót";
pin in signed current-tool "aktualny numer narzędzia";
param rw float move = 0.3 "obrót o kawałek"; param rw float scale = 4.6 "jedenostek na zmiana narzędzia o 1"; param rw float windback = 3 "droga nawrotu"; param rw signed tool_range = 6 "ilość narzędzi";
variable float position = 1; //variable signed current_tool=1; //"aktualny numer narzędzia"; variable float last_motor_pos_cmd=0;
license "GPL"; function _ ; ;;
FUNCTION(_) {
motor_pos_fb = motor_pos_cmd; //przepisanie komendy pozycji dla axis //if (!(motor_pos_cmd==last_motor_pos_cmd)) position_cmd=motor_pos_cmd; //last_motor_pos_cmd = motor_pos_cmd; switch (state){
//---->>0 - oczekiwanie na sygnał tool-change - polecenie M6 case 0: // oczekiwanie if (! home) { state = 10; //zerowanie narzędzia break; } if (tool_change){ position = position_fb+scale*(tool_prep_number-current_tool)+windback/2; if (current_tool > tool_prep_number) position += scale*tool_range; state = 1; //ruch } break;
//---->>1 - position-cmd - obrót - zmiana narzędzia case 1: // ruch if (abs(position_fb-position_cmd)>0.05) break; if (position_cmd < position) { position_cmd += move; break; } position_cmd = position; position -= windback; state = 2; //nawrót break;
//----> 2 - ruch wsteczny (nawrót), w celu zatrzaśnięcia zapadki case 2: // nawrót - zatrzaśnięcie if (abs(position_fb-position_cmd)>0.1) break; if (position_cmd > position) { position_cmd -= move; break; } tool_changed = 1; //signał <- narzędzie zminione //current_tool = tool_prep_number; state = 0; //przejdź do stanu oczekiwania break; //----> 10 - zerowanie narzędzia case 10: // wymaga ustawienia narzędzia if (home) { //current_tool =1; position = position_fb+scale*(tool_prep_number-current_tool)+windback/2; state = 1; //ruch //ew. procedura zerowania, po zainstalowaniu switcha home } break;
//----> BŁĄD case 20: // błąd break; default: // rtapi_print_msg(RTAPI_MSG_ERR,"Błąd zmieniacza"); state = 20; } }
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: cnc101 Marca 10, 2017, 03:35:07
# Generated by stepconf 1.1 at Fri Mar 10 13:08:43 2017 # Jeśli zmodyfikujesz ten plik zmainy zostaną # nadpisane gdy uruchomisz ponownie Stepconf
[EMC] MACHINE = lathe_tc_w_03 DEBUG = 0
[DISPLAY] DISPLAY = axis EDITOR = gedit POSITION_OFFSET = RELATIVE POSITION_FEEDBACK = ACTUAL ARCDIVISION = 64 GRIDS = 10mm 20mm 50mm 100mm 1in 2in 5in 10in MAX_FEED_OVERRIDE = 1.2 MIN_SPINDLE_OVERRIDE = 0.5 MAX_SPINDLE_OVERRIDE = 1.2 DEFAULT_LINEAR_VELOCITY = 1.00 MIN_LINEAR_VELOCITY = 0 MAX_LINEAR_VELOCITY = 10.00 INTRO_GRAPHIC = linuxcnc.gif INTRO_TIME = 5 PROGRAM_PREFIX = /home/mark/linuxcnc/nc_files INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm
[FILTER] PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image PROGRAM_EXTENSION = .py Python Script png = image-to-gcode gif = image-to-gcode jpg = image-to-gcode py = python
[TASK] TASK = milltask CYCLE_TIME = 0.010
[RS274NGC] PARAMETER_FILE = linuxcnc.var
[EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 COMM_WAIT = 0.010 BASE_PERIOD = 50000 SERVO_PERIOD = 1000000
[HAL] HALFILE = lathe_tc_w_03.hal HALFILE = custom.hal POSTGUI_HALFILE = custom_postgui.hal
[TRAJ] AXES = 3 COORDINATES = X Y Z LINEAR_UNITS = mm ANGULAR_UNITS = degree CYCLE_TIME = 0.010 DEFAULT_VELOCITY = 1.00 MAX_VELOCITY = 10.00
[EMCIO] EMCIO = io CYCLE_TIME = 0.100 TOOL_TABLE = tool.tbl
[AXIS_0] TYPE = LINEAR HOME = 0.0 MAX_VELOCITY = 9.5 MAX_ACCELERATION = 200.0 STEPGEN_MAXACCEL = 250.0 SCALE = 2000.0 FERROR = 1 MIN_FERROR = .25 MIN_LIMIT = -10000.0 MAX_LIMIT = 10000.0 HOME_OFFSET = 0.0
[AXIS_1] TYPE = LINEAR HOME = 0.0 MAX_VELOCITY = 4.0 MAX_ACCELERATION = 15.0 STEPGEN_MAXACCEL = 18.75 SCALE = 2000.0 FERROR = 1 MIN_FERROR = .25 MIN_LIMIT = -10000.0 MAX_LIMIT = 10000.0 HOME_OFFSET = 0.000000 HOME_SEARCH_VEL = 1.500000 HOME_LATCH_VEL = 0.250000
[AXIS_2] TYPE = LINEAR HOME = 0.0 MAX_VELOCITY = 9.5 MAX_ACCELERATION = 200.0 STEPGEN_MAXACCEL = 250.0 SCALE = 2000.0 FERROR = 1 MIN_FERROR = .25 MIN_LIMIT = -10000.0 MAX_LIMIT = 10000.0 HOME_OFFSET = 0.0
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: cnc101 Marca 10, 2017, 03:35:50
# Generated by stepconf 1.1 at Fri Mar 10 13:08:43 2017 # Jeśli zmodyfikujesz ten plik zmainy zostaną # nadpisane gdy uruchomisz ponownie Stepconf loadrt trivkins loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES loadrt probe_parport loadrt hal_parport cfg="0xcf00 out 0xcd00 in" setp parport.0.reset-time 3000 loadrt stepgen step_type=0,0,0 loadrt pwmgen output_type=1
addf parport.0.read base-thread addf parport.1.read base-thread addf stepgen.make-pulses base-thread addf pwmgen.make-pulses base-thread addf parport.0.write base-thread addf parport.0.reset base-thread addf parport.1.write base-thread
addf stepgen.capture-position servo-thread addf motion-command-handler servo-thread addf motion-controller servo-thread addf stepgen.update-freq servo-thread addf pwmgen.update servo-thread
net spindle-cmd <= motion.spindle-speed-out => pwmgen.0.value net spindle-on <= motion.spindle-on => pwmgen.0.enable net spindle-pwm <= pwmgen.0.pwm setp pwmgen.0.pwm-freq 500.0 setp pwmgen.0.scale 3000.0 setp pwmgen.0.offset 0.0 setp pwmgen.0.dither-pwm true net spindle-at-speed => motion.spindle-at-speed net spindle-cw <= motion.spindle-forward net spindle-ccw <= motion.spindle-reverse net coolant-mist <= iocontrol.0.coolant-mist net coolant-flood <= iocontrol.0.coolant-flood net din-00 => motion.digital-in-00 net din-01 => motion.digital-in-01 net din-02 => motion.digital-in-02 net din-03 => motion.digital-in-03
net spindle-pwm => parport.0.pin-01-out net xstep => parport.0.pin-02-out setp parport.0.pin-02-out-reset 1 net xdir => parport.0.pin-03-out net ystep => parport.0.pin-04-out setp parport.0.pin-04-out-reset 1 net ydir => parport.0.pin-05-out net zstep => parport.0.pin-06-out setp parport.0.pin-06-out-reset 1 net zdir => parport.0.pin-07-out setp parport.0.pin-08-out-invert 1 net xenable => parport.0.pin-08-out net coolant-mist => parport.0.pin-09-out net coolant-flood => parport.0.pin-14-out net spindle-cw => parport.0.pin-16-out net spindle-ccw => parport.0.pin-17-out
net spindle-on => parport.1.pin-17-out
net home-y <= parport.0.pin-12-in
net din-00 <= parport.1.pin-03-in net din-01 <= parport.1.pin-04-in net din-02 <= parport.1.pin-05-in net din-03 <= parport.1.pin-06-in
setp stepgen.0.position-scale [AXIS_0]SCALE setp stepgen.0.steplen 1 setp stepgen.0.stepspace 0 setp stepgen.0.dirhold 20000 setp stepgen.0.dirsetup 20000 setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb net xstep <= stepgen.0.step net xdir <= stepgen.0.dir net xenable axis.0.amp-enable-out => stepgen.0.enable
setp stepgen.1.position-scale [AXIS_1]SCALE setp stepgen.1.steplen 1 setp stepgen.1.stepspace 0 setp stepgen.1.dirhold 20000 setp stepgen.1.dirsetup 20000 setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb net ystep <= stepgen.1.step net ydir <= stepgen.1.dir net yenable axis.1.amp-enable-out => stepgen.1.enable net home-y => axis.1.home-sw-in
setp stepgen.2.position-scale [AXIS_2]SCALE setp stepgen.2.steplen 1 setp stepgen.2.stepspace 0 setp stepgen.2.dirhold 20000 setp stepgen.2.dirsetup 20000 setp stepgen.2.maxaccel [AXIS_2]STEPGEN_MAXACCEL net zpos-cmd axis.2.motor-pos-cmd => stepgen.2.position-cmd net zpos-fb stepgen.2.position-fb => axis.2.motor-pos-fb net zstep <= stepgen.2.step net zdir <= stepgen.2.dir net zenable axis.2.amp-enable-out => stepgen.2.enable
net estop-out <= iocontrol.0.user-enable-out net estop-out => iocontrol.0.emc-enable-in
net tool-number <= iocontrol.0.tool-prep-number net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: cnc101 Marca 10, 2017, 03:36:29
# Tutaj dodaj swoje polecenia HAL # Ten plik nie zostanie nadpisany gdy uruchomisz ponownie Stepconf
#odłączenie domyślnych łączy zmianacza "pustego" #net tool-number <= iocontrol.0.tool-prep-number #net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed #net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared unlinkp iocontrol.0.tool-change unlinkp iocontrol.0.tool-changed unlinkp iocontrol.0.tool-prep-number unlinkp iocontrol.0.tool-prepare unlinkp iocontrol.0.tool-prepared
#wyłączenie komend dla osi Y (1) #net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd unlinkp axis.1.motor-pos-cmd unlinkp stepgen.1.position-cmd
#wyłączenie pokazania pozycji osi Y (1) #net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb unlinkp stepgen.1.position-fb unlinkp axis.1.motor-pos-fb
#załadowanie zmieniacza toolchanger loadrt toolchanger #zmieniacz do wątku sevo-thread addf toolchanger.0 servo-thread
#łącza dla zmianiacza net tool-change iocontrol.0.tool-change => toolchanger.0.tool-change net tool-changed iocontrol.0.tool-changed <= toolchanger.0.tool-changed
net tool-number iocontrol.0.tool-prep-number => toolchanger.0.tool-prep-number
net current-tool-number iocontrol.0.tool-number => toolchanger.0.current-tool
#zmieniacz wymusza pozycję stepgena (silnika) net pos-cmd toolchanger.0.position-cmd => stepgen.1.position-cmd net pos-fb toolchanger.0.position-fb <= stepgen.1.position-fb
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
#oszukanie środowiska axis unlinkp axis.1.motor-pos-cmd unlinkp axis.1.motor-pos-fb
#sygnał pozycji z axis -> do net ypos-cmd-fb axis.1.motor-pos-cmd => toolchanger.0.motor-pos-cmd net ypos-fb toolchanger.0.motor-pos-fb => axis.1.motor-pos-fb
#komenda do sterowania ręcznego zmieniaczem #net yyypos-cmd-fb toolchanger.0.motor-pos-cmd
#informacja z axis o wyzerowaniu osi Y (1) - axis.1.homed
net yhomed axis.1.homed => toolchanger.0.home
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: markcomp Marca 11, 2017, 01:23:33
http://linuxcnc.org/docs/html/man/man9/steptest.9.html http://linuxcnc.org/docs/html/man/man9/stepgen.9.html http://linuxcnc.org/docs/html/man/man9/motion.9.html
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: markcomp Marca 11, 2017, 01:25:35
STEPGEN
STEPGEN
NAME
SYNOPSIS
DESCRIPTION
FUNCTIONS
PINS
PARAMETERS
TIMING
SEE ALSO
NAME
stepgen −
software step pulse generation
SYNOPSIS
loadrt
stepgen step_type=type0[,type1...]
[ctrl_type=type0[,type1...]]
[user_step_type=#,#...]
DESCRIPTION
stepgen
is used to control stepper motors. The maximum step rate
depends on the CPU and other factors, and is usually in the
range of 5KHz to 25KHz. If higher rates are needed, a
hardware step generator is a better choice.
stepgen
has two control modes, which can be selected on a channel by
channel basis using ctrl_type. Possible values are
"p" for position control, and
"v" for velocity control. The default is
position control, which drives the motor to a commanded
position, subject to acceleration and velocity limits.
Velocity control drives the motor at a commanded speed,
again subject to accel and velocity limits. Usually,
position mode is used for machine axes. Velocity mode is
reserved for unusual applications where continuous movement
at some speed is desired, instead of movement to a specific
position. (Note that velocity mode replaces the former
component freqgen.)
stepgen
can control a maximum of 16 motors. The number of
motors/channels actually loaded depends on the number of
type values given. The value of each type
determines the outputs for that channel. Position or
velocity mode can be individually selected for each channel.
Both control modes support the same 16 possible step
types.
By far the most
common step type is ’0’, standard step and
direction. Others include up/down, quadrature, and a wide
variety of three, four, and five phase patterns that can be
used to directly control some types of motor windings. (When
used with appropriate buffers of course.)
Some of the
stepping types are described below, but for more details
(including timing diagrams) see the stepgen section
of the HAL reference manual.
type 0: step/dir
Two pins, one for step and one
for direction. make-pulses must run at least twice
for each step (once to set the step pin true, once to clear
it). This limits the maximum step rate to half (or less) of
the rate that can be reached by types 2-14. The parameters
steplen and stepspace can further lower the
maximum step rate. Parameters dirsetup and
dirhold also apply to this step type.
type 1: up/down
Two pins, one for ’step
up’ and one for ’step down’. Like type 0,
make-pulses must run twice per step, which limits the
maximum speed.
type 2: quadrature
Two pins, phase-A and phase-B.
For forward motion, A leads B. Can advance by one step every
time make-pulses runs.
type 3: three phase, full
step
Three pins, phase-A, phase-B,
and phase-C. Three steps per full cycle, then repeats. Only
one phase is high at a time - for forward motion the pattern
is A, then B, then C, then A again.
type 4: three phase, half
step
Three pins, phases A through C.
Six steps per full cycle. First A is high alone, then A and
B together, then B alone, then B and C together, etc.
types 5 through 8: four phase,
full step
Four pins, phases A through D.
Four steps per full cycle. Types 5 and 6 are suitable for
use with unipolar steppers, where power is applied to the
center tap of each winding, and four open-collector
transistors drive the ends. Types 7 and 8 are suitable for
bipolar steppers, driven by two H-bridges.
types 9 and 10: four phase,
half step
Four pins, phases A through D.
Eight steps per full cycle. Type 9 is suitable for unipolar
drive, and type 10 for bipolar drive.
types 11 and 12: five phase,
full step
Five pins, phases A through E.
Five steps per full cycle. See HAL reference manual for the
patterns.
types 13 and 14: five phase,
half step
Five pins, phases A through E.
Ten steps per full cycle. See HAL reference manual for the
patterns.
type 15: user-specified
This uses the waveform
specified by the user_step_type module parameter,
which may have up to 10 steps and 5 phases.
FUNCTIONS
stepgen.make-pulses
(no floating-point)
Generates the step pulses,
using information computed by update-freq. Must be
called as frequently as possible, to maximize the attainable
step rate and minimize jitter. Operates on all channels at
once.
stepgen.capture-position
(uses floating point)
Captures position feedback
value from the high speed code and makes it available on a
pin for use elsewhere in the system. Operates on all
channels at once.
stepgen.update-freq
(uses floating point)
Accepts a velocity or position
command and converts it into a form usable by
make-pulses for step generation. Operates on all
channels at once.
PINS
stepgen.N.counts
s32 out
The current position, in
counts, for channel N. Updated by
capture-position.
stepgen.N.position-fb
float out
The current position, in length
units (see parameter position-scale). Updated by
capture-position. The resolution of
position-fb is much finer than a single step. If you
need to see individual steps, use counts.
stepgen.N.enable
bit in
Enables output steps - when
false, no steps are generated.
stepgen.N.velocity-cmd
float in (velocity mode only)
Commanded velocity, in length
units per second (see parameter position-scale).
stepgen.N.position-cmd
float in (position mode only)
Commanded position, in length
units (see parameter position-scale).
stepgen.N.step
bit out (step type 0 only)
Step pulse output.
stepgen.N.dir
bit out (step type 0 only)
Direction output: low for
forward, high for reverse.
stepgen.N.up
bit out (step type 1 only)
Count up output, pulses for
forward steps.
stepgen.N.down
bit out (step type 1 only)
Count down output, pulses for
reverse steps.
stepgen.N.phase-A
thru phase-E bit out (step types 2-14 only)
Output bits. phase-A and
phase-B are present for step types 2-14,
phase-C for types 3-14, phase-D for types
5-14, and phase-E for types 11-14. Behavior depends
on selected stepping type.
PARAMETERS
stepgen.N.frequency
float ro
The current step rate, in steps
per second, for channel N.
stepgen.N.maxaccel
float rw
The acceleration/deceleration
limit, in length units per second squared.
stepgen.N.maxvel
float rw
The maximum allowable velocity,
in length units per second. If the requested maximum
velocity cannot be reached with the current combination of
scaling and make-pulses thread period, it will be
reset to the highest attainable value.
stepgen.N.position-scale
float rw
The scaling for position
feedback, position command, and velocity command, in steps
per length unit.
stepgen.N.rawcounts
s32 ro
The position in counts, as
updated by make-pulses. (Note: this is updated more
frequently than the counts pin.)
stepgen.N.steplen
u32 rw
The length of the step pulses,
in nanoseconds. Measured from rising edge to falling
edge.
stepgen.N.stepspace
u32 rw (step types 0 and 1 only) The minimum
space between step pulses, in
nanoseconds. Measured from falling edge to rising edge. The
actual time depends on the step rate and can be much longer.
If stepspace is 0, then step can be asserted
every period. This can be used in conjunction with
hal_parport’s auto-resetting pins to output one
step pulse per period. In this mode, steplen must be
set for one period or less.
stepgen.N.dirsetup
u32 rw (step type 0 only)
The minimum setup time from
direction to step, in nanoseconds periods. Measured from
change of direction to rising edge of step.
stepgen.N.dirhold
u32 rw (step type 0 only)
The minimum hold time of
direction after step, in nanoseconds. Measured from falling
edge of step to change of direction.
stepgen.N.dirdelay
u32 rw (step types 1 and higher only)
The minimum time between a
forward step and a reverse step, in nanoseconds.
TIMING
There are five
timing parameters which control the output waveform. No step
type uses all five, and only those which will be used are
exported to HAL. The values of these parameters are in
nano-seconds, so no recalculation is needed when changing
thread periods. In the timing diagrams that follow, they are
identfied by the following numbers:
(1)
stepgen.n.steplen
(2)
stepgen.n.stepspace
(3)
stepgen.n.dirhold
(4)
stepgen.n.dirsetup
(5)
stepgen.n.dirdelay
For step type
0, timing parameters 1 thru 4 are used. The following timing
diagram shows the output waveforms, and what each parameter
adjusts.
_____ _____ _____ STEP ____/ \_______/ \_____________/ \______ | | | | | | Time |-(1)-|--(2)--|-(1)-|--(3)--|-(4)-|-(1)-| |__________________ DIR ________________________________/
For step type
1, timing parameters 1, 2, and 5 are used. The following
timing diagram shows the output waveforms, and what each
parameter adjusts.
_____ _____ UP __/ \_____/ \________________________________ | | | | | Time |-(1)-|-(2)-|-(1)-|---(5)---|-(1)-|-(2)-|-(1)-| |_____| |_____| DOWN ______________________________/ \_____/ \____
For step types
2 and higher, the exact pattern of the outputs depends on
the step type (see the HAL manual for a full listing). The
outputs change from one state to another at a minimum
interval of steplen. When a direction change occurs,
the minimum time between the last step in one direction and
the first in the other direction is the sum of
steplen and dirdelay.
SEE ALSO
The HAL User
Manual.
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: markcomp Marca 11, 2017, 01:26:13
MOTION
MOTION
NAME
SYNOPSIS
DESCRIPTION
PINS
DEBUGGING PINS
PARAMETERS
FUNCTIONS
BUGS
SEE ALSO
NAME
motion −
accepts NML motion commands, interacts with HAL in
realtime
SYNOPSIS
loadrt
motmod [base_period_nsec=period]
[base_thread_fp=0 or 1]
[servo_period_nsec=period]
[traj_period_nsec=period]
[num_joints=[0-9]]
([num_dio=[1-64]]
[num_aio=[1-64]])
DESCRIPTION
By default, the
base thread does not support floating point. Software
stepping, software encoder counting, and software pwm do not
use floating point. base_thread_fp can be used to
enable floating point in the base thread (for example for
brushless DC motor control).
These pins and
parameters are created by the realtime motmod module.
This module provides a HAL interface for LinuxCNC’s
motion planner. Basically motmod takes in a list of
waypoints and generates a nice blended and
constraint-limited stream of joint positions to be fed to
the motor drives.
Optionally the
number of Digital I/O is set with num_dio. The number of
Analog I/O is set with num_aio. The default is 4 each.
Pin names
starting with "axis" are actually joint
values, but the pins and parameters are still called
"axis.N". They are read and updated
by the motion-controller function.
PINS
axis.N.amp-enable-out
OUT BIT
TRUE if the amplifier for this
joint should be enabled
axis.N.amp-fault-in
IN BIT
Should be driven TRUE if an
external fault is detected with the amplifier for this
joint
axis.N.home-sw-in
IN BIT
Should be driven TRUE if the
home switch for this joint is closed
axis.N.homing
OUT BIT
TRUE if the joint is currently
homing
axis.N.index-enable
IO BIT
Should be attached to the
index-enable pin of the joint’s encoder to enable
homing to index pulse
axis.N.is-unlocked
IN BIT
If the axis is a locked rotary
the unlocked sensor should be connected to this pin
axis.N.jog-counts
IN S32
Connect to the
"counts" pin of an external encoder to use a
physical jog wheel.
axis.N.jog-enable
IN BIT
When TRUE (and in manual mode),
any change to "jog-counts" will result in motion.
When false, "jog-counts" is ignored.
axis.N.jog-scale
IN FLOAT
Sets the distance moved for
each count on "jog-counts", in machine units.
axis.N.jog-vel-mode
IN BIT
When FALSE (the default), the
jogwheel operates in position mode. The axis will move
exactly jog-scale units for each count, regardless of how
long that might take. When TRUE, the wheel operates in
velocity mode - motion stops when the wheel stops, even if
that means the commanded motion is not completed.
axis.N.joint-pos-cmd
OUT FLOAT
The joint (as opposed to motor)
commanded position. There may be several offsets between the
joint and motor coordinates: backlash compensation, screw
error compensation, and home offsets.
axis.N.joint-pos-fb
OUT FLOAT
The joint feedback position.
This value is computed from the actual motor position minus
joint offsets. Useful for machine visualization.
axis.N.motor-pos-cmd
OUT FLOAT
The commanded position for this
joint.
axis.N.motor-pos-fb
IN FLOAT
The actual position for this
joint.
axis.N.neg-lim-sw-in
IN BIT
Should be driven TRUE if the
negative limit switch for this joint is tripped.
axis.N.pos-lim-sw-in
IN BIT
Should be driven TRUE if the
positive limit switch for this joint is tripped.
axis.N.unlock
OUT BIT
TRUE if the axis is a locked
rotary and a move is commanded.
motion.adaptive-feed IN
FLOAT
When adaptive feed is enabled
with M52 P1, the commanded velocity is multiplied by this
value. This effect is multiplicative with the NML-level feed
override value and motion.feed-hold.
motion.analog-in-NN
IN FLOAT
These pins are used by M66 Enn
wait-for-input mode.
motion.analog-out-NN
OUT FLOAT
These pins are used by
M67-68.
motion.coord-error OUT
BIT
TRUE when motion has
encountered an error, such as exceeding a soft limit
motion.coord-mode OUT
BIT
TRUE when motion is in
"coordinated mode", as opposed to "teleop
mode"
motion.current-vel OUT
FLOAT
Current cartesian velocity
motion.digital-in-NN
IN BIT
These pins are used by M66 Pnn
wait-for-input mode.
motion.digital-out-NN
OUT BIT
These pins are controlled by
the M62 through M65 words.
motion.distance-to-go
OUT FLOAT
Distance remaining in the
current move
motion.enable IN BIT
If this bit is driven FALSE,
motion stops, the machine is placed in the "machine
off" state, and a message is displayed for the
operator. For normal motion, drive this bit TRUE.
motion.feed-hold IN
BIT
When Feed Stop Control is
enabled with M53 P1, and this bit is TRUE, the feed rate is
set to 0.
motion.feed-inhibit IN
BIT
When this pin is TRUE, machine
motion is inhibited (this includes jogs, programmed feeds,
and programmed rapids, aka traverse moves).
If the machine
is performing a spindle synchronized move when this pin goes
TRUE, the spindle synchronized motion will finish, and any
following moves will be inhibited (this is to prevent damage
to the machine, the tool, or the work piece).
If the machine
is in the middle of a (non-spindle synchronized) move when
this pin goes TRUE, the machine will decelerate to a stop at
the maximum allowed acceleration rate.
Motion resumes
when this pin goes FALSE.
motion.in-position OUT
BIT
TRUE if the machine is in
position (ie, not currently moving towards the commanded
position).
motion.probe-input IN
BIT
G38.x uses the value on this
pin to determine when the probe has made contact. TRUE for
probe contact closed (touching), FALSE for probe contact
open.
motion.program-line OUT
S32
motion.requested-vel OUT FLOAT
The requested velocity with no
adjustments for feed override
motion.spindle-at-speed
IN BIT
Motion will pause until this
pin is TRUE, under the following conditions: before the
first feed move after each spindle start or speed change;
before the start of every chain of spindle-synchronized
moves; and if in CSS mode, at every rapid->feed
transition.
motion.spindle-brake OUT
BIT
TRUE when the spindle brake
should be applied
motion.spindle-forward
OUT BIT
TRUE when the spindle should
rotate forward
motion.spindle-index-enable
I/O BIT
For correct operation of
spindle synchronized moves, this signal must be hooked to
the index-enable pin of the spindle encoder.
motion.spindle-inhibit
IN BIT
When TRUE, the spindle speed is
set and held to 0.
motion.spindle-on OUT
BIT
TRUE when spindle should
rotate
motion.spindle-reverse
OUT BIT
TRUE when the spindle should
rotate backward
motion.spindle-revs IN
FLOAT
For correct operation of
spindle synchronized moves, this signal must be hooked to
the position pin of the spindle encoder.
motion.spindle-speed-in
IN FLOAT
Actual spindle speed feedback
in revolutions per second; used for G96 (constant surface
speed) and G95 (feed per revolution) modes.
motion.spindle-speed-out
OUT FLOAT
Desired spindle speed in
rotations per minute
motion.spindle-speed-out-abs
OUT FLOAT
Desired spindle speed in
rotations per minute, always positive regardless of spindle
direction.
motion.spindle-speed-out-rps
OUT float
Desired spindle speed in
rotations per second
motion.spindle-speed-out-rps-abs
OUT float
Desired spindle speed in
rotations per second, always positive regardless of spindle
direction.
motion.spindle-orient-angle
OUT FLOAT
Desired spindle orientation for
M19. Value of the M19 R word parameter plus the value of the
[RS274NGC]ORIENT_OFFSET ini parameter.
motion.spindle-orient-mode
OUT BIT
Desired spindle rotation mode.
Reflects M19 P parameter word.
motion.spindle-orient
OUT BIT
Indicates start of spindle
orient cycle. Set by M19. Cleared by any of M3,M4,M5. If
spindle-orient-fault is not zero during spindle-orient true,
the M19 command fails with an error message.
motion.spindle-is-oriented
IN BIT
Acknowledge pin for
spindle-orient. Completes orient cycle. If spindle-orient
was true when spindle-is-oriented was asserted, the
spindle-orient pin is cleared and the spindle-locked pin is
asserted. Also, the spindle-brake pin is asserted.
motion.spindle-orient-fault
IN S32
Fault code input for orient
cycle. Any value other than zero will cause the orient cycle
to abort.
motion.spindle-locked
OUT BIT
Spindle orient complete pin.
Cleared by any of M3,M4,M5.
motion.teleop-mode OUT
bit
motion.tooloffset.x OUT FLOAT
motion.tooloffset.y OUT FLOAT
motion.tooloffset.z OUT FLOAT
motion.tooloffset.a OUT FLOAT
motion.tooloffset.b OUT FLOAT
motion.tooloffset.c OUT FLOAT
motion.tooloffset.u OUT FLOAT
motion.tooloffset.v OUT FLOAT
motion.tooloffset.w OUT FLOAT
Current tool offset in all 9
axes.
DEBUGGING PINS
Many of the
pins below serve as debugging aids, and are subject to
change or removal at any time.
axis.N.active OUT BIT
TRUE when this joint is
active
axis.N.backlash-corr
OUT FLOAT
Backlash or screw compensation
raw value
axis.N.backlash-filt
OUT FLOAT
Backlash or screw compensation
filtered value (respecting motion limits)
axis.N.backlash-vel
OUT FLOAT
Backlash or screw compensation
velocity
axis.N.coarse-pos-cmd
OUT FLOAT
axis.N.error OUT BIT
TRUE when this joint has
encountered an error, such as a limit switch closing
axis.N.f-error
OUT FLOAT
The actual following error
axis.N.f-error-lim
OUT FLOAT
The following error limit
axis.N.f-errored
OUT BIT
TRUE when this joint has
exceeded the following error limit
axis.N.faulted
OUT BIT
axis.N.free-pos-cmd OUT FLOAT
The "free planner"
commanded position for this joint.
axis.N.free-tp-enable
OUT BIT
TRUE when the "free
planner" is enabled for this joint
axis.N.free-vel-lim
OUT FLOAT
The velocity limit for the free
planner
axis.N.homed
OUT BIT
TRUE if the joint has been
homed
axis.N.in-position
OUT BIT
TRUE if the joint is using the
"free planner" and has come to a stop
axis.N.joint-vel-cmd
OUT FLOAT
The joint’s commanded
velocity
axis.N.kb-jog-active
OUT BIT
axis.N.neg-hard-limit OUT BIT
The negative hard limit for the
joint
axis.N.pos-hard-limit
OUT BIT
The positive hard limit for the
joint
axis.N.wheel-jog-active
OUT BIT
motion.motion-enabled OUT BIT
motion.motion-type OUT S32
These values are from
src/emc/nml_intf/motion_types.h
1: Traverse
2: Linear
feed
3: Arc feed
4: Tool
change
5: Probing
6: Rotary axis
indexing
motion.on-soft-limit OUT
BIT
motion.program-line OUT S32
motion.teleop-mode OUT BIT
TRUE when motion is in
"teleop mode", as opposed to "coordinated
mode"
PARAMETERS
Many of the
parameters serve as debugging aids, and are subject to
change or removal at any time.
motion-command-handler.time
motion-command-handler.tmax
motion-controller.time
motion-controller.tmax
Show information about the
execution time of these HAL functions in CPU cycles
motion.debug-*
These values are used for
debugging purposes.
motion.servo.last-period
The number of CPU cycles
between invocations of the servo thread. Typically, this
number divided by the CPU speed gives the time in seconds,
and can be used to determine whether the realtime motion
controller is meeting its timing constraints
FUNCTIONS
Generally,
these functions are both added to the servo-thread in the
order shown.
motion-command-handler
Processes motion commands
coming from user space
motion-controller
Runs the LinuxCNC motion
controller
BUGS
This manual
page is horribly incomplete.
SEE ALSO
iocontrol(1)
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: markcomp Marca 11, 2017, 01:26:56
STEPTEST
STEPTEST
NAME
SYNOPSIS
FUNCTIONS
PINS
PARAMETERS
LICENSE
NAME
steptest
− Used by Stepconf to allow testing of acceleration
and velocity values for an axis.
SYNOPSIS
|
loadrt steptest
[count=N|names=name1[,name2...]] |
|
FUNCTIONS
steptest.N
(requires a floating-point thread)
PINS
steptest.N.jog-minus
bit in
Drive TRUE to jog the axis in
its minus direction
steptest.N.jog-plus
bit in
Drive TRUE to jog the axis in
its positive direction
steptest.N.run
bit in
Drive TRUE to run the axis near
its current position_fb with a trapezoidal velocity
profile
steptest.N.maxvel
float in
Maximum velocity
steptest.N.maxaccel
float in
Permitted Acceleration
steptest.N.amplitude
float in
Approximate amplitude of
positions to command during ’run’
steptest.N.dir
s32 in
Direction from central point to
test: 0 = both, 1 = positive, 2 = negative
steptest.N.position-cmd
float out
steptest.N.position-fb float in
steptest.N.running bit out
steptest.N.run-target float out
steptest.N.run-start float out
steptest.N.run-low float out
steptest.N.run-high float out
steptest.N.pause s32 in (default:
0)
pause time for each end of run
in seconds
PARAMETERS
steptest.N.epsilon
float rw (default: .001)
steptest.N.elapsed float r
Current value of the internal
timer
LICENSE
GPL
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: cnc101 Marca 14, 2017, 11:15:38
# Generated by stepconf 1.1 at Tue Mar 14 07:38:07 2017 # Jeśli zmodyfikujesz ten plik zmainy zostaną # nadpisane gdy uruchomisz ponownie Stepconf
[EMC] MACHINE = lathe_tc_w_03 DEBUG = 0
[DISPLAY] DISPLAY = axis EDITOR = gedit POSITION_OFFSET = RELATIVE POSITION_FEEDBACK = ACTUAL ARCDIVISION = 64 GRIDS = 10mm 20mm 50mm 100mm 1in 2in 5in 10in MAX_FEED_OVERRIDE = 1.2 MIN_SPINDLE_OVERRIDE = 0.5 MAX_SPINDLE_OVERRIDE = 1.2 DEFAULT_LINEAR_VELOCITY = 1.00 MIN_LINEAR_VELOCITY = 0 MAX_LINEAR_VELOCITY = 10.00 INTRO_GRAPHIC = linuxcnc.gif INTRO_TIME = 5 PROGRAM_PREFIX = /home/mark/linuxcnc/nc_files INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm
[FILTER] PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image PROGRAM_EXTENSION = .py Python Script png = image-to-gcode gif = image-to-gcode jpg = image-to-gcode py = python
[TASK] TASK = milltask CYCLE_TIME = 0.010
[RS274NGC] PARAMETER_FILE = linuxcnc.var
[EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 COMM_WAIT = 0.010 BASE_PERIOD = 50000 SERVO_PERIOD = 1000000
[HAL] HALFILE = lathe_tc_w_03.hal HALFILE = custom.hal POSTGUI_HALFILE = custom_postgui.hal
[TRAJ] AXES = 3 COORDINATES = X Y Z LINEAR_UNITS = mm ANGULAR_UNITS = degree CYCLE_TIME = 0.010 DEFAULT_VELOCITY = 1.00 MAX_VELOCITY = 10.00
[EMCIO] EMCIO = io CYCLE_TIME = 0.100 TOOL_TABLE = tool.tbl
[AXIS_0] TYPE = LINEAR HOME = 0.0 MAX_VELOCITY = 9.5 MAX_ACCELERATION = 200.0 STEPGEN_MAXACCEL = 250.0 SCALE = 2000.0 FERROR = 1 MIN_FERROR = .25 MIN_LIMIT = -10000.0 MAX_LIMIT = 10000.0 HOME_OFFSET = 0.0
[AXIS_1] TYPE = LINEAR HOME = 0.0 MAX_VELOCITY = 4.0 MAX_ACCELERATION = 15.0 STEPGEN_MAXACCEL = 18.75 SCALE = 2000.0 FERROR = 1 MIN_FERROR = .25 MIN_LIMIT = -10000.0 MAX_LIMIT = 10000.0 HOME_OFFSET = 0.0
[AXIS_2] TYPE = LINEAR HOME = 0.0 MAX_VELOCITY = 9.5 MAX_ACCELERATION = 200.0 STEPGEN_MAXACCEL = 250.0 SCALE = 2000.0 FERROR = 1 MIN_FERROR = .25 MIN_LIMIT = -10000.0 MAX_LIMIT = 10000.0 HOME_OFFSET = 0.0
# Generated by stepconf 1.1 at Tue Mar 14 07:38:07 2017 # Jeśli zmodyfikujesz ten plik zmainy zostaną # nadpisane gdy uruchomisz ponownie Stepconf loadrt trivkins loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES loadrt probe_parport loadrt hal_parport cfg="0xcf00 out 0xcd00 in" setp parport.0.reset-time 3000 loadrt stepgen step_type=0,0,0 loadrt pwmgen output_type=1
addf parport.0.read base-thread addf parport.1.read base-thread addf stepgen.make-pulses base-thread addf pwmgen.make-pulses base-thread addf parport.0.write base-thread addf parport.0.reset base-thread addf parport.1.write base-thread
addf stepgen.capture-position servo-thread addf motion-command-handler servo-thread addf motion-controller servo-thread addf stepgen.update-freq servo-thread addf pwmgen.update servo-thread
net spindle-cmd <= motion.spindle-speed-out => pwmgen.0.value net spindle-on <= motion.spindle-on => pwmgen.0.enable net spindle-pwm <= pwmgen.0.pwm setp pwmgen.0.pwm-freq 500.0 setp pwmgen.0.scale 3000.0 setp pwmgen.0.offset 0.0 setp pwmgen.0.dither-pwm true net spindle-at-speed => motion.spindle-at-speed net spindle-cw <= motion.spindle-forward net spindle-ccw <= motion.spindle-reverse net coolant-mist <= iocontrol.0.coolant-mist net coolant-flood <= iocontrol.0.coolant-flood
net spindle-pwm => parport.0.pin-01-out net xstep => parport.0.pin-02-out setp parport.0.pin-02-out-reset 1 net xdir => parport.0.pin-03-out net ystep => parport.0.pin-04-out setp parport.0.pin-04-out-reset 1 net ydir => parport.0.pin-05-out net zstep => parport.0.pin-06-out setp parport.0.pin-06-out-reset 1 net zdir => parport.0.pin-07-out setp parport.0.pin-08-out-invert 1 net xenable => parport.0.pin-08-out net coolant-mist => parport.0.pin-09-out net coolant-flood => parport.0.pin-14-out net spindle-cw => parport.0.pin-16-out net spindle-ccw => parport.0.pin-17-out
net spindle-on => parport.1.pin-17-out
setp stepgen.0.position-scale [AXIS_0]SCALE setp stepgen.0.steplen 1 setp stepgen.0.stepspace 0 setp stepgen.0.dirhold 20000 setp stepgen.0.dirsetup 20000 setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb net xstep <= stepgen.0.step net xdir <= stepgen.0.dir net xenable axis.0.amp-enable-out => stepgen.0.enable
setp stepgen.1.position-scale [AXIS_1]SCALE setp stepgen.1.steplen 1 setp stepgen.1.stepspace 0 setp stepgen.1.dirhold 20000 setp stepgen.1.dirsetup 20000 setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb net ystep <= stepgen.1.step net ydir <= stepgen.1.dir net yenable axis.1.amp-enable-out => stepgen.1.enable
setp stepgen.2.position-scale [AXIS_2]SCALE setp stepgen.2.steplen 1 setp stepgen.2.stepspace 0 setp stepgen.2.dirhold 20000 setp stepgen.2.dirsetup 20000 setp stepgen.2.maxaccel [AXIS_2]STEPGEN_MAXACCEL net zpos-cmd axis.2.motor-pos-cmd => stepgen.2.position-cmd net zpos-fb stepgen.2.position-fb => axis.2.motor-pos-fb net zstep <= stepgen.2.step net zdir <= stepgen.2.dir net zenable axis.2.amp-enable-out => stepgen.2.enable
net estop-out <= iocontrol.0.user-enable-out net estop-out => iocontrol.0.emc-enable-in
net tool-number <= iocontrol.0.tool-prep-number net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
component toolchanger "zmieniacz Karuzela, z zapadką";
pin in bit tool-change "Potrzebna zmiana narzędzia"; pin out bit tool-changed "Sygnał zakończenia zmiany narzedzia"; pin in signed tool-prep-number "numer narzędzia do przygotowania"; pin out float position-cmd "pozycja do osiągnięcia przez stepgen";
pin in float position-fb "pozycja bierząca silnika zmianiacza";
pin in float motor-pos-cmd "komenda z axis.1.motor-pos-cmd"; pin out float motor-pos-fb "komenda dla axis.1.motor-pos-fb";
pin in bit home "pin lpt parport.1.pin-04-in do zerowania"; pin out bit homed=0 "czy wyzerowane";
pin out signed state = 0 "stan: 0=oczekiwanie;1=ruch;2=nawrót";
pin in signed current-tool "aktualny numer narzędzia";
param rw float move = 0.3 "obrót o kawałek"; param rw float scale = 4.6 "jedenostek na zmiana narzędzia o 1"; param rw float windback = 3 "droga nawrotu"; param rw signed tool_range = 6 "ilość narzędzi";
variable float position = 1; //variable signed current_tool=1; //"aktualny numer narzędzia"; variable float last_motor_pos_cmd=0;
license "GPL"; function _ ; ;;
FUNCTION(_) {
motor_pos_fb = motor_pos_cmd; //przepisanie komendy pozycji dla axis //if (!(motor_pos_cmd==last_motor_pos_cmd)) position_cmd=motor_pos_cmd; //last_motor_pos_cmd = motor_pos_cmd; switch (state){
//---->>0 - oczekiwanie na sygnał tool-change - polecenie M6 case 0: // oczekiwanie if (tool_change){ if (homed==0) { //nie wyzerowany zmieniacz //maksymalna droga do poszukiwania zera position = position_fb+scale*tool_range+windback/2; state = 10; //zerowanie narzędzia position_cmd += move; break; } position = position_fb+scale*(tool_prep_number-current_tool)+windback/2; if (current_tool > tool_prep_number) position += scale*tool_range; state = 1; //ruch } break;
//---->>1 - position-cmd - obrót - zmiana narzędzia case 1: // ruch if (abs(position_fb-position_cmd)>0.05) break; if (position_cmd < position) { position_cmd += move; break; } position_cmd = position; position -= windback; state = 2; //nawrót break;
//----> 2 - ruch wsteczny (nawrót), w celu zatrzaśnięcia zapadki case 2: // nawrót - zatrzaśnięcie if (abs(position_fb-position_cmd)>0.1) break; if (position_cmd > position) { position_cmd -= move; break; } tool_changed = 1; //signał <- narzędzie zminione //current_tool = tool_prep_number; state = 0; //przejdź do stanu oczekiwania break; //----> 10 - zerowanie narzędzia case 10: // poszukiwanie zera... na pinie home if (abs(position_fb-position_cmd)>0.05) break; if (position_cmd>position) { state=21;//nie znalazł HOME break; } if (home==0) { // jeszcze nie najechał na home position_cmd += move; break; } position = position_cmd - windback; state = 2; //nawrót homed=1; // wyzerowany break;
//----> zapętlenie case 20: // zapętlenie, aby komunikat błędu wyświetlił się tylko raz break; case 21: // brak mikroswitcha HOME... rtapi_print_msg(RTAPI_MSG_ERR,"Zmieniacz: nie znalazł HOME"); state = 20; break; default: // rtapi_print_msg(RTAPI_MSG_ERR,"Zmianiacz: błąd"); state = 20; break; } }
# Tutaj dodaj swoje polecenia HAL # Ten plik nie zostanie nadpisany gdy uruchomisz ponownie Stepconf
#odłączenie domyślnych łączy zmianacza "pustego" #net tool-number <= iocontrol.0.tool-prep-number #net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed #net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared unlinkp iocontrol.0.tool-change unlinkp iocontrol.0.tool-changed unlinkp iocontrol.0.tool-prep-number unlinkp iocontrol.0.tool-prepare unlinkp iocontrol.0.tool-prepared
#wyłączenie komend dla osi Y (1) #net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd unlinkp axis.1.motor-pos-cmd unlinkp stepgen.1.position-cmd
#wyłączenie pokazania pozycji osi Y (1) #net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb unlinkp stepgen.1.position-fb unlinkp axis.1.motor-pos-fb
#załadowanie zmieniacza toolchanger loadrt toolchanger #zmieniacz do wątku sevo-thread addf toolchanger.0 servo-thread
#łącza dla zmianiacza net tool-change iocontrol.0.tool-change => toolchanger.0.tool-change net tool-changed iocontrol.0.tool-changed <= toolchanger.0.tool-changed
net tool-number iocontrol.0.tool-prep-number => toolchanger.0.tool-prep-number
net current-tool-number iocontrol.0.tool-number => toolchanger.0.current-tool
#zmieniacz wymusza pozycję stepgena (silnika) net pos-cmd toolchanger.0.position-cmd => stepgen.1.position-cmd net pos-fb toolchanger.0.position-fb <= stepgen.1.position-fb
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
#oszukanie środowiska axis unlinkp axis.1.motor-pos-cmd unlinkp axis.1.motor-pos-fb
#sygnał pozycji z axis -> do net ypos-cmd-fb axis.1.motor-pos-cmd => toolchanger.0.motor-pos-cmd net ypos-fb toolchanger.0.motor-pos-fb => axis.1.motor-pos-fb
#komenda do sterowania ręcznego zmieniaczem #net yyypos-cmd-fb toolchanger.0.motor-pos-cmd
#informacja z axis o wyzerowaniu osi Y (1) - axis.1.homed
net y-home parport.1.pin-04-in => toolchanger.0.home
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: cnc101 Marca 14, 2017, 04:46:26
[code]
# Tutaj dodaj swoje polecenia HAL # Ten plik nie zostanie nadpisany gdy uruchomisz ponownie Stepconf
#usunięcie z pamięci stepgena na dwie osie #loadrt stepgen step_type=0,0 #unloadrt stepgen unload stepgen
#załadowanie na 3 osie... loadrt stepgen step_type=0,0,0
#addf parport.0.read base-thread #addf parport.1.read base-thread addf stepgen.make-pulses base-thread #addf parport.0.write base-thread #addf parport.0.reset base-thread #addf parport.1.write base-thread
addf stepgen.capture-position servo-thread addf stepgen.update-freq servo-thread
#net xstep => parport.0.pin-02-out #setp parport.0.pin-02-out-reset 1 #net xdir => parport.0.pin-03-out #net ystep => parport.0.pin-04-out #setp parport.0.pin-04-out-reset 1 #net ydir => parport.0.pin-05-out #net zstep => parport.0.pin-06-out #setp parport.0.pin-06-out-reset 1 #net zdir => parport.0.pin-07-out #setp parport.0.pin-08-out-invert 1 #net xenable => parport.0.pin-08-out
setp stepgen.0.position-scale [AXIS_0]SCALE setp stepgen.0.steplen 1 setp stepgen.0.stepspace 0 setp stepgen.0.dirhold 20000 setp stepgen.0.dirsetup 20000 setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb net xstep <= stepgen.0.step net xdir <= stepgen.0.dir net xenable axis.0.amp-enable-out => stepgen.0.enable
setp stepgen.1.position-scale [AXIS_2]SCALE setp stepgen.1.steplen 1 setp stepgen.1.stepspace 0 setp stepgen.1.dirhold 20000 setp stepgen.1.dirsetup 20000 setp stepgen.1.maxaccel [AXIS_2]STEPGEN_MAXACCEL net zpos-cmd axis.2.motor-pos-cmd => stepgen.1.position-cmd net zpos-fb stepgen.1.position-fb => axis.2.motor-pos-fb net zstep <= stepgen.1.step net zdir <= stepgen.1.dir net zenable axis.2.amp-enable-out => stepgen.1.enable
#opcje osi dodatkowej (wygenerowane przez stepconf w wersji na 3 osie)
setp stepgen.2.position-scale 2000 setp stepgen.2.steplen 1 setp stepgen.2.stepspace 0 setp stepgen.2.dirhold 20000 setp stepgen.2.dirsetup 20000 setp stepgen.2.maxaccel 18.75 #net ypos-cmd axis.1.motor-pos-cmd => stepgen.2.position-cmd # net ypos-fb stepgen.2.position-fb => axis.1.motor-pos-fb net ystep <= stepgen.2.step net ydir <= stepgen.2.dir net yenable axis.1.amp-enable-out => stepgen.2.enable
#odłączenie domyślnych łączy zmianacza "pustego" #net tool-number <= iocontrol.0.tool-prep-number #net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed #net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared unlinkp iocontrol.0.tool-change unlinkp iocontrol.0.tool-changed unlinkp iocontrol.0.tool-prep-number unlinkp iocontrol.0.tool-prepare unlinkp iocontrol.0.tool-prepared
#wyłączenie komend dla osi Y (1) #net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd #unlinkp axis.1.motor-pos-cmd #unlinkp stepgen.1.position-cmd
#wyłączenie pokazania pozycji osi Y (1) #net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb #unlinkp stepgen.1.position-fb #unlinkp axis.1.motor-pos-fb
#załadowanie zmieniacza toolchanger loadrt toolchanger #zmieniacz do wątku sevo-thread addf toolchanger.0 servo-thread
#łącza dla zmianiacza net tool-change iocontrol.0.tool-change => toolchanger.0.tool-change net tool-changed iocontrol.0.tool-changed <= toolchanger.0.tool-changed
net tool-number iocontrol.0.tool-prep-number => toolchanger.0.tool-prep-number
net current-tool-number iocontrol.0.tool-number => toolchanger.0.current-tool
#zmieniacz wymusza pozycję stepgena (silnika) net pos-cmd toolchanger.0.position-cmd => stepgen.2.position-cmd net pos-fb toolchanger.0.position-fb <= stepgen.2.position-fb
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
#oszukanie środowiska axis #unlinkp axis.1.motor-pos-cmd #unlinkp axis.1.motor-pos-fb
#sygnał pozycji z axis -> do #net ypos-cmd-fb axis.1.motor-pos-cmd => toolchanger.0.motor-pos-cmd #net ypos-fb toolchanger.0.motor-pos-fb => axis.1.motor-pos-fb
#komenda do sterowania ręcznego zmieniaczem #net yyypos-cmd-fb toolchanger.0.motor-pos-cmd
#informacja z axis o wyzerowaniu osi Y (1) - axis.1.homed
net y-home parport.1.pin-04-in => toolchanger.0.home
# Generated by stepconf 1.1 at Tue Mar 14 11:14:39 2017 # Jeśli zmodyfikujesz ten plik zmainy zostaną # nadpisane gdy uruchomisz ponownie Stepconf loadrt trivkins loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[trAJ]AXES loadrt probe_parport loadrt hal_parport cfg="0xcf00 out 0xcd00 in" setp parport.0.reset-time 3000 loadrt stepgen step_type=0,0 loadrt pwmgen output_type=1
addf parport.0.read base-thread addf parport.1.read base-thread addf stepgen.make-pulses base-thread addf pwmgen.make-pulses base-thread addf parport.0.write base-thread addf parport.0.reset base-thread addf parport.1.write base-thread
addf stepgen.capture-position servo-thread addf motion-command-handler servo-thread addf motion-controller servo-thread addf stepgen.update-freq servo-thread addf pwmgen.update servo-thread
net spindle-cmd <= motion.spindle-speed-out => pwmgen.0.value net spindle-on <= motion.spindle-on => pwmgen.0.enable net spindle-pwm <= pwmgen.0.pwm setp pwmgen.0.pwm-freq 500.0 setp pwmgen.0.scale 3000.0 setp pwmgen.0.offset 0.0 setp pwmgen.0.dither-pwm true net spindle-at-speed => motion.spindle-at-speed net spindle-cw <= motion.spindle-forward net spindle-ccw <= motion.spindle-reverse net coolant-mist <= iocontrol.0.coolant-mist net coolant-flood <= iocontrol.0.coolant-flood
net spindle-pwm => parport.0.pin-01-out net xstep => parport.0.pin-02-out setp parport.0.pin-02-out-reset 1 net xdir => parport.0.pin-03-out net ystep => parport.0.pin-04-out setp parport.0.pin-04-out-reset 1 net ydir => parport.0.pin-05-out net zstep => parport.0.pin-06-out setp parport.0.pin-06-out-reset 1 net zdir => parport.0.pin-07-out setp parport.0.pin-08-out-invert 1 net xenable => parport.0.pin-08-out net coolant-mist => parport.0.pin-09-out net coolant-flood => parport.0.pin-14-out net spindle-cw => parport.0.pin-16-out net spindle-ccw => parport.0.pin-17-out
net spindle-on => parport.1.pin-17-out
setp stepgen.0.position-scale [AXIS_0]SCALE setp stepgen.0.steplen 1 setp stepgen.0.stepspace 0 setp stepgen.0.dirhold 20000 setp stepgen.0.dirsetup 20000 setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb net xstep <= stepgen.0.step net xdir <= stepgen.0.dir net xenable axis.0.amp-enable-out => stepgen.0.enable
setp stepgen.1.position-scale [AXIS_2]SCALE setp stepgen.1.steplen 1 setp stepgen.1.stepspace 0 setp stepgen.1.dirhold 20000 setp stepgen.1.dirsetup 20000 setp stepgen.1.maxaccel [AXIS_2]STEPGEN_MAXACCEL net zpos-cmd axis.2.motor-pos-cmd => stepgen.1.position-cmd net zpos-fb stepgen.1.position-fb => axis.2.motor-pos-fb net zstep <= stepgen.1.step net zdir <= stepgen.1.dir net zenable axis.2.amp-enable-out => stepgen.1.enable
net estop-out <= iocontrol.0.user-enable-out net estop-out => iocontrol.0.emc-enable-in
net tool-number <= iocontrol.0.tool-prep-number net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
component toolchanger "zmieniacz Karuzela, z zapadką";
pin in bit tool-change "Potrzebna zmiana narzędzia"; pin out bit tool-changed "Sygnał zakończenia zmiany narzedzia"; pin in signed tool-prep-number "numer narzędzia do przygotowania"; pin out float position-cmd "pozycja do osiągnięcia przez stepgen";
pin in float position-fb "pozycja bierząca silnika zmianiacza";
pin in float motor-pos-cmd "komenda z axis.1.motor-pos-cmd"; pin out float motor-pos-fb "komenda dla axis.1.motor-pos-fb";
pin in bit home "pin lpt parport.1.pin-04-in do zerowania"; pin out bit homed=0 "czy wyzerowane";
pin out signed state = 0 "stan: 0=oczekiwanie;1=ruch;2=nawrót";
pin in signed current-tool "aktualny numer narzędzia";
param rw float move = 0.3 "obrót o kawałek"; param rw float scale = 4.6 "jedenostek na zmiana narzędzia o 1"; param rw float windback = 3 "droga nawrotu"; param rw signed tool_range = 6 "ilość narzędzi"; param rw signed accuracy = 0.05 "dokładność ustalenia pozycji";
variable float position = 1; //variable signed current_tool=1; //"aktualny numer narzędzia"; variable float last_motor_pos_cmd=0;
license "GPL"; function _ ; ;;
FUNCTION(_) {
motor_pos_fb = motor_pos_cmd; //przepisanie komendy pozycji dla axis //if (!(motor_pos_cmd==last_motor_pos_cmd)) position_cmd=motor_pos_cmd; //last_motor_pos_cmd = motor_pos_cmd; switch (state){
//---->>0 - oczekiwanie na sygnał tool-change - polecenie M6 case 0: // oczekiwanie if (tool_change==1 && tool_changed==0){ if (homed==0) { //nie wyzerowany zmieniacz //maksymalna droga do poszukiwania zera position = position_fb+scale*tool_range+windback/2; state = 10; //zerowanie narzędzia position_cmd += move; break; } if (tool_prep_number>tool_range) { //narzędzie poza zakresem state = 22; //komunikat błędu break; } position = position_fb+scale*(tool_prep_number-current_tool)+windback/2; if (current_tool > tool_prep_number) position += scale*tool_range; state = 1; //ruch } if (tool_change==0 && tool_changed==1) tool_changed=0; break;
//---->>1 - position-cmd - obrót - zmiana narzędzia case 1: // ruch if (abs(position_fb-position_cmd)>accuracy) break; if (position_cmd < position) { position_cmd += move; break; } //position_cmd = position; //position -= windback; position = position_fb - windback;
state = 2; //nawrót break;
//----> 2 - ruch wsteczny (nawrót), w celu zatrzaśnięcia zapadki case 2: // nawrót - zatrzaśnięcie if (abs(position_fb-position_cmd)>accuracy) break; if (position_cmd > position) { position_cmd -= move; break; } tool_changed = 1; //signał <- narzędzie zminione state = 0; //przejdź do stanu oczekiwania break; //----> 10 - zerowanie narzędzia case 10: // poszukiwanie zera... na pinie home if (position_cmd>position) { state=21;//nie znalazł HOME break; } if (home==0) { // jeszcze nie najechał na home if (abs(position_fb-position_cmd)>accuracy) break; position_cmd += move; break; } position = position_fb-windback*2; position_cmd = position; state = 11; //nawrót zerowania homed=1; // wyzerowany break; case 11: // nawrót - zerowania if (abs(position_fb-position_cmd)>accuracy) break; if (position_fb > position) { position_cmd -= move; break; } state = 0; //przejdź do stanu oczekiwania break;
//----> zapętlenie case 20: // zapętlenie, aby komunikat błędu wyświetlił się tylko raz break; case 21: // brak mikroswitcha HOME... rtapi_print_msg(RTAPI_MSG_ERR,"Zmieniacz: nie znalazł HOME"); state = 20; break; case 22: //narzędzie poza zakresem rtapi_print_msg(RTAPI_MSG_ERR,"Zmieniacz: zbyt duży numer narzędzia"); rtapi_print_msg(RTAPI_MSG_ERR,"Zmieniacz: ponowne zerowanie\nustawienie narzędzia 1"); //maksymalna droga do poszukiwania zera position = position_fb+scale*tool_range+windback/2; tool_changed=1; state = 10; //zerowanie break; default: // rtapi_print_msg(RTAPI_MSG_ERR,"Zmianiacz: błąd"); state = 20; break; } }
# Generated by stepconf 1.1 at Tue Mar 14 11:14:39 2017 # Jeśli zmodyfikujesz ten plik zmainy zostaną # nadpisane gdy uruchomisz ponownie Stepconf
[EMC] MACHINE = lathe_tc_w1_04 DEBUG = 0
[DISPLAY] DISPLAY = axis EDITOR = gedit POSITION_OFFSET = RELATIVE POSITION_FEEDBACK = ACTUAL ARCDIVISION = 64 GRIDS = 10mm 20mm 50mm 100mm 1in 2in 5in 10in MAX_FEED_OVERRIDE = 1.2 MIN_SPINDLE_OVERRIDE = 0.5 MAX_SPINDLE_OVERRIDE = 1.2 DEFAULT_LINEAR_VELOCITY = 1.00 MIN_LINEAR_VELOCITY = 0 MAX_LINEAR_VELOCITY = 10.00 INTRO_GRAPHIC = linuxcnc.gif INTRO_TIME = 5 PROGRAM_PREFIX = /home/mark/linuxcnc/nc_files INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm LATHE = 1
[FILTER] PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image PROGRAM_EXTENSION = .py Python Script png = image-to-gcode gif = image-to-gcode jpg = image-to-gcode py = python
[TASK] TASK = milltask CYCLE_TIME = 0.010
[RS274NGC] PARAMETER_FILE = linuxcnc.var
[EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 COMM_WAIT = 0.010 BASE_PERIOD = 50000 SERVO_PERIOD = 1000000
[HAL] HALFILE = lathe_tc_w1_04.hal HALFILE = custom.hal POSTGUI_HALFILE = custom_postgui.hal
[trAJ] AXES = 3 COORDINATES = X Z LINEAR_UNITS = mm ANGULAR_UNITS = degree CYCLE_TIME = 0.010 DEFAULT_VELOCITY = 1.00 MAX_VELOCITY = 10.00
[EMCIO] EMCIO = io CYCLE_TIME = 0.100 TOOL_TABLE = tool.tbl
[AXIS_0] TYPE = LINEAR HOME = 0.0 MAX_VELOCITY = 9.5 MAX_ACCELERATION = 200.0 STEPGEN_MAXACCEL = 250.0 SCALE = 2000.0 FERROR = 1 MIN_FERROR = .25 MIN_LIMIT = -10000.0 MAX_LIMIT = 10000.0 HOME_OFFSET = 0.0
[AXIS_2] TYPE = LINEAR HOME = 0.0 MAX_VELOCITY = 9.5 MAX_ACCELERATION = 200.0 STEPGEN_MAXACCEL = 250.0 SCALE = 2000.0 FERROR = 1 MIN_FERROR = .25 MIN_LIMIT = -10000.0 MAX_LIMIT = 10000.0 HOME_OFFSET = 0.0
[/code]
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: cnc101 Marca 16, 2017, 09:44:15
załącznik rozpakować do katalogu ~/linuxcnc/configs/
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: markcomp Marca 16, 2017, 10:41:30
Instalacja zmieniacza
-
Rozpakować zawartość archiwum “_lathe_tc_w1_04.zip”, do katalogu konfiguracji linuxcnc “~/linuxcnc/configs”
plik “~/linuxcnc/configs/lathe_tc_w1_04.stepconf”, zawierającego inforamacje generowane przez kreator konfiguracji StepConf. Własciwa konfiguracja jest w katalogu “~/linuxcnc/configs/lathe_tc_w1_04”
-
Wyświetlenie zawartości katalogu konfiguracji
ls <--- polecenie do wpisania w terminalu
custom.hal lathe_tc_w1_04.ini postgui_backup.hal
custom_postgui.hal linuxcnc.var toolchanger.comp
lathe_tc_w1_04.hal linuxcnc.var.bak tool.tbl
custom.hal - konfiguracja hal nie zmieniana po modyfikowaniu ustawień przez StepConfa, plik ten zawiera przyłączenie modułu toolchanger.comp do bieżącej konfiguracji...
# Tutaj dodaj swoje polecenia HAL
# Ten plik nie zostanie nadpisany gdy uruchomisz ponownie Stepconf
toolchanger.comp - źródło modułu sterujacego zmieniaczem - wymaga kompilacji i instalacji w linuxcnc aby działała (o tym póżniej)
tool.tbl - opis narzędzie... dla celów testowych zostało “coś” wpisane...
-
kompilacja / instalacja modułu hal
sudo halcompile --install toolchanger.comp <-- polecenie instalacji
[sudo] password for mark: <-- tutaj wpisujemy hasło superusera (roota)
make KBUILD_EXTRA_SYMBOLS=/usr/realtime-3.4-9-rtai-686-pae/modules/linuxcnc/Module.symvers -C /usr/src/linux-headers-3.4-9-rtai-686-pae SUBDIRS=‘pwd‘ CC=gcc V=0 modules
make[1]: Wejście do katalogu ‘/usr/src/linux-headers-3.4-9-rtai-686-pae’
CC [M] /tmp/tmp5GAeCN/toolchanger.o
Building modules, stage 2.
MODPOST 1 modules
CC /tmp/tmp5GAeCN/toolchanger.mod.o
LD [M] /tmp/tmp5GAeCN/toolchanger.ko
make[1]: Opuszczenie katalogu ‘/usr/src/linux-headers-3.4-9-rtai-686-pae’
cp toolchanger.ko /usr/realtime-3.4-9-rtai-686-pae/modules/linuxcnc/
we wczesniejszych wersjach linuxcnc zamiast polecenia “halcompile, było stosowane “comp” (testowałem)
Tytuł: Odp: Toolchange
Wiadomość wysłana przez: Jagoda Sierpnia 31, 2017, 01:04:15
Ciekawe! :)
|