SSI absolute encoders and analog servos

More
25 Oct 2016 15:50 #82041 by PCW
I dont think so, that's unrelated to the DPLL

Please Log in or Create an account to join the conversation.

More
25 Oct 2016 16:12 #82042 by terkaa
Here we go:

# core HAL config file for Cincinnati 10HC2500

loadrt [KINS]KINEMATICS
#autoconverted trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS unlock_joints_mask=8
loadrt hostmot2
loadrt hm2_pci config="ssi_chan_1=yencoder%32e ssi_chan_2=zencoder%32e ssi_chan_3=xencoder%32e num_encoders=1 num_pwmgens=0 num_stepgens=0 sserial_port_0=00010000 sserial_port_1=00200000"
setp hm2_5i25.0.watchdog.timeout_ns 5000000
# load 6 differentiators (for velocity and accel signals
# loadrt ddt names=ddt_x,ddt_xv,ddt_y,ddt_yv,ddt_z,ddt_zv
# load additional blocks
# loadrt hypot names=vel_xy,vel_xyz
loadrt mux4 count=1

#SSI stuff

##X-axis
setp hm2_5i25.0.ssi.03.frequency-khz 400
setp hm2_5i25.0.ssi.03.timer-number 4
setp hm2_5i25.0.dpll.04.timer-us -170
setp hm2_5i25.0.ssi.03.xencoder.scale -10000


##Y-axis
setp hm2_5i25.0.ssi.01.frequency-khz 400
setp hm2_5i25.0.ssi.01.timer-number 2
setp hm2_5i25.0.dpll.02.timer-us -170
setp hm2_5i25.0.ssi.01.yencoder.scale 10000

##Z-axis
setp hm2_5i25.0.ssi.02.frequency-khz 400
setp hm2_5i25.0.ssi.02.timer-number 3
setp hm2_5i25.0.dpll.03.timer-us -170
setp hm2_5i25.0.ssi.02.zencoder.scale -10000

#Load carousel
loadrt carousel pockets=30 encoding=index num_sense=2
loadrt or2 count=3
loadrt not count=6
loadrt and2 count=7
loadrt oneshot
loadrt weighted_sum wsum_sizes=13,16,7,10,4
loadrt armatc
loadrt pinorient
loadrt gearbox
loadrt sum2_s32
loadrt toggle count=4
loadrt scale count=2
loadrt pid names=pid.x,pid.y,pid.z
loadrt rotarylock

# add motion controller functions to servo thread
addf hm2_5i25.0.read servo-thread
addf motion-command-handler servo-thread
addf motion-controller 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 hm2_5i25.0.write servo-thread
addf carousel.0 servo-thread
addf or2.0 servo-thread
addf or2.1 servo-thread
addf or2.2 servo-thread
addf armatc.0 servo-thread
addf pinorient.0 servo-thread
addf not.0 servo-thread
addf not.1 servo-thread
addf not.2 servo-thread
addf not.3 servo-thread
addf not.4 servo-thread
addf not.5 servo-thread
addf and2.0 servo-thread
addf and2.1 servo-thread
addf and2.2 servo-thread
addf and2.3 servo-thread
addf and2.4 servo-thread
addf and2.5 servo-thread
addf and2.6 servo-thread
addf oneshot.0 servo-thread
addf process_wsums servo-thread
addf sum2-s32.0 servo-thread
addf toggle.0 servo-thread
addf toggle.1 servo-thread
addf toggle.2 servo-thread
addf toggle.3 servo-thread
addf mux4.0 servo-thread
addf gearbox.0 servo-thread
addf scale.0 servo-thread
addf scale.1 servo-thread
addf rotarylock.0 servo-thread

# OBSOLETE !!create HAL signals for position commands from motion module
# loop position commands back to motion module feedback
#net Xpos joint.0.motor-pos-cmd => joint.0.motor-pos-fb
#net Ypos joint.1.motor-pos-cmd => joint.1.motor-pos-fb ddt_y.in
#net Zpos joint.2.motor-pos-cmd => joint.2.motor-pos-fb
net Bpos joint.3.motor-pos-cmd => joint.3.motor-pos-fb

##### My servo stuff encoder fb
#net Ypos hm2_5i25.0.ssi.01.yencoder.position joint.1.motor-pos-fb
#### Hard limits
net Xposlim joint.0.pos-lim-sw-in hm2_5i25.0.7i70.0.2.input-01
net Xneglim joint.0.neg-lim-sw-in hm2_5i25.0.7i70.0.2.input-02
net Yneglim joint.1.neg-lim-sw-in hm2_5i25.0.7i70.0.2.input-03
net Yposlim joint.1.pos-lim-sw-in hm2_5i25.0.7i70.0.2.input-04
net Zneglim joint.2.neg-lim-sw-in hm2_5i25.0.7i70.0.2.input-06
net Zposlim joint.2.pos-lim-sw-in hm2_5i25.0.7i70.0.2.input-05


#*******************
# AXIS 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

net x-index-enable <=> pid.x.index-enable
net x-enable => pid.x.enable
net x-pos-cmd => pid.x.command
net x-pos-fb => pid.x.feedback
net x-output => pid.x.output

# ---PWM Generator signals/setup---

setp hm2_5i25.0.7i83.0.1.analogout0-scalemax [JOINT_0]OUTPUT_SCALE
setp hm2_5i25.0.7i83.0.1.analogout0-minlim [JOINT_0]OUTPUT_MIN_LIMIT
setp hm2_5i25.0.7i83.0.1.analogout0-maxlim [JOINT_0]OUTPUT_MAX_LIMIT

net x-output => hm2_5i25.0.7i83.0.1.analogout0
net x-pos-cmd joint.0.motor-pos-cmd
net x-enable joint.0.amp-enable-out
net x-enable hm2_5i25.0.7i83.0.1.analogena0
net x-fault joint.0.amp-fault-in hm2_5i25.0.7i70.0.2.input-42-not
net error-reset halui.abort hm2_5i25.0.7i84.1.2.input-00
net error-reset hm2_5i25.0.7i71.0.4.output-24

# ---Encoder feedback signals/setup---
net x-pos-fb <= hm2_5i25.0.ssi.03.xencoder.position
net x-pos-fb => joint.0.motor-pos-fb
net x-pos-rawcounts <= hm2_5i25.0.ssi.03.xencoder.rawcounts


#*******************
# AXIS Y
#*******************

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

net y-index-enable <=> pid.y.index-enable
net y-enable => pid.y.enable
net y-pos-cmd => pid.y.command
net y-pos-fb => pid.y.feedback
net y-output => pid.y.output

# ---PWM Generator signals/setup---

setp hm2_5i25.0.7i83.0.1.analogout1-scalemax [JOINT_1]OUTPUT_SCALE
setp hm2_5i25.0.7i83.0.1.analogout1-minlim [JOINT_1]OUTPUT_MIN_LIMIT
setp hm2_5i25.0.7i83.0.1.analogout1-maxlim [JOINT_1]OUTPUT_MAX_LIMIT

net y-output => hm2_5i25.0.7i83.0.1.analogout1
net y-pos-cmd joint.1.motor-pos-cmd
net y-enable joint.1.amp-enable-out
net y-enable hm2_5i25.0.7i83.0.1.analogena1
net y-fault joint.1.amp-fault-in hm2_5i25.0.7i70.0.2.input-43-not
net error-reset hm2_5i25.0.7i71.0.4.output-25
net machine-enabled halui.home-all armatc.0.machine-is-on halui.machine.is-on
net machine-enabled not.5.in
net error-reset and2.6.in0
net machine-is-off and2.6.in1 not.5.out
net machine-on halui.machine.on and2.6.out

# ---Encoder feedback signals/setup---

net y-pos-fb <= hm2_5i25.0.ssi.01.yencoder.position
net y-pos-fb => joint.1.motor-pos-fb
net y-pos-rawcounts <= hm2_5i25.0.ssi.01.yencoder.rawcounts


#*******************
# AXIS Z
#*******************

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

net z-index-enable <=> pid.z.index-enable
net z-enable => pid.z.enable
net z-pos-cmd => pid.z.command
net z-pos-fb => pid.z.feedback
net z-output => pid.z.output

# ---PWM Generator signals/setup---

setp hm2_5i25.0.7i83.0.1.analogout2-scalemax [JOINT_2]OUTPUT_SCALE
setp hm2_5i25.0.7i83.0.1.analogout2-minlim [JOINT_2]OUTPUT_MIN_LIMIT
setp hm2_5i25.0.7i83.0.1.analogout2-maxlim [JOINT_2]OUTPUT_MAX_LIMIT

net z-output => hm2_5i25.0.7i83.0.1.analogout2
net z-pos-cmd joint.2.motor-pos-cmd
net z-enable joint.2.amp-enable-out
net z-enable hm2_5i25.0.7i83.0.1.analogena2
net z-fault joint.2.amp-fault-in hm2_5i25.0.7i70.0.2.input-44-not
net error-reset hm2_5i25.0.7i71.0.4.output-26

# ---Encoder feedback signals/setup---
net z-pos-fb <= hm2_5i25.0.ssi.02.zencoder.position
net z-pos-fb => joint.2.motor-pos-fb
net z-pos-rawcounts <= hm2_5i25.0.ssi.02.zencoder.rawcounts



#*******************
# AXIS A
#*******************

net a_unlock_req rotarylock.0.unlock-request joint.3.unlock
net a_unlock hm2_5i25.0.7i71.0.4.output-02 rotarylock.0.unlock
net a_lock hm2_5i25.0.7i71.0.4.output-00 rotarylock.0.lock
net a_unlock_sw hm2_5i25.0.7i70.0.2.input-35 rotarylock.0.unlock-sw
net a_lock_sw hm2_5i25.0.7i70.0.2.input-36 rotarylock.0.lock-sw
net a_unlocked joint.3.is-unlocked rotarylock.0.is-unlocked
net error-reset hm2_5i25.0.7i71.0.4.output-27

# estop loopback
net ext_estop iocontrol.0.emc-enable-in hm2_5i25.0.7i70.0.2.input-47
net estop-loop oneshot.0.in hm2_5i25.0.7i71.0.4.output-19 iocontrol.0.user-enable-out

# create signals for tool loading loopback
net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared
#net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed

net spindle-fwd motion.spindle-forward
net spindle-rev motion.spindle-reverse
#net spindle-speed motion.spindle-speed-out

net lube iocontrol.0.lube
#net flood iocontrol.0.coolant-flood
net mist iocontrol.0.coolant-mist

#my stuff

#net estop_on not.0.in halui.estop.is-activated
#net hydraulic_on hm2_5i25.0.7i71.0.4.output-19 iocontrol.0.user-enable-out


#*******************
# SPINDLE
#*******************

setp scale.0.gain 0.0028
net spindle_low_speed hm2_5i25.0.7i71.0.4.output-04 gearbox.0.low-gear
net spindle_high_speed hm2_5i25.0.7i71.0.4.output-03 gearbox.0.high-gear
net low_gear_in gearbox.0.low-gear-sense hm2_5i25.0.7i70.0.2.input-09
net high_gear_in gearbox.0.high-gear-sense hm2_5i25.0.7i70.0.2.input-11
net spindle_speed_in gearbox.0.speed-command motion.spindle-speed-out
net spindle_on gearbox.0.spindle-on hm2_5i25.0.7i83.0.1.analogena4 motion.spindle-on
net spindle-speed-scale gearbox.0.motor-speed => scale.0.in
net spindle-speed-DAC scale.0.out => hm2_5i25.0.7i83.0.1.analogout4
net spindle-fault motion.enable hm2_5i25.0.7i70.0.2.input-46
net spindle-fault-not hm2_5i25.0.7i70.0.2.input-46-not
net spindle-atspeed motion.spindle-at-speed hm2_5i25.0.7i70.0.2.input-41
net error-reset hm2_5i25.0.7i71.0.4.output-28

#carousel & ATC
setp oneshot.0.width 1
net atc_enable armatc.0.enable iocontrol.0.tool-change
net atc_ready iocontrol.0.tool-changed armatc.0.ready
net atc_magazine_cw hm2_5i25.0.7i71.0.4.output-17 carousel.0.motor-fwd
net atc_magazine_ccw hm2_5i25.0.7i71.0.4.output-18 carousel.0.motor-rev
net magazine_home_sw carousel.0.sense-0 hm2_5i25.0.7i70.0.2.input-33
net magazine_pocket_sw carousel.0.sense-1 hm2_5i25.0.7i70.0.2.input-32
net magazine_jog_fwd carousel.0.jog-fwd armatc.0.magazine-cw
net magazine_jog_rev carousel.0.jog-rev armatc.0.magazine-ccw
net magazine_jog_button_ccw armatc.0.jog-cw-button hm2_5i25.0.7i70.0.2.input-17
net magazine_jog_button_cw armatc.0.jog-ccw-button hm2_5i25.0.7i70.0.2.input-18
net magazine_enabled carousel.0.enable armatc.0.magazine-enable
net atc_magazine_shotpin_advance hm2_5i25.0.7i71.0.4.output-16 armatc.0.magazine-shotpin-advance
net manual_mode armatc.0.is-manual-mode halui.mode.is-manual
net magazine_homed armatc.0.magazine-homed carousel.0.homed
net atc_arm_to_magazine hm2_5i25.0.7i71.0.4.output-09 armatc.0.arm-to-magazine
net atc_arm_to_spindle hm2_5i25.0.7i71.0.4.output-10 armatc.0.arm-to-spindle
net atc_arm_vertical hm2_5i25.0.7i71.0.4.output-13 armatc.0.arm-vertical
net atc_arm_horizontal hm2_5i25.0.7i71.0.4.output-12 armatc.0.arm-horizontal
net atc_arm_180_deg_pin hm2_5i25.0.7i71.0.4.output-11 armatc.0.arm-180-deg-pin
net atc_arm_advance hm2_5i25.0.7i71.0.4.output-14 armatc.0.arm-advance
net atc_arm_retract hm2_5i25.0.7i71.0.4.output-15 armatc.0.arm-retract
net atc_hand1_unlock hm2_5i25.0.7i71.0.4.output-07 armatc.0.magazine-cam-advance
net atc_hand2_unlock hm2_5i25.0.7i71.0.4.output-08 armatc.0.spindle-cam-advance
net atc_airblow hm2_5i25.0.7i71.0.4.output-01 armatc.0.spindle-airblow
#net atc-enabled halui.machine.is-on
net atc_magazine_rq_pot_number carousel.0.pocket-number armatc.0.req-magazine-pot-number
net atc_magazine_current_pot armatc.0.current-magazine-pot-no carousel.0.current-position
net next_tool_no armatc.0.tool-request-no iocontrol.0.tool-prep-number
net current_tool_no armatc.0.spindle-tool-no iocontrol.0.tool-number
net atc_magazine_ready armatc.0.magazine-ready carousel.0.ready
net atc_magazine_active armatc.0.magazine-active carousel.0.active
net atc_tool_is_clamp armatc.0.tool-is-clamped hm2_5i25.0.7i70.0.2.input-14
net atc_tool_is_unclamp armatc.0.tool-is-unclamped hm2_5i25.0.7i70.0.2.input-15
net atc_mag_unlock_ret armatc.0.magazine-cam-is-retracted hm2_5i25.0.7i70.0.2.input-19
net atc_mag_unlock_adv armatc.0.magazine-cam-is-advanced hm2_5i25.0.7i70.0.2.input-20
net atc_spdl_unlock_ret armatc.0.spindle-cam-is-retracted hm2_5i25.0.7i70.0.2.input-21
net atc_spdl_unlock_adv armatc.0.spindle-cam-is-advanced hm2_5i25.0.7i70.0.2.input-22
net atc_arm_at_magazine armatc.0.arm-is-at-magazine hm2_5i25.0.7i70.0.2.input-23
net atc_arm_at_spindle armatc.0.arm-is-at-spindle hm2_5i25.0.7i70.0.2.input-24
net atc_arm_is_vertical armatc.0.arm-is-vertical hm2_5i25.0.7i70.0.2.input-25
net atc_180_deg_pin_in armatc.0.arm-180-deg-pin-is-in hm2_5i25.0.7i70.0.2.input-26
net atc_arm1_is_horizontal armatc.0.arm1-is-horizontal hm2_5i25.0.7i70.0.2.input-27
net atc_arm2_is_horizontal armatc.0.arm2-is-horizontal hm2_5i25.0.7i70.0.2.input-28
net atc_arm_is-retract armatc.0.arm-is-retracted hm2_5i25.0.7i70.0.2.input-29
net atc_arm_is_advance armatc.0.arm-is-advanced hm2_5i25.0.7i70.0.2.input-30
#net magazine_shotpin_in armatc.0.magazine-shotpin-is-in
#net atc_180_deg_pin_out armatc.0.arm-180-deg-pin-is-out
#net atc_arm_retract armatc.0.arm-is-retracted
#net atc_arm_advance armatc.0.arm-is-advanced
net atc_magazine_shotpin_in armatc.0.magazine-shotpin-is-in hm2_5i25.0.7i70.0.2.input-34
net atc_tool_unclamp or2.0.in0 armatc.0.tool-unclamp
net atc_unclamp_button or2.0.in1 hm2_5i25.0.7i84.1.2.input-27
net tool_unclamp hm2_5i25.0.7i71.0.4.output-06 or2.0.out
net force_input_0 wsum.4.bit.0.in hm2_5i25.0.7i70.0.2.input-40
net force_input_1 wsum.4.bit.1.in hm2_5i25.0.7i70.0.2.input-39
net force_input_2 wsum.4.bit.2.in hm2_5i25.0.7i70.0.2.input-38
net force_input_3 wsum.4.bit.3.in hm2_5i25.0.7i70.0.2.input-37

#spindle_orient
net spindle_orient_pin_advance hm2_5i25.0.7i71.0.4.output-05 pinorient.0.orient-pin-advance
net spindle_orient_pin_in pinorient.0.orient-pin-in hm2_5i25.0.7i70.0.2.input-12
net spindle_orient_pin_out pinorient.0.orient-pin-out hm2_5i25.0.7i70.0.2.input-13
net spindle_is_orient armatc.0.spindle-is-orient pinorient.0.oriented
net spindle_running pinorient.0.spindle-is-on halui.spindle.is-on
#net spindle_orient_out armatc.0.spindle-orient-request

#######Overrides
#Spindle
setp halui.spindle-override.direct-value 1
setp halui.spindle-override.scale 0.1
setp halui.spindle-override.count-enable 1
setp wsum.0.bit.0.weight 5
setp wsum.0.bit.1.weight 7
setp wsum.0.bit.2.weight 8
setp wsum.0.bit.3.weight 9
setp wsum.0.bit.4.weight 10
setp wsum.0.bit.5.weight 11
setp wsum.0.bit.6.weight 12
setp wsum.0.bit.7.weight 13
setp wsum.0.bit.8.weight 14
setp wsum.0.bit.9.weight 15
setp wsum.0.bit.10.weight 16
setp wsum.0.bit.11.weight 18
setp wsum.0.bit.12.weight 20
net bit0-spindle wsum.0.bit.0.in <= hm2_5i25.0.7i70.1.4.input-10
net bit1-spindle wsum.0.bit.1.in <= hm2_5i25.0.7i70.1.4.input-11
net bit2-spindle wsum.0.bit.2.in <= hm2_5i25.0.7i70.1.4.input-12
net bit3-spindle wsum.0.bit.3.in <= hm2_5i25.0.7i70.1.4.input-13
net bit4-spindle wsum.0.bit.4.in <= hm2_5i25.0.7i70.1.4.input-14
net bit5-spindle wsum.0.bit.5.in <= hm2_5i25.0.7i70.1.4.input-15
net bit6-spindle wsum.0.bit.6.in <= hm2_5i25.0.7i70.1.4.input-16
net bit7-spindle wsum.0.bit.7.in <= hm2_5i25.0.7i70.1.4.input-17
net bit8-spindle wsum.0.bit.8.in <= hm2_5i25.0.7i70.1.4.input-18
net bit9-spindle wsum.0.bit.9.in <= hm2_5i25.0.7i70.1.4.input-19
net bit10-spindle wsum.0.bit.10.in <= hm2_5i25.0.7i70.1.4.input-20
net bit11-spindle wsum.0.bit.11.in <= hm2_5i25.0.7i70.1.4.input-21
net bit12-spindle wsum.0.bit.12.in <= hm2_5i25.0.7i70.1.4.input-22
net spindle-ov-out halui.spindle-override.counts wsum.0.sum

#Feed Rate
setp halui.feed-override.direct-value 1
setp halui.feed-override.scale 0.01
setp halui.feed-override.count-enable 1
setp wsum.1.bit.0.weight 0
setp wsum.1.bit.1.weight 5
setp wsum.1.bit.2.weight 10
setp wsum.1.bit.3.weight 20
setp wsum.1.bit.4.weight 30
setp wsum.1.bit.5.weight 40
setp wsum.1.bit.6.weight 50
setp wsum.1.bit.7.weight 60
setp wsum.1.bit.8.weight 70
setp wsum.1.bit.9.weight 80
setp wsum.1.bit.10.weight 90
setp wsum.1.bit.11.weight 95
setp wsum.1.bit.12.weight 100
setp wsum.1.bit.13.weight 105
setp wsum.1.bit.14.weight 110
setp wsum.1.bit.15.weight 120
setp wsum.2.bit.0.weight 130
setp wsum.2.bit.1.weight 140
setp wsum.2.bit.2.weight 150
setp wsum.2.bit.3.weight 160
setp wsum.2.bit.4.weight 170
setp wsum.2.bit.5.weight 180
setp wsum.2.bit.6.weight 200
net bit0-feedrate wsum.1.bit.0.in <= hm2_5i25.0.7i70.1.4.input-24
net bit1-feedrate wsum.1.bit.1.in <= hm2_5i25.0.7i70.1.4.input-25
net bit2-feedrate wsum.1.bit.2.in <= hm2_5i25.0.7i70.1.4.input-26
net bit3-feedrate wsum.1.bit.3.in <= hm2_5i25.0.7i70.1.4.input-27
net bit4-feedrate wsum.1.bit.4.in <= hm2_5i25.0.7i70.1.4.input-28
net bit5-feedrate wsum.1.bit.5.in <= hm2_5i25.0.7i70.1.4.input-29
net bit6-feedrate wsum.1.bit.6.in <= hm2_5i25.0.7i70.1.4.input-30
net bit7-feedrate wsum.1.bit.7.in <= hm2_5i25.0.7i70.1.4.input-31
net bit8-feedrate wsum.1.bit.8.in <= hm2_5i25.0.7i70.1.4.input-32
net bit9-feedrate wsum.1.bit.9.in <= hm2_5i25.0.7i70.1.4.input-33
net bit10-feedrate wsum.1.bit.10.in <= hm2_5i25.0.7i70.1.4.input-34
net bit11-feedrate wsum.1.bit.11.in <= hm2_5i25.0.7i70.1.4.input-35
net bit12-feedrate wsum.1.bit.12.in <= hm2_5i25.0.7i70.1.4.input-36
net bit13-feedrate wsum.1.bit.13.in <= hm2_5i25.0.7i70.1.4.input-37
net bit14-feedrate wsum.1.bit.14.in <= hm2_5i25.0.7i70.1.4.input-38
net bit15-feedrate wsum.1.bit.15.in <= hm2_5i25.0.7i70.1.4.input-39
net bit16-feedrate wsum.2.bit.0.in <= hm2_5i25.0.7i70.1.4.input-40
net bit17-feedrate wsum.2.bit.1.in <= hm2_5i25.0.7i70.1.4.input-41
net bit18-feedrate wsum.2.bit.2.in <= hm2_5i25.0.7i70.1.4.input-42
net bit19-feedrate wsum.2.bit.3.in <= hm2_5i25.0.7i70.1.4.input-43
net bit20-feedrate wsum.2.bit.4.in <= hm2_5i25.0.7i70.1.4.input-44
net bit21-feedrate wsum.2.bit.5.in <= hm2_5i25.0.7i70.1.4.input-45
net bit22-feedrate wsum.2.bit.6.in <= hm2_5i25.0.7i70.1.4.input-46
net wsum1-to-float sum2-s32.0.in0 <= wsum.1.sum
net wsum2-to-float sum2-s32.0.in1 <= wsum.2.sum
net feed-ov-out halui.feed-override.counts sum2-s32.0.out

#Rapids
setp halui.max-velocity.direct-value 1
setp halui.max-velocity.scale 1.34
setp halui.max-velocity.count-enable 1
setp wsum.3.bit.0.weight 0
setp wsum.3.bit.1.weight 1
setp wsum.3.bit.2.weight 5
setp wsum.3.bit.3.weight 10
setp wsum.3.bit.4.weight 30
setp wsum.3.bit.5.weight 50
setp wsum.3.bit.6.weight 70
setp wsum.3.bit.7.weight 80
setp wsum.3.bit.8.weight 90
setp wsum.3.bit.9.weight 100
net bit0-rapid wsum.3.bit.0.in <= hm2_5i25.0.7i70.1.4.input-00
net bit1-rapid wsum.3.bit.1.in <= hm2_5i25.0.7i70.1.4.input-01
net bit2-rapid wsum.3.bit.2.in <= hm2_5i25.0.7i70.1.4.input-02
net bit3-rapid wsum.3.bit.3.in <= hm2_5i25.0.7i70.1.4.input-03
net bit4-rapid wsum.3.bit.4.in <= hm2_5i25.0.7i70.1.4.input-04
net bit5-rapid wsum.3.bit.5.in <= hm2_5i25.0.7i70.1.4.input-05
net bit6-rapid wsum.3.bit.6.in <= hm2_5i25.0.7i70.1.4.input-06
net bit7-rapid wsum.3.bit.7.in <= hm2_5i25.0.7i70.1.4.input-07
net bit8-rapid wsum.3.bit.8.in <= hm2_5i25.0.7i70.1.4.input-08
net bit9-rapid wsum.3.bit.9.in <= hm2_5i25.0.7i70.1.4.input-09
net rapid-ov-out halui.max-velocity.counts wsum.3.sum

#Okuma panel
net coolant_button toggle.0.in hm2_5i25.0.7i84.1.2.input-13
net coolant_out halui.flood.on not.0.in toggle.0.out
net coolant_on hm2_5i25.0.7i84.1.2.output-13 hm2_5i25.0.7i71.0.4.output-20 iocontrol.0.coolant-flood
net coolant_off halui.flood.off not.0.out
net wlight_button toggle.1.in hm2_5i25.0.7i84.1.2.input-14
net wlight_out hm2_5i25.0.7i84.1.2.output-14 hm2_5i25.0.7i71.0.4.output-23 toggle.1.out
net x_jog_but halui.axis.x.select hm2_5i25.0.7i84.1.2.input-01
net y_jog_but halui.axis.y.select hm2_5i25.0.7i84.1.2.input-02
net z_jog_but halui.axis.z.select hm2_5i25.0.7i84.1.2.input-03
net mpg_but and2.0.in0 and2.1.in0 not.1.in hm2_5i25.0.7i84.1.2.input-05
net mpg_lt hm2_5i25.0.7i84.1.2.output-04 not.1.out
net jog_minus_but and2.0.in1 hm2_5i25.0.7i84.1.2.input-06
net jog_minus_and halui.axis.selected.minus and2.0.out
net jog_plus_but and2.1.in1 hm2_5i25.0.7i84.1.2.input-24
net jog_plus_and halui.axis.selected.plus and2.1.out
net x_jog_led hm2_5i25.0.7i84.1.2.output-00 halui.axis.x.is-selected
net y_jog_led hm2_5i25.0.7i84.1.2.output-01 halui.axis.y.is-selected
net z_jog_led hm2_5i25.0.7i84.1.2.output-02 halui.axis.z.is-selected
net spindle_fw halui.spindle.forward hm2_5i25.0.7i84.1.2.input-08
net spindle_rv halui.spindle.reverse hm2_5i25.0.7i84.1.2.input-09
net spindle_st halui.spindle.stop hm2_5i25.0.7i84.1.2.input-10
net spindle_fw_led hm2_5i25.0.7i84.1.2.output-11 halui.spindle.runs-forward
net spindle_rv_led hm2_5i25.0.7i84.1.2.output-10 halui.spindle.runs-backward
net spindle_orient_button toggle.2.in hm2_5i25.0.7i84.1.2.input-11
net spindle_orient_or1 or2.1.in1 armatc.0.spindle-orient-request
net spindle_orient_or2 or2.1.in0 toggle.2.out
net spindle_orient_enab pinorient.0.enable or2.1.out
#net spindle_orient_out hm2_5i25.0.7i84.1.2.output-09 pinorient.0.orient-pin-advance
net atc_step_forward armatc.0.ext-step-forward hm2_5i25.0.7i84.1.2.input-07
net atc_step_reverse armatc.0.ext-step-reverse hm2_5i25.0.7i84.1.2.input-15
net atc_sel hm2_5i25.0.7i84.1.2.input-12
setp scale.1.gain 60
net jog_spd_scale_in scale.1.in halui.max-velocity.value
net jog_spd halui.axis.jog-speed scale.1.out
net m_lock hm2_5i25.0.7i84.1.2.output-12 hm2_5i25.0.7i84.1.2.input-26
net cycle_start_button hm2_5i25.0.7i70.1.4.input-23
net s_block_button toggle.3.in hm2_5i25.0.7i84.1.2.input-25
net s_block_toggled and2.2.in1 not.2.in hm2_5i25.0.7i84.1.2.output-08 toggle.3.out
net cycle_start_button and2.2.in0 and2.3.in0 and2.4.in0 and2.5.in0
net s_block_step halui.program.step and2.2.out
net s_block_not and2.3.in1 not.2.out
net not_paused and2.4.in1 not.3.out
net cycle_start halui.program.run and2.4.out
net feed_hold halui.program.pause hm2_5i25.0.7i70.1.4.input-47
net feed_resume_in1 and2.5.in1 not.3.in halui.program.is-paused
net feed_resume halui.program.resume and2.5.out
net atc_reverse_ok hm2_5i25.0.7i84.1.2.output-07 armatc.0.step-reverse-led
net atc_forward_ok hm2_5i25.0.7i84.1.2.output-06 armatc.0.step-forward-led

#######Mode buttons

net auto_mode_button halui.mode.auto hm2_5i25.0.7i84.1.2.input-28
net mdi_mode_button halui.mode.mdi hm2_5i25.0.7i84.1.2.input-30
net man_mode_button halui.mode.manual hm2_5i25.0.7i84.1.2.input-29
net manual_mode hm2_5i25.0.7i84.1.2.output-15
net auto_mode halui.mode.is-auto hm2_5i25.0.7i84.1.2.output-05
net mdi_mode hm2_5i25.0.7i84.1.2.output-03 halui.mode.is-mdi
net tools_edit hm2_5i25.0.7i84.1.2.input-31
net zero_edit hm2_5i25.0.7i84.1.2.input-04

####MPG stuff

# This sets the scale that will be used based on the input to the mux4
setp mux4.0.in0 0.1
setp mux4.0.in1 0.01
setp mux4.0.in2 0.001

# Scaling inputs to the mux4 component
net scale1 mux4.0.sel0 <= hm2_5i25.0.7i84.1.2.input-22
net scale2 mux4.0.sel1 <= hm2_5i25.0.7i84.1.2.input-23

# The output from the mux4 is sent to each axis jog scale
net selected-jog-incr <= mux4.0.out


# ---jogwheel signals to mesa encoder - shared MPG---

net joint-selected-count <= hm2_5i25.0.7i84.1.2.enc0.count
#setp hm2_5i25.0.encoder.00.filter true
#setp hm2_5i25.0.encoder.00.counter-mode true

# ---mpg signals---

# for axis x MPG
setp joint.0.jog-vel-mode 0
setp axis.x.jog-vel-mode 0

net selected-jog-incr => joint.0.jog-scale axis.x.jog-scale
net joint-select-a => axis.x.jog-enable
net joint-selected-count => joint.0.jog-counts axis.x.jog-counts

# for axis y MPG
setp joint.1.jog-vel-mode 0
setp axis.y.jog-vel-mode 0

net selected-jog-incr => joint.1.jog-scale axis.y.jog-scale
net joint-select-b => axis.y.jog-enable
net joint-selected-count => joint.1.jog-counts axis.y.jog-counts

# for axis z MPG
setp joint.2.jog-vel-mode 0
setp axis.z.jog-vel-mode 0

net selected-jog-incr => joint.2.jog-scale axis.z.jog-scale
net joint-select-c => axis.z.jog-enable
net joint-selected-count => joint.2.jog-counts axis.z.jog-counts


# --- JOINT-SELECT-a-X ---
net joint-select-a <= hm2_5i25.0.7i84.1.2.input-19

# --- JOINT-SELECT-b-Y ---
net joint-select-b <= hm2_5i25.0.7i84.1.2.input-18

# --- JOINT-SELECT-c-Z ---
net joint-select-c <= hm2_5i25.0.7i84.1.2.input-20

# --- JOINT-SELECT-d-B ---
net joint-select-d <= hm2_5i25.0.7i84.1.2.input-21

AND INI:

# This config file was created 2016-09-20 11:38:27.819741 by the update_ini script
# The original config files may be found in the /home/cinci/linuxcnc/configs/sim.gscreen/gscreen_mm.old directory

# EMC controller parameters for a simulated machine.

# General note: Comments can either be preceded with a # or ; - either is
# acceptable, although # is in keeping with most linux config files.

# General section
[EMC]


# Version of this INI file
VERSION = 1.0

# Name of machine, for use with display, etc.
MACHINE = LinuxCNC-HAL-SIM-AXIS

# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others
# DEBUG = 0x7FFFFFFF
DEBUG = 0

# Sections for display options
[DISPLAY]

; -c sets the glade and handler file to load -d is to display extra debug messages
; In this case the glade and handler file are named gscreen so we don't need -c
DISPLAY = gmoccapy

# Cycle time, in milliseconds, that display will sleep between polls
CYCLE_TIME = 100

# Highest / lowest value that will be allowed for overrides, 1.0 = 100%
MAX_SPINDLE_OVERRIDE = 2.0
MIN_SPINDLE_OVERRIDE = .5
MAX_FEED_OVERRIDE = 2.0

# Max and default jog speeds in units per second
MAX_LINEAR_VELOCITY = 130
DEFAULT_LINEAR_VELOCITY = 130
MAX_ANGULAR_VELOCITY = 234
DEFAULT_ANGULAR_VELOCITY = 23

# list of selectable jog increments
INCREMENTS = .01mm, .1mm, 1mm, 10mm
ANGULAR_INCREMENTS = 1deg

# Prefix to be used
PROGRAM_PREFIX = /home/cinci/linuxcnc/nc_files/eka

# Introductory graphic
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5

#Messages

#Spindle Alarm
MESSAGE_BOLDTEXT = NONE
MESSAGE_TEXT = Karavahvistin vika!
MESSAGE_TYPE = status
MESSAGE_PINNAME = spindle_alarm

#Hydraulic motor overload
MESSAGE_BOLDTEXT = NONE
MESSAGE_TEXT = Hydraulic Motor Overload!
MESSAGE_TYPE = status
MESSAGE_PINNAME = hyd_overload

#Way Lube
MESSAGE_BOLDTEXT = NONE
MESSAGE_TEXT = Lube Level!
MESSAGE_TYPE = status
MESSAGE_PINNAME = lube_level

EMBED_TAB_NAME = ATC
EMBED_TAB_LOCATION = ntb_user_tabs
EMBED_TAB_COMMAND=halcmd loadusr -Wn gladevcp gladevcp -c atc_panel -H atc_panel.hal -u atc_panel.py -x {XID} atc_panel.glade

EMBED_TAB_NAME = SPINDLE
EMBED_TAB_LOCATION = ntb_user_tabs
EMBED_TAB_COMMAND=gladevcp -x {XID} -H spindle_box.hal spindle_box.glade

[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
PROGRAM_EXTENSION = .py Python Script

png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python

# Task controller section

[RS274NGC]

SUBROUTINE_PATH = macros
REMAP=M6 modalgroup=6 ngc=change

# File containing interpreter variables
PARAMETER_FILE = cinci.var

# Motion control section

[EMCMOT]

EMCMOT = motmod

# Timeout for comm to emcmot, in seconds
COMM_TIMEOUT = 1.0

# Interval between tries to emcmot, in seconds
COMM_WAIT = 0.010

# BASE_PERIOD is unused in this configuration but specified in core_sim.hal
BASE_PERIOD = 0
# Servo task period, in nano-seconds
SERVO_PERIOD = 1000000

# Hardware Abstraction Layer section

[TASK]

# Name of task controller program, e.g., milltask
TASK = milltask

# Cycle time, in seconds, that task controller will sleep between polls
CYCLE_TIME = 0.001

# Part program interpreter section

[HAL]

# The run script first uses halcmd to execute any HALFILE
# files, and then to execute any individual HALCMD commands.
#

# list of hal config files to run through halcmd
# files are executed in the order in which they appear
HALFILE = core_sim4.hal
#HALFILE = sim_spindle_encoder.hal
#HALFILE = axis_manualtoolchange.hal
#HALFILE = simulated_home.hal


# list of halcmd commands to execute
# commands are executed in the order in which they appear
#HALCMD = save neta

# Single file that is executed after the GUI has started. Only supported by
# AXIS at this time (only AXIS creates a HAL component of its own)
#POSTGUI_HALFILE = test_postgui.hal

HALUI = halui

[HALUI]

MDI_COMMAND = M61 Q#4999

# Trajectory planner section
[TRAJ]


AXES = 4
COORDINATES = X Y Z B
HOME = 0 0 0 0
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
CYCLE_TIME = 0.010
MAX_LINEAR_VELOCITY = 134
DEFAULT_LINEAR_VELOCITY = 130
DEFAULT_ACCELERATION = 268
MAX_LINEAR_ACCELERATION = 268
#POSITION_FILE = position_mm.txt
NO_FORCE_HOMING = 1

# Axes sections

# First axis
[EMCIO]

# Name of IO controller program, e.g., io
EMCIO = io

# cycle time, in seconds
CYCLE_TIME = 0.100

# tool table file
TOOL_TABLE = sim_mm.tbl
TOOL_CHANGE_POSITION = -550 500 -80


[KINS]
KINEMATICS = trivkins
#This is a best-guess at the number of joints, it should be checked
JOINTS = 4

[AXIS_X]
MIN_LIMIT = -2902
MAX_LIMIT = -508
MAX_VELOCITY = 134
MAX_ACCELERATION = 268

[JOINT_0]


TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 134
MAX_ACCELERATION = 268
P = 0.398
I = 0.5
D = 0.0
FF0 = 0.0
FF1 = 0.053
FF2 = 0.00074
BIAS = 0.0
DEADBAND = 0.0005
BACKLASH = 0.000
MAX_OUTPUT = 10.0
OUTPUT_MIN_LIMIT = -10.0
OUTPUT_MAX_LIMIT = 10.0
INPUT_SCALE = 1.000
OUTPUT_SCALE = -10.000
MIN_LIMIT = -2902
MAX_LIMIT = -508
FERROR = 0.9
MIN_FERROR = 0.3
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 0
HOME_LATCH_VEL = 0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = NO
HOME_SEQUENCE = 0
HOME_ABSOLUTE_ENCODER = 2

# Second axis
[AXIS_Y]
MIN_LIMIT = 148
MAX_LIMIT = 1200
MAX_VELOCITY = 134
MAX_ACCELERATION = 268

[JOINT_1]


TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 134
MAX_ACCELERATION = 268
P = 0.95
I = 0.10
D = 0.0
FF0 = 0.0
FF1 = 0.055
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0001
BACKLASH = 0.000
MAX_OUTPUT = 10.0
OUTPUT_MIN_LIMIT = -10.0
OUTPUT_MAX_LIMIT = 10.0
INPUT_SCALE = 1.000
OUTPUT_SCALE = -10.000
MIN_LIMIT = 148
MAX_LIMIT = 1200
FERROR = 0.8
MIN_FERROR = 0.2
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 0
HOME_LATCH_VEL = 0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = NO
HOME_SEQUENCE = 0
HOME_ABSOLUTE_ENCODER = 2

# Third axis
[AXIS_Z]
MIN_LIMIT = -860
MAX_LIMIT = -70
MAX_VELOCITY = 117
MAX_ACCELERATION = 233

[JOINT_2]

TYPE = LINEAR
HOME = 0
MAX_VELOCITY = 117
MAX_ACCELERATION = 233
P = 0.38
I = 0.13
D = 0.0
FF0 = 0.0
FF1 = 0.0546
FF2 = 0.0002
BIAS = 0.0000
DEADBAND = 0.0002
BACKLASH = 0.000
MAX_OUTPUT = 10.0
OUTPUT_MIN_LIMIT = -10.0
OUTPUT_MAX_LIMIT = 10.0
INPUT_SCALE = 1.000
OUTPUT_SCALE = 10.000
MIN_LIMIT = -860
MAX_LIMIT = -70
FERROR = 0.9
MIN_FERROR = 0.3
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 0
HOME_LATCH_VEL = 0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = NO
HOME_SEQUENCE = 0
HOME_ABSOLUTE_ENCODER = 2

#rotary
[AXIS_B]
MAX_VELOCITY = 90.0
MAX_ACCELERATION = 1200.0
LOCKING_INDEXER_JOINT = 3

[JOINT_3]

TYPE = ANGULAR
HOME = 0.0
MAX_VELOCITY = 90.0
MAX_ACCELERATION = 1200.0
BACKLASH = 0.000
INPUT_SCALE = 157.48
OUTPUT_SCALE = 1.000
FERROR = 5.0
MIN_FERROR = 1.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 0.0
HOME_LATCH_VEL = 0.0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = NO
HOME_SEQUENCE = 0
WRAPPED_ROTARY = 1
LOCKING_INDEXER = 1
HOME_ABSOLUTE_ENCODER = 2

# section for main IO controller parameters

Tero

Please Log in or Create an account to join the conversation.

More
25 Oct 2016 17:04 #82044 by PCW
looks basically OK

As a side note all the SSI encoders ( if they have identical timing ) should be using the same timer
this wont cause any issues but wastes timers

What is the time scale of the DPLL phase error plot?

If I had to guess the problem I would guess that the hosts PCI clock is not 33.3 MHz so the DPLL base frequency is not correct

Please Log in or Create an account to join the conversation.

More
25 Oct 2016 17:12 #82045 by terkaa
Oh, ok I will change this. I will check time scale tomorrow. How can I check actual PCI clock of system?

Tero

Please Log in or Create an account to join the conversation.

More
25 Oct 2016 17:34 #82046 by terkaa
4000 samples at 1kHz

Tero

Please Log in or Create an account to join the conversation.

More
25 Oct 2016 17:41 #82047 by PCW
OK but what i really need is halscopes time/division setting

Please Log in or Create an account to join the conversation.

More
25 Oct 2016 19:05 #82053 by terkaa

Please Log in or Create an account to join the conversation.

More
25 Oct 2016 20:02 #82055 by PCW
OK so about 10 Hz (a 1% error)

This does expose a weakness of the DPLL for the 5I25 and 5I24 that depend on the PCI clock for timing
Some Motherboards do not set the PCI clock close enough to 33.33 MHz to allow the DPLL to lock

Ultimately this should probably be fixed in the hm2 driver by a clock calibration phase, but for now
to use that motherboard you will have to tweak the DPLL base frequency

I would try +1% and -1% first

setp hm2_5i25.0.dpll.base-frequency-khz 1.01

and

setp hm2_5i25.0.dpll.base-frequency-khz 0.99

and see if either gives you a lock

once you have a lock, you can tweak the number to get the smallest absolute offset
of the average phase error

Please Log in or Create an account to join the conversation.

More
26 Oct 2016 04:46 #82073 by terkaa
Better?

File Attachment:


I tried to adjust it a bit by setp hm2_5i25.0.dpll.base-frequency-khz 1.008 and it moved signal closer to zero but for some reason gave data transmission error.

Tero

Please Log in or Create an account to join the conversation.

More
26 Oct 2016 05:29 #82074 by terkaa
Ok 1.007 gives best result:

File Attachment:


But we still get :

File Attachment:


Tero

Please Log in or Create an account to join the conversation.

Moderators: PCWjmelson
Time to create page: 0.187 seconds
Powered by Kunena Forum