On Wednesday 10 October 2018 12:58:43 Niemand Sonst wrote: > I am pretty sure, that this error has nothing to do with multi > spindle. IMHO that is a race condition. > > Could you pease post the part of the embedded tab of yor config, and > your hal files? > > Norbert > Thanks Norbert but its north of 1100 Lines. :(
> Am 10.10.2018 um 17:45 schrieb Gene Heskett: > > On Wednesday 10 October 2018 11:28:27 andy pugh wrote: > >> On Wed, 10 Oct 2018 at 16:22, Gene Heskett <[email protected]> > > > > wrote: > >>> gladevcp: auxiliary dir: > >>> /usr/share/linuxcnc/aux_gladevcp/NativeCAM gladevcp: importing: > >>> /usr/share/linuxcnc/aux_gladevcp/NativeCAM/ncam.py gladevcp: > >>> importing: /usr/share/linuxcnc/aux_gladevcp/NativeCAM/pref_edit.py > >> > >> I don't think that Glade should care about multispindle. What makes > >> you think that is what is wrong? > > > > you clipped the part I cared about, below the above. NativeCAM might > > be ok but it hasn't worked past an update from Fern yet. > > This is what I was really worried about: > > (gladevcp:28299): libglade-WARNING **: Expected <glade-interface>. > > Got <interface>. > > > > (gladevcp:28299): libglade-WARNING **: did not finish in > > PARSER_FINISH state > > **** GLADE VCP ERROR: With xml file: camview.glade : could not > > create GladeXML object >From the ini file: EMBED_TAB_NAME = Camera EMBED_TAB_LOCATION = ntb_preview EMBED_TAB_COMMAND = gladevcp -x {XID} camview.glade This is camview.glade: <?xml version="1.0" encoding="UTF-8"?> <interface> <requires lib="gtk+" version="2.24"/> <!-- interface-requires gladevcp 0.0 --> <!-- interface-naming-policy project-wide --> <object class="GtkWindow" id="window1"> <property name="can_focus">False</property> <child> <object class="CamView" id="camview1"> <property name="visible">True</property> <property name="camera">0</property> <property name="draw_color">#FFFF00000000</property> <property name="frame_width">640</property> <property name="frame_height">480</property> <property name="circle_size">150</property> <property name="number_of_circles">5</property> <property name="radius_difference">10</property> <property name="autosize">False</property> <property name="cam_settings"></property> </object> </child> </object> </interface> The base hal file: word wrap off # Generated by PNCconf at Tue Jun 30 22:44:28 2015 # If you make changes to this file, they will be # overwritten when you run PNCconf again, so it never gets run again # when the encoder arrives, I will need to setup 2 more mux4's to select # the encoders.vel and .pos values, and scales to set the gains fed to # the mux4's. So I'll need 4 more scale modules and 2 more mux4's. # One could use gearchange for that also. loadrt [KINS]KINEMATICS #autoconverted trivkins loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS num_dio=12 loadrt hostmot2 loadrt hm2_pci config="num_encoders=1 num_pwmgens=1 num_stepgens=4" loadrt boot names=boot.spindle loadrt sample_hold names=sample_dirchg,sample_spndlchg loadrt conv_bit_u32 names=conv-DirF,conv-DirR loadrt conv_u32_float names=float-boot,conv-float.DirF,conv-float.DirR loadrt conv_s32_float names=S32_float_cmd,S32_float_spndl,S32_float-cntr,S32_float-cal loadrt pid names=pid_x,pid_y,pid_z,pid_s,pid_a loadrt abs names=abs_spindle,abs_vel,abs_tachplus,abs_encdir,abs_piddir,abs_delay loadrt comp names=comp_drvbooted,comp_cal0,comp_cal1,comp_encdir loadrt limit2 count=3 loadrt limit3 names=rvsaccel loadrt not names=not_load,not_spndl loadrt or2 names=or2.0,or2.1,or2.Z,or2.A,or2.B # preparatory to making the charge-pump multi-use loadrt and2 names=and_vac,and_lube,and_spndl-hard,and_spndl-soft,and_pid_s_en,steeron,steeroff,and-prb loadrt mux2 names=mux2.fwd-rev,mux2_spndl,mux2cal0,mux2cal1,frz_mux2,frz_cnt # mux4vel and mux4pos will be used to set the scales into motion once the new encoder is on the motor loadrt mux4 names=mux4cmd,mux4pos,mux4tach,mux4_ovrtrvl,mux4_ovrtrvl2 loadrt scale names=scale_s_limit,scale_pidmaxerr,scale_tach,scale_motion,scaleX60,scale_pos,scale_cmd,scale_ovrtrvl,dyn_ovrtvl loadrt near names=near_speed loadrt debounce cfg=1,1 loadrt lut5 names=lut5-fwd,lut5-rvs,lut5-protect loadrt sum2 names=sum2_ovrtrvl,sum2_bias,spndl_tally loadrt conv_float_s32 count=1 loadrt timedelay names=pwr-delay-soft,pwr-delay-hard loadrt charge_pump loadrt oneshot names=forOn,forOff,frz_1shot loadrt flipflop names=camonoff # for spindle gear calibrations #loadrt updown names=spndl_cntr loadrt invert names=recip.0 loadrt select8 count=1 # addf stuff, mostly order sensitive addf hm2_5i25.0.read servo-thread #trigger scope on this addf debounce.0 servo-thread addf debounce.1 servo-thread addf select8.0 servo-thread # to control probe sensing addf and-prb servo-thread # fix for broken select8 addf conv-DirF servo-thread # is bit-u32 addf conv-DirR servo-thread # is bit-u32 addf conv-float.DirF servo-thread # addf conv-float.DirR servo-thread addf S32_float_spndl servo-thread # is conv-s32-float addf S32_float-cntr servo-thread # ditto addf S32_float_cmd servo-thread addf float-boot servo-thread # is conv-s32-float # all this ordered so it all falls thru addf and_pid_s_en servo-thread addf comp_encdir servo-thread # end of encoder filter addf motion-command-handler servo-thread addf motion-controller servo-thread # cmds to pid_s addf scale_cmd servo-thread addf mux4cmd servo-thread addf scale_s_limit servo-thread # data from encoder #addf scale_vel servo-thread addf scale_pos servo-thread #addf mux4vel servo-thread addf mux4pos servo-thread # data to pid_s.command addf rvsaccel servo-thread addf abs_piddir servo-thread addf sum2_bias servo-thread addf not_load servo-thread addf limit2.2 servo-thread addf comp_drvbooted servo-thread addf boot.spindle servo-thread #*********************************** addf lut5-fwd servo-thread addf lut5-rvs servo-thread addf lut5-protect servo-thread addf scale_pidmaxerr servo-thread addf mux2_spndl servo-thread addf mux4tach servo-thread addf mux2.fwd-rev servo-thread addf scale_tach servo-thread addf scaleX60 servo-thread addf pid_x.do-pid-calcs servo-thread addf pid_y.do-pid-calcs servo-thread addf pid_z.do-pid-calcs servo-thread addf pid_a.do-pid-calcs servo-thread addf pid_s.do-pid-calcs servo-thread addf abs_spindle servo-thread addf abs_vel servo-thread addf abs_tachplus servo-thread addf not_spndl servo-thread addf limit2.1 servo-thread addf or2.0 servo-thread addf or2.1 servo-thread addf or2.Z servo-thread addf or2.A servo-thread addf or2.B servo-thread addf near_speed servo-thread addf charge-pump servo-thread addf and_vac servo-thread addf and_spndl-soft servo-thread addf and_spndl-hard servo-thread addf and_lube servo-thread addf pwr-delay-soft servo-thread addf pwr-delay-hard servo-thread addf forOn servo-thread addf forOff servo-thread addf steeron servo-thread addf steeroff servo-thread addf camonoff servo-thread # for G33.1 overtravel display addf sample_dirchg servo-thread addf sample_spndlchg servo-thread addf sum2_ovrtrvl servo-thread #addf spndl_cntr servo-thread addf spndl_tally servo-thread addf comp_cal0 servo-thread addf comp_cal1 servo-thread addf S32_float-cal servo-thread addf mux2cal0 servo-thread addf mux2cal1 servo-thread addf frz_cnt servo-thread addf scale_ovrtrvl servo-thread addf mux4_ovrtrvl servo-thread addf frz_1shot servo-thread addf frz_mux2 servo-thread # need reciprocal of encoder scale addf recip.0 servo-thread # switch gears for overtravel addf mux4_ovrtrvl2 servo-thread # this is a scale module addf dyn_ovrtvl servo-thread # and finally, update machine addf hm2_5i25.0.write servo-thread # external input signals setp hm2_5i25.0.watchdog.timeout_ns 6000000 #******************* # HOME switches * #******************* setp debounce.0.delay 1 net home-switch <= hm2_5i25.0.gpio.013.in => debounce.0.0.in # signal source is p3-10 net debncd-home <= debounce.0.0.out => joint.2.home-sw-in joint.1.home-sw-in joint.0.home-sw-in # as more switches get added to the series chain, add them to the net above #****************************************************** # hook up probe signal but disable if motion type not 5 #****************************************************** net probe-ctl <= motion.motion-type => select8.0.sel # disable out5 if not probe move net probe-sense <= hm2_5i25.0.gpio.003.in_not => and-prb.in0 #edit not for correct action net probe-hit1 <= select8.0.out5 => and-prb.in1 net probe-hit2 <= and-prb.out => motion.probe-input # signal source is p3-15 #**************************** # set up speed control inputs #***************************************************************************** # hook up back gear switches. There is a notch in the rim of the knob to * # accept the roller of one of 2 switches, so that the nc contact of only one * # when it is fully engaged in that gear. But must find pins that are inputs * # on the b.o.b. According to dmesg, gpio.020, pin p2-12 and gpio.033, p2-13 * # are available. Assume switch is closure to INPUT ground. gpio's are inputs * # ON THE 5I25 unless set otherwise. * #***************************************************************************** net gear-sw-high <= hm2_5i25.0.gpio.033.in_not => mux4cmd.sel0 net gear-sw-high => mux4_ovrtrvl2.sel0 net gear-sw-high => mux4tach.sel0 mux4pos.sel0 mux4_ovrtrvl.sel0 net gear-sw-low <= hm2_5i25.0.gpio.020.in_not => mux4cmd.sel1 net gear-sw-low => mux4tach.sel1 mux4pos.sel1 mux4_ovrtrvl.sel1 net gear-sw-low => mux4_ovrtrvl2.sel1 #******************************************** # align, calibrate stuff, still being tuned * #******************************************** setp forOn.width .1 setp forOn.falling 0 setp forOn.rising 1 setp forOff.width .1 setp forOff.falling 1 setp forOff.rising 0 #********************************** # ENCODER feedback signals setup * #********************************** setp hm2_5i25.0.encoder.00.counter-mode false setp hm2_5i25.0.encoder.00.index-enable true setp hm2_5i25.0.encoder.00.index-invert false setp hm2_5i25.0.encoder.00.index-mask false setp hm2_5i25.0.encoder.00.scale [SPINDLE]ENCODER_SCALE_H setp recip.0.in [SPINDLE]ENCODER_SCALE_H setp hm2_5i25.0.encoder.sample-frequency [SPINDLE]ENCODER_SAMPLE #********************************************* # calibrate spindle to new encoder * # use halshow to reset updown for new count * # this code is not part of normal operation * # used only to determine working gear ratios * #********************************************* # sample rate now turned up so filter can be used setp hm2_5i25.0.encoder.00.filter true #net scalibrate0 mux2cal0.out mux2cal0.in1 spndl_tally.in0 # make it a sample-hold #net scalibrate1 mux2cal1.out mux2cal1.in1 spndl_tally.in1 # ditto #net ztrack <= hm2_5i25.0.gpio.016.in spndl_cntr.countup #net ztrakS32 spndl_cntr.count S32_float-cntr.in #net ztrackF S32_float-cntr.out comp_cal0.in1 comp_cal1.in1 # spndl_tally is a sum2 #setp spndl_tally.gain0 -1.00000000000 #setp spndl_tally.gain1 1.00000000000 # set to log 100 indexes #setp comp_cal0.in0 5.5 #setp comp_cal1.in0 105.5 #net Scounter-in hm2_5i25.0.encoder.00.rawcounts S32_float-cal.in #net Fcounter-in S32_float-cal.out mux2cal0.in0 mux2cal1.in0 #net shhold0 comp_cal0.out mux2cal0.sel #net shhold1 comp_cal1.out mux2cal1.sel # when mux2-cal1.out is frozen, do [spndl-tally.out / 100] to get scale. # repeat for other gear for 2nd scale factor. When done, comment it all out #*********************** # setup gear shifting * #*********************** # Now, set up sources for signals needed for spindle control # and it was found yesterday Dec 28th 2017, that scaleing the feedback # vel was wrong so thats been removed setp scale_cmd.gain [SPINDLE]SCALE_UP #setp scale_vel.gain [SPINDLE]SCALE_DOWN setp scale_pos.gain [SPINDLE]SCALE_DOWN setp scale_tach.gain [SPINDLE]SCALE_DOWN setp scaleX60.gain 60.000000000 # Establish, enforce max drive but scale it setp scale_s_limit.in [SPINDLE]PWMGEN_S_SCALE setp scale_s_limit.gain [SPINDLE]SCALE_S_MAX_PWM net maxdrive scale_s_limit.out pid_s.maxoutput #*************************************************** # First - setup 5i25's p3-p17 for servo enable use * #*************************************************** # turn signal right side up so sink is down for true setp hm2_5i25.0.gpio.001.invert_output true # setp hm2_5i25.0.pwmgen.00.out0.invert_output true # setup P3-17 for direction setp hm2_5i25.0.gpio.007.is_output true setp hm2_5i25.0.gpio.007.invert_output false # now, reboot the servo amp at every spindle start net spindle-enable <= spindle.0.on => boot.spindle.enable and_pid_s_en.in0 net spindle-enable => hm2_5i25.0.gpio.007.out hm2_5i25.0.pwmgen.00.enable setp comp_drvbooted.in1 4.500000 net spindle-boot0 <= boot.spindle.state => float-boot.in net spindle-boot1 <= float-boot.out => comp_drvbooted.in0 net spindle-booted <= comp_drvbooted.out => not_spndl.in net spindle-boot-inv <= not_spndl.out => and_pid_s_en.in1 # send selected speed to spindle and motion, but if running when switched, # slow way down only for easy gear meshing setp mux4cmd.in0 .1 setp mux4cmd.in3 .1 # This speed up the motor in low is good net requested_speed <= spindle.0.speed-out-rps => mux4cmd.in1 scale_cmd.in net adjusted_speed <= scale_cmd.out => mux4cmd.in2 net final_speed <= mux4cmd.out => rvsaccel.in net cntrld-reverse <= rvsaccel.out => pid_s.command abs_piddir.in net cntrld-reverse-out <= pid_s.output => boot.spindle.pid0 # setup some signals for the gui net spindle-cw <= spindle.0.forward net spindle-ccw <= spindle.0.reverse net spindle-brake <= spindle.0.brake #****************************** # SPINDLE PID_s setup, pid_s * #****************************** # First, tie all pid.enables to spindle.0.on net spndl-en and_pid_s_en.out pid_s.enable setp pid_s.Pgain [SPINDLE]P setp pid_s.Igain [SPINDLE]I setp pid_s.Dgain [SPINDLE]D setp pid_s.FF0 [SPINDLE]FF0 setp pid_s.FF1 [SPINDLE]FF1 setp pid_s.FF2 [SPINDLE]FF2 setp pid_s.deadband [SPINDLE]DEADBAND setp pid_s.error-previous-target true # slow down a spindle reversal by turning the fwd-rev-fwd from motion into # a sine-squared waveform both the servo and z can keep up with setp rvsaccel.maxa [SPINDLE]SP_MAXA setp rvsaccel.maxv [SPINDLE]SP_MAXV # ---PWM Generator signals/setup--- # default output type is 1, don't muck with it setp hm2_5i25.0.pwmgen.00.scale [SPINDLE]PWMGEN_S_SCALE setp hm2_5i25.0.pwmgen.pwm_frequency [SPINDLE]PWMGEN_S_FREQ setp hm2_5i25.0.gpio.005.invert_output true # pwmgen feed net spindle-output1 <= boot.spindle.pout0 => hm2_5i25.0.pwmgen.00.value net spindle-index-enable <=> spindle.0.index-enable <=> hm2_5i25.0.encoder.00.index-enable # ---Setup spindle at speed signals--- net spindle-index <=> hm2_5i25.0.encoder.00.input-index pid_s.index-enable # SPINDLE REVERSE and friction control helpers-do I still need them??? #************************ setp sum2_bias.in0 [SPINDLE]FBIAS setp sum2_bias.in1 [SPINDLE]RBIAS net is-plus0 <= abs_piddir.is-positive => conv-DirF.in # TRUE converted to 1 net is-plus1 <= conv-DirF.out => conv-float.DirF.in # still a 1 when m3 net is-neg0 <= abs_piddir.is-negative => conv-DirR.in # this works in m4 too net is-neg1 <= conv-DirR.out => conv-float.DirR.in # ditto for m4 net bias-dirF <= conv-float.DirF.out => sum2_bias.in0 net bias.DirR <= conv-float.DirR.out => sum2_bias.in1 net pid-s.bias <= sum2_bias.out => pid_s.bias # now hook up encoder velocity to motion etc BUT THIS DOES NOT NEED SCALED!!!!! net vel_source <= hm2_5i25.0.encoder.00.velocity pid_s.feedback # => scale_vel.in mux4vel.in1 #net scaled_vel_s <= scale_vel.out => mux4vel.in2 #net scaled_vel <= mux4vel.out => pid_s.feedback # watch with halscope? net vel_source => spindle.0.speed-in # hook up position, after scaleing for gear change, to motion for rigid tapping # this was a direct connection with old single gear encoder net pos_source <= hm2_5i25.0.encoder.00.position => scale_pos.in mux4pos.in1 net scaled_pos_s <= scale_pos.out => mux4pos.in2 net position_scaled <= mux4pos.out => spindle.0.revs # fix tach calibration net vel_source => scale_tach.in => mux4tach.in1 net corrected_tach <= scale_tach.out => mux4tach.in2 net crct_tach-bidir <= mux4tach.out => abs_spindle.in net corrected_tach_abs <= abs_spindle.out => scaleX60.in # to post_gui stuffs # hook up near for spindle synchronized moves setp near_speed.difference [SPINDLE]NEAR_TOL setp near_speed.scale [SPINDLE]NEAR_SCALE net crct_tach-bidir => near_speed.in1 net requested_speed => near_speed.in2 net spindle-at-speed <= near_speed.out => spindle.0.at-speed #*************************************************************************************** # utility for measureing spindle travel overshoot at bottom of a g33.1 # uses vel_source as feed for comp to determine when spindle has reversed # uses spindle-ccw to freeze first S&H spndl_dirchg # and vel_source to comp to detect0 spindle actually getting reversed, freezeing 2nd S&H setp sum2_ovrtrvl.gain0 -1.000000 # make sub2 out of sum2 # feed accumulated counts to both sample-holds net ovrtrvl1 <= hm2_5i25.0.encoder.00.count => sample_dirchg.in sample_spndlchg.in # checks net spindle-ccw => sample_dirchg.hold # checks setp comp_encdir.in1 0.0000000 net vel_source => comp_encdir.in0 net stop-cntr <= comp_encdir.out => sample_spndlchg.hold # that takes care of measuring reversal distance, HOWEVER, it also measures the other end # of the travel, so the halmeter jumps to a higher value at the end of the retract move as it # reverses to fwd again. SO KEEP THAT IN MIND! #******************************************* # first, develop overshoot in encoder counts #******************************************* net ovrtrvl2 <= sample_dirchg.out => S32_float_cmd.in # checks net ovrtrvl3 <= S32_float_cmd.out => sum2_ovrtrvl.in0 # checks net ovrtrvl4 <= sample_spndlchg.out => S32_float_spndl.in # checks net ovrtrvl5 <= S32_float_spndl.out => sum2_ovrtrvl.in1 # checks net ovrtrvl6 <= sum2_ovrtrvl.out => mux4_ovrtrvl.in1 scale_ovrtrvl.in # wrong?? setp scale_ovrtrvl.gain [SPINDLE]SCALE_DOWN net ovrtrvl7 <= scale_ovrtrvl.out => mux4_ovrtrvl.in2 net overtravel <= mux4_ovrtrvl.out #************************************************** # but we need to freeze it at max counts per stroke # and hold it till next update #************************************************** setp frz_1shot.width 0.005 net stop-cntr => frz_1shot.in net frz_count <= frz_1shot.out-not => frz_mux2.sel net overtravel => frz_mux2.in0 net save_ovrtvl <= frz_mux2.out => frz_mux2.in1 #******************************************************* # save_ovrtvl should now have a frozen overtravel count # until next backout move updates it #******************************************************* net save_ovrtvl => dyn_ovrtvl.in #**************************************************************************** # THIS IS TPMM FROM GCODE, exported by M68E0Q#<_tpmm> and is z travel per rev #**************************************************************************** net ovrtrvl8 <= motion.analog-out-00 => dyn_ovrtvl.gain # watch with halmeter or maybe scale to turns for display OR EVEN DISTANCE # now check at dyn_ovrtvl.out for effect, works but is fleeting, latch it somehow # but lets see about getting the multipliers we need to change gears # SET UNITY IN HIGH GEAR setp mux4_ovrtrvl2.in2 1.000000000 # SCALE IT DOWN IN LOW GEAR setp mux4_ovrtrvl2.in1 [SPINDLE]SCALE_DOWN net recip_enc_scale <= mux4_ovrtrvl2.out => recip.0.in #net recip_scale_out <= recip.0.out => ovrtvl8.in # only output, src wayyy up file #net stop_cnt => ovrtvl9.in #******************************************************************************** # END OF SPINDLE STUFF #******************** # AXIS X = joint_0 * #******************** # setup pid_x setp pid_x.Pgain [JOINT_0]P setp pid_x.Igain [JOINT_0]I setp pid_x.Dgain [JOINT_0]D setp pid_x.bias [JOINT_0]BIAS setp pid_x.FF0 [JOINT_0]FF0 setp pid_x.FF1 [JOINT_0]FF1 setp pid_x.FF2 [JOINT_0]FF2 setp pid_x.deadband [JOINT_0]DEADBAND setp pid_x.maxoutput [JOINT_0]MAX_OUTPUT setp pid_x.error-previous-target true setp pid_x.maxerror .005 #***************************** # Step Gen signals/setup for X #***************************** setp hm2_5i25.0.stepgen.00.dirsetup [JOINT_0]DIRSETUP setp hm2_5i25.0.stepgen.00.dirhold [JOINT_0]DIRHOLD setp hm2_5i25.0.stepgen.00.steplen [JOINT_0]STEPLEN setp hm2_5i25.0.stepgen.00.stepspace [JOINT_0]STEPSPACE setp hm2_5i25.0.stepgen.00.position-scale [JOINT_0]STEP_SCALE setp hm2_5i25.0.stepgen.00.step_type 0 setp hm2_5i25.0.stepgen.00.control-type 1 setp hm2_5i25.0.stepgen.00.maxaccel [JOINT_0]STEPGEN_MAXACCEL setp hm2_5i25.0.stepgen.00.maxvel [JOINT_0]STEPGEN_MAXVEL setp hm2_5i25.0.gpio.002.invert_output true setp hm2_5i25.0.gpio.004.invert_output true #**************************************** # ---closedloop stepper signals for X---* # 1st 2 from motion #**************************************** net x-pos-cmd <= joint.0.motor-pos-cmd => pid_x.command net x-vel-cmd <= joint.0.vel-cmd net x-pos-fb <= hm2_5i25.0.stepgen.00.position-fb => pid_x.feedback joint.0.motor-pos-fb net x-output pid_x.output => hm2_5i25.0.stepgen.00.velocity-cmd net x-index-enable <=> pid_x.index-enable net x-enable <= joint.0.amp-enable-out => hm2_5i25.0.stepgen.00.enable pid_x.enable net x-vel-cmd => pid_x.command-deriv #******************** # AXIS Y = joint_1 * #******************** setp pid_y.Pgain [JOINT_1]P setp pid_y.Igain [JOINT_1]I setp pid_y.Dgain [JOINT_1]D setp pid_y.bias [JOINT_1]BIAS setp pid_y.FF0 [JOINT_1]FF0 setp pid_y.FF1 [JOINT_1]FF1 setp pid_y.FF2 [JOINT_1]FF2 setp pid_y.deadband [JOINT_1]DEADBAND setp pid_y.maxoutput [JOINT_1]MAX_OUTPUT setp pid_y.error-previous-target true setp pid_y.maxerror .0005 #********************************** # Step Gen signals/setup for Y axis #********************************** setp hm2_5i25.0.stepgen.01.dirsetup [JOINT_1]DIRSETUP setp hm2_5i25.0.stepgen.01.dirhold [JOINT_1]DIRHOLD setp hm2_5i25.0.stepgen.01.steplen [JOINT_1]STEPLEN setp hm2_5i25.0.stepgen.01.stepspace [JOINT_1]STEPSPACE setp hm2_5i25.0.stepgen.01.position-scale [JOINT_1]STEP_SCALE setp hm2_5i25.0.stepgen.01.step_type 0 setp hm2_5i25.0.stepgen.01.control-type 1 setp hm2_5i25.0.stepgen.01.maxaccel [JOINT_1]STEPGEN_MAXACCEL setp hm2_5i25.0.stepgen.01.maxvel [JOINT_1]STEPGEN_MAXVEL setp hm2_5i25.0.gpio.006.invert_output true setp hm2_5i25.0.gpio.008.invert_output true #********************************* # ---closedloop stepper signals--- #********************************* # 1st 2 from motion net y-pos-cmd <= joint.1.motor-pos-cmd net y-vel-cmd <= joint.1.vel-cmd net y-output <= pid_y.output => hm2_5i25.0.stepgen.01.velocity-cmd net y-pos-fb <= hm2_5i25.0.stepgen.01.position-fb net y-pos-fb => joint.1.motor-pos-fb net y-enable <= joint.1.amp-enable-out net y-enable => hm2_5i25.0.stepgen.01.enable net y-index-enable <=> pid_y.index-enable net y-enable => pid_y.enable net y-pos-cmd => pid_y.command net y-vel-cmd => pid_y.command-deriv net y-pos-fb => pid_y.feedback net y-output => pid_y.output #******************** # AXIS Z = joint 2 * #******************** setp pid_z.Pgain [JOINT_2]P setp pid_z.Igain [JOINT_2]I setp pid_z.Dgain [JOINT_2]D setp pid_z.bias [JOINT_2]BIAS setp pid_z.FF0 [JOINT_2]FF0 setp pid_z.FF1 [JOINT_2]FF1 setp pid_z.FF2 [JOINT_2]FF2 setp pid_z.deadband [JOINT_2]DEADBAND setp pid_z.maxoutput [JOINT_2]MAX_OUTPUT setp pid_z.error-previous-target true setp pid_z.maxerror .005 #***************************** # Step Gen signals/setup for Z #***************************** setp hm2_5i25.0.stepgen.02.dirsetup [JOINT_2]DIRSETUP setp hm2_5i25.0.stepgen.02.dirhold [JOINT_2]DIRHOLD setp hm2_5i25.0.stepgen.02.steplen [JOINT_2]STEPLEN setp hm2_5i25.0.stepgen.02.stepspace [JOINT_2]STEPSPACE setp hm2_5i25.0.stepgen.02.position-scale [JOINT_2]STEP_SCALE setp hm2_5i25.0.stepgen.02.step_type 0 setp hm2_5i25.0.stepgen.02.control-type 1 setp hm2_5i25.0.stepgen.02.maxaccel [JOINT_2]STEPGEN_MAXACCEL setp hm2_5i25.0.stepgen.02.maxvel [JOINT_2]STEPGEN_MAXVEL setp hm2_5i25.0.gpio.009.invert_output true setp hm2_5i25.0.gpio.010.invert_output true #************************************* # ---closed loop stepper signals for Z #************************************* # 2 sigs from motion net z-pos-cmd <= joint.2.motor-pos-cmd net z-vel-cmd <= joint.2.vel-cmd net z-output <= pid_z.output net z-output => hm2_5i25.0.stepgen.02.velocity-cmd net z-pos-fb <= hm2_5i25.0.stepgen.02.position-fb # back to motion etc net z-pos-fb => joint.2.motor-pos-fb net z-pos-fb => pid_z.feedback net z-enable <= joint.2.amp-enable-out net z-enable => hm2_5i25.0.stepgen.02.enable net z-index-enable <=> pid_z.index-enable net z-enable => pid_z.enable net z-pos-cmd => pid_z.command net z-vel-cmd => pid_z.command-deriv #******************************************************** # AXIS A, joint_3 was spwr control use but now moved * # spwr control to other p2 connector, same pins * #******************************************************** setp pid_a.Pgain [JOINT_3]P setp pid_a.Igain [JOINT_3]I setp pid_a.Dgain [JOINT_3]D setp pid_a.bias [JOINT_3]BIAS setp pid_a.FF0 [JOINT_3]FF0 setp pid_a.FF1 [JOINT_3]FF1 setp pid_a.FF2 [JOINT_3]FF2 setp pid_a.deadband [JOINT_3]DEADBAND setp pid_a.maxoutput [JOINT_3]MAX_OUTPUT setp pid_a.error-previous-target true setp pid_a.maxerror .0005 net a-index-enable <=> pid_a.index-enable net a-enable => pid_a.enable net a-output => pid_a.output # Step Gen signals/setup setp hm2_5i25.0.stepgen.03.dirsetup [JOINT_3]DIRSETUP setp hm2_5i25.0.stepgen.03.dirhold [JOINT_3]DIRHOLD setp hm2_5i25.0.stepgen.03.steplen [JOINT_3]STEPLEN setp hm2_5i25.0.stepgen.03.stepspace [JOINT_3]STEPSPACE setp hm2_5i25.0.stepgen.03.position-scale [JOINT_3]STEP_SCALE setp hm2_5i25.0.stepgen.03.step_type 0 setp hm2_5i25.0.stepgen.03.control-type 1 setp hm2_5i25.0.stepgen.03.maxaccel [JOINT_3]STEPGEN_MAXACCEL setp hm2_5i25.0.stepgen.03.maxvel [JOINT_3]STEPGEN_MAXVEL setp hm2_5i25.0.gpio.011.invert_output true # ---closedloop stepper signals--- net a-pos-cmd <= joint.3.motor-pos-cmd net a-vel-cmd <= joint.3.vel-cmd net a-output <= hm2_5i25.0.stepgen.03.velocity-cmd net a-pos-fb <= hm2_5i25.0.stepgen.03.position-fb net a-pos-fb => joint.3.motor-pos-fb pid_a.feedback net a-enable <= joint.3.amp-enable-out net a-enable => hm2_5i25.0.stepgen.03.enable net a-pos-cmd => pid_a.command net a-vel-cmd => pid_a.command-deriv #******************************** # connect miscellaneous signals * #******************************** # ---HALUI signals--- net joint-select-a <= halui.axis.x.select net x-is-homed <= halui.joint.0.is-homed net jog-x-pos <= halui.axis.x.plus net jog-x-neg <= halui.axis.x.minus net jog-x-analog <= halui.axis.x.analog net joint-select-b <= halui.axis.y.select net y-is-homed <= halui.joint.1.is-homed net jog-y-pos <= halui.axis.y.plus net jog-y-neg <= halui.axis.y.minus net jog-y-analog <= halui.axis.y.analog net joint-select-c <= halui.axis.z.select net z-is-homed <= halui.joint.2.is-homed net jog-z-pos <= halui.axis.z.plus net jog-z-neg <= halui.axis.z.minus net jog-z-analog <= halui.axis.z.analog # Axis A stuff net joint-select-d <= halui.axis.a.select net a-is-homed <= halui.joint.3.is-homed net jog-a-pos <= halui.axis.a.plus net jog-a-neg <= halui.axis.a.minus net jog-a-analog <= halui.axis.a.analog net jog-selected-pos <= halui.axis.selected.plus net jog-selected-neg <= halui.axis.selected.minus # Spindle.0. stuff net spindle-manual-cw <= halui.spindle.0.forward net spindle-manual-ccw <= halui.spindle.0.reverse net spindle-manual-stop <= halui.spindle.0.stop net machine-is-on <= halui.machine.is-on net jog-speed <= halui.axis.jog-speed net MDI-mode <= halui.mode.is-mdi # ---coolant signals---use for jig locator bar # setup P2-17 to control the jigs locator bar, is cable hanging out of pcb box setp hm2_5i25.0.gpio.024.is_output true setp hm2_5i25.0.gpio.024.invert_output true net coolant-mist <= iocontrol.0.coolant-mist => hm2_5i25.0.gpio.024.out #************dual use of mist/flood********************************** # this should be true=low at P2-17 when mist is on, * # or when an M7 has been encountered in the g-code. * # M9 turns it all off * # need to assign another output pin to flood, to be used to control * # a vacuum cleaner to suck up the sawdust. * #******************************************************************** # and here, we open a 10 lb can of worms, because charge-pump is a single # instance module. So to be able to use it for other controls, we will # have to enable it permanently, and drive any number of and2's so we get # an output to send to a pin of the BoB, or not, by setting the other # input to the and2, effectively using that for the enable signal on a # per output basis. or2's could also be used, seting the 2nd input true # to disable the output toggling. And2's make more sense to me however. #***************************************************0************************* # this will do till I have a better idea. gpio 022 is usually axis B's pulse * setp hm2_5i25.0.gpio.022.is_output true setp hm2_5i25.0.gpio.022.invert_output false # shouldn't effect result, but does, the vacuum starts for 1/4 second at power up. # setup charge-pump full time setp charge-pump.enable true # just leave it running. net pwr-pump <= charge-pump.out => and_vac.in0 and_spndl-hard.in0 and_spndl-soft.in0 net coolant-flood <= iocontrol.0.coolant-flood => and_vac.in1 net vac-control1 <= and_vac.out => hm2_5i25.0.gpio.022.out # an M8 turns it on, M9 shuts both off # and it seems to work as written but I just inverted the mist output # hopefully the bar will stay out when lcnc shuts down. It did. #************************************************* # Now setup the spindles psu on/off sequencing * #************************************************* # first, set the time delays, on in order of execution setp pwr-delay-soft.on-delay 0.1 # initial on, but thru the resistor setp pwr-delay-hard.on-delay 3.0 # seconds, to full on, bypassing the resistor # now its on, shut it off in order of execution setp pwr-delay-hard.off-delay 0.1 # go back to resistor limited power setp pwr-delay-soft.off-delay 0.2 # to full off # setup the gpio's used for spindle power control setp hm2_5i25.0.gpio.028.is_output true # is J2-8, 2nd bob, in pcb box, pin 8 controls resistor's feed setp hm2_5i25.0.gpio.029.is_output true # is J2-9, 2nd bob, in pcb box, pin 9 controls resistor bypass # that sets 5i25's gpio's 028 and 029 to output, and this crowbars the soft start resistor in sequence # now tie it all together # turn on spindle power softly, by pumping pin 8 of the BoB, and start both timers # start the control chain net spndl-power <= motion.motion-enabled => pwr-delay-hard.in pwr-delay-soft.in # both time-delays now started # hook soft start to and2.spindle.in1 net spndl-soft <= pwr-delay-soft.out => and_spndl-soft.in1 # and hook it to the 5i25, J2-8 net soft-spdnl-pwr <= and_spndl-soft.out => hm2_5i25.0.gpio.028.out # pin p2-8 # which turns on toroids thru a 51 ohm 200 watt resistor to start charging supply caps # 3 secs later, bypass the resistor by linking hard delay out to # and_spndl.hard input 1, enabling it to pass the pump signal net hard-spndl-pwr <= pwr-delay-hard.out => and_spndl-hard.in1 # sets up to feed full power # now feed that delayed full power pump to J2-9 after 3 seconds, and turn it off in .1 seconds net spndl-power-hard <= and_spndl-hard.out => hm2_5i25.0.gpio.029.out #P2 bob pin 9 feeds tordoids direct # all done and understandable spindle psu controls. # I wonder if I could also feed the rest of the system control box (after the BoB) with # the first SSR, making it 95% automatic. The thought keeps nagging at me. But then # would lose the protection that making me switch it by hand gives, so I don't do it... #********************pncconf set stuffs***************** # connect max velocity overide increments - switches setp halui.max-velocity.count-enable true setp halui.max-velocity.direct-value true setp halui.max-velocity.scale 20.000000 # no src signal! is this my problem? net max-vel-override-incr => halui.max-velocity.counts # connect spindle overide increments setp halui.spindle.0.override.count-enable true setp halui.spindle.0.override.direct-value true setp halui.spindle.0.override.scale .01 net spindleoverride-incr => halui.spindle.0.override.counts # ---motion control signals--- net in-position <= motion.in-position # ---digital in / out signals--- # ---estop signals--- # P2-pin 10 is usually the estop input, but haven't sussed how to # net that yet. net estop-out <= iocontrol.0.user-enable-out net estop-out => iocontrol.0.emc-enable-in # ---manual tool change signals--- loadusr -W hal_manualtoolchange net tool-change-request <= iocontrol.0.tool-change => hal_manualtoolchange.change net tool-change-confirmed <= iocontrol.0.tool-changed => hal_manualtoolchange.changed net tool-number <= iocontrol.0.tool-prep-number => hal_manualtoolchange.number net tool-prepare-loopback <= iocontrol.0.tool-prepare => iocontrol.0.tool-prepared Theres more postgui stuff if you need it. Some is long and complex So heres the pyvcp.xml for starters: <?xml version='1.0' encoding='UTF-8'?> <pyvcp> <!-- Include your PyVCP panel here. The contents of this file will not be overwritten when you run stepconf again. --> <!-- the RPM meter --> <hbox> <relief>RAISED</relief> <bd>2</bd> <meter> <halpin>"spindle_rpm"</halpin> <text>"Spindle"</text> <subtext>"RPM"</subtext> <size>240</size> <min_>0</min_> <max_>3000</max_> <majorscale>500</majorscale> <minorscale>100</minorscale> <region1>0,2450,"green"</region1> <region2>2450,2800,"yellow"</region2> <region3>2800,3000,"red"</region3> </meter> </hbox> <!-- The spindle power tally led --> <hbox> <vbox> <relief>RAISED</relief> <bd>2</bd> <label> <text>"SPWR"</text> <font>("Helvetica",8)</font> </label> <rectled> <halpin>"on-led"</halpin> <height>"6"</height> <width>"72"</width> <on_color>"green"</on_color> <off_color>"red"</off_color> </rectled> </vbox> <!-- The spindle forward led --> <vbox> <relief>RAISED</relief> <bd>2</bd> <label> <text>"FWD"</text> <font>("Helvetica",8)</font> </label> <rectled> <halpin>"fwd-led"</halpin> <height>"6"</height> <width>"72"</width> <on_color>"green"</on_color> <off_color>"red"</off_color> </rectled> </vbox> <!-- The spindle reversed led --> <vbox> <relief>RAISED</relief> <bd>2</bd> <label> <text>"REV"</text> <font>("Helvetica",8)</font> </label> <rectled> <halpin>"rev-led"</halpin> <height>"6"</height> <width>"72"</width> <on_color>"green"</on_color> <off_color>"red"</off_color> </rectled> </vbox> </hbox> <!-- The following is added to your .xml file inside the <pyvcp> </pyvcp> tags --> <!-- here we have to re-invent the camview missing stuffs --> <!-- This button moves the machine so the camera is looking at the tools location --> <!-- And back, condition tallied by an led used to underline the button --> <labelframe text="Calibrate machine"> <hbox> <button> <halpin>"checkbutton1"</halpin> <text>"CamSW"</text> <font>('Helvetica',10)</font> </button> <!-- 2nd button in middle of horizontal row, for store a coordinate --> <button> <halpin>"button1"</halpin> <text>"CamStor"</text> <font>('Helvetica',10)</font> </button> <!-- now, 4 small vertyical leds to tally how many coordinates have been stored --> <rectled> <halpin>"stored1"</halpin> <height>"32"</height> <width>"14"</width> <on_color>"green"</on_color> <off_color>"red"</off_color> </rectled> <rectled> <halpin>"stored2"</halpin> <height>"32"</height> <width>"14"</width> <on_color>"green"</on_color> <off_color>"red"</off_color> </rectled> <rectled> <halpin>"stored3"</halpin> <height>"32"</height> <width>"14"</width> <on_color>"green"</on_color> <off_color>"red"</off_color> </rectled> <rectled> <halpin>"stored4"</halpin> <height>"32"</height> <width>"14"</width> <on_color>"green"</on_color> <off_color>"red"</off_color> </rectled> </hbox> <!-- an led used to underline the CamSW button to tally state, --> <!--red=machine normal,green=machine is in camera offset position--> <hbox> <rectled> <halpin>"camactive"</halpin> <height>"6"</height> <width>"75"</width> <on_color>"green"</on_color> <off_color>"red"</off_color> </rectled> <!-- an underline under the CamStor sub button but function runs to fast to register green --> <!-- an G4p.5 in that subroutine might be enough to blik it --> <rectled> <halpin>"camstored"</halpin> <height>"6"</height> <width>"75"</width> <on_color>"green"</on_color> <off_color>"red"</off_color> </rectled> </hbox> </labelframe> <!-- next row of buttons down --> <labelframe text="Center machine"> <vbox> <hbox> <!-- runs camcenter3 sub --> <button> <halpin>"button2"</halpin> <text>"CamCtr3"</text> <font>('Helvitica',10)</font> </button> <!-- runs camcenter4 sub --> <button> <halpin>"button3"</halpin> <text>"CamCtr4"</text> <font>('Helvetica',10)</font> </button> </hbox> <!-- tally camcenter3 having been run --> <hbox> <rectled> <halpin>"camcentered3"</halpin> <height>"6"</height> <width>"80"</width> <on_color>"green"</on_color> <off_color>"red"</off_color> </rectled> <!-- tally camcenter4 sub has been run --> <rectled> <halpin>"camcentered4"</halpin> <height>"6"</height> <width>"80"</width> <on_color>"green"</on_color> <off_color>"red"</off_color> </rectled> </hbox> </vbox> </labelframe> <!-- and last, the alignment stuff --> <labelframe text="Align Sheet"> <!-- button to set starting point for alignment calcs --> <button> <halpin>"align_startb"</halpin> <text>"Align Start"</text> <font>('Helvetica',10)</font> </button> <!-- and underline tally to indicate the starting point has been recorded --> <rectled> <halpin>"align_enabled"</halpin> <height>"6"</height> <width>"238"</width> <on_color>"green"</on_color> <off_color>"red"</off_color> </rectled> </labelframe> <labelframe text="Mark x OR y"> <vbox> <hbox> <!-- mark along x axis --> <button> <halpin>"align_xb"</halpin> <text>"Align _Y"</text> <font>('Helvetica',10)</font> </button> <!-- mark along y axis --> <button> <halpin>"align_yb"</halpin> <text>"Align X"</text> <font>('Helvetica',10)</font> </button> </hbox> <hbox> <!-- indicate is aligned along X axis, mutually exclusive --> <rectled> <halpin>"align2_xt"</halpin> <height>"6"</height> <width>"74"</width> <on_color>"green"</on_color> <off_color>"red"</off_color> </rectled> <!-- indicate is aligned along Y axis, mutually exclusive --> <rectled> <halpin>"align2_yt"</halpin> <height>"6"</height> <width>"68"</width> <on_color>"green"</on_color> <off_color>"red"</off_color> </rectled> </hbox> </vbox> </labelframe> <!-- And finally, a button to restore normal coordination to machine square --> <vbox> <hbox> <button> <halpin>"clear_offsetsb"</halpin> <text>" Clear Offsets "</text> <font>('Helvetica',12)</font> </button> </hbox> </vbox> </pyvcp> ============= postgui.hal is the head of that chain: # the following is added to your postgui.hal file. # This must be loaded after the pyvcp buttons are created. # spindle dial & status display links to hardware generated ligic signal net rpms scaleX60.out pyvcp.spindle_rpm net hard-spndl-pwr pyvcp.on-led net spindle-cw pyvcp.fwd-led net spindle-ccw pyvcp.rev-led # camview stuff, now Sept 2017 version CamPY with tally mods here net forOnNet pyvcp.checkbutton1 forOn.in forOff.in # camera position toggle, should call _newcamsw.ngc # MDI commands start at 00 in the order listed in the ini file. net togglecam1 forOn.out halui.mdi-command-00 # move to tool 99 for camera usage. or back if on net cam2 pyvcp.button1 halui.mdi-command-01 # Save most recent camera offset point, shove 4th off end of array net cam3 pyvcp.button2 halui.mdi-command-02 # center based on 3 points net cam4 pyvcp.button3 halui.mdi-command-03 # center based on 4 points # align stuff, was bass ackwards? Does not work, logs error to terminal. interchanging halui with pyvcp has no effect # but this is how it is in the align postgui.hal file supplied in align.zip net align-startb halui.mdi-command-04 <= pyvcp.align_startb net align_yb halui.mdi-command-05 <= pyvcp.align_xb net align_xb halui.mdi-command-06 <= pyvcp.align_yb net clear_offsetb halui.mdi-command-07 <= pyvcp.clear_offsetsb # The above signal names and buttons work as expected # hook up tallys for in cam position & align state, red inactice, green active net camactivated motion.digital-out-00 pyvcp.camactive # the leds control pin, high = green net camstored motion.digital-out-01 pyvcp.camstored net stored1 motion.digital-out-02 pyvcp.stored1 net stored2 motion.digital-out-03 pyvcp.stored2 net stored3 motion.digital-out-04 pyvcp.stored3 net stored4 motion.digital-out-05 pyvcp.stored4 net cntrd3 motion.digital-out-06 pyvcp.camcentered3 net cntrd4 motion.digital-out-07 pyvcp.camcentered4 # clear-offset turns all these back to red or off, these work now net alignstart motion.digital-out-08 pyvcp.align_enabled net aligned2x motion.digital-out-09 pyvcp.align2_xt net aligned2y motion.digital-out-10 pyvcp.align2_yt # and need a horizontal scale to show how many points are stored by _camstore.ngc # best by setting up 4 more led's in a row to the right of camstore button. # change each to green as values are stored. Built, works now I think thats all of it. Been wrong before though. Feel free to borrow if you think its good enough. -- Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene> _______________________________________________ Emc-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-developers
