Solving some lingering F_error problems

More
18 Mar 2019 23:45 #128950 by cogzoid
I'm using limit3 because controlling the axis via g-codes makes for some really jerky movements as the motion controller tries to accurately control the motion of all of the axes at the same time. In other words, I don't want the complex arm movements to slow down because the bowtie is trying to spin around.

I haven't implemented the extra-joints patch that dgarrett wrote. There are parts of it I don't understand and so I'm trying to figure it out.

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

More
19 Mar 2019 13:06 #128967 by Todd Zuercher
It might simply be a thread ordering problem, coupled with following error limits that are simply too tight for your servo system. Perhaps you should post your hal file(s)

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

More
19 Mar 2019 19:12 #128990 by cogzoid
Sure thing, here's my .hal file as it is.
# Generated by PNCconf at Tue Oct 30 16:21:02 2018
# If you make changes to this file, they will be
# overwritten when you run PNCconf again

loadrt trivkins
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES num_dio=16
loadrt hostmot2
loadrt hm2_eth board_ip="10.10.10.10" config="firmware=hm2/7i80/7i76e_7i76x1_7i85x1D.bit num_encoders=0 num_pwmgens=0 num_stepgens=9 sserial_port_0=00xxxx" 
setp    hm2_7i76e.0.watchdog.timeout_ns 5000000
loadrt pid names=pid.x,pid.y,pid.z,pid.a,pid.b,pid.c,pid.u,pid.v
loadrt limit3 names=limit3.a,limit3.b,limit3.c,limit3.u,limit3.v
loadrt sum2 names=sum2.a-cmd,sum2.b-cmd,sum2.c-cmd,sum2.u-cmd,sum2.v-cmd,sum2.a-fb,sum2.b-fb,sum2.c-fb,sum2.u-fb,sum2.v-fb

addf hm2_7i76e.0.read         servo-thread
addf sum2.a-fb                servo-thread
addf sum2.b-fb                servo-thread
addf sum2.c-fb                servo-thread
addf sum2.u-fb                servo-thread
addf sum2.v-fb                servo-thread
addf motion-command-handler   servo-thread
addf motion-controller        servo-thread
addf limit3.a 		      servo-thread
addf limit3.b                 servo-thread
addf limit3.c 		      servo-thread
addf limit3.u                 servo-thread
addf limit3.v                 servo-thread
addf sum2.a-cmd               servo-thread
addf sum2.b-cmd               servo-thread
addf sum2.c-cmd               servo-thread
addf sum2.u-cmd               servo-thread
addf sum2.v-cmd               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.b.do-pid-calcs       servo-thread
addf pid.c.do-pid-calcs       servo-thread
addf pid.u.do-pid-calcs       servo-thread
addf pid.v.do-pid-calcs       servo-thread
addf hm2_7i76e.0.write        servo-thread
setp hm2_7i76e.0.dpll.01.timer-us -50
setp hm2_7i76e.0.stepgen.timer-number 1

# external output signals

net dout-00 hm2_7i76e.0.7i76.0.0.output-00
net dout-01 hm2_7i76e.0.7i76.0.0.output-01
net dout-02 hm2_7i76e.0.7i76.0.0.output-02
net dout-03 hm2_7i76e.0.7i76.0.0.output-03
net dout-04 hm2_7i76e.0.7i76.0.0.output-04
net dout-05 hm2_7i76e.0.7i76.0.0.output-05
net dout-06 hm2_7i76e.0.7i76.0.0.output-06
net dout-07 hm2_7i76e.0.7i76.0.0.output-07
net dout-08 hm2_7i76e.0.7i76.0.0.output-08
net dout-09 hm2_7i76e.0.7i76.0.0.output-09
net dout-10 hm2_7i76e.0.7i76.0.0.output-10
net dout-11 hm2_7i76e.0.7i76.0.0.output-11
net dout-12 hm2_7i76e.0.7i76.0.0.output-12

# external input signals

net home-x     <=  hm2_7i76e.0.7i76.0.0.input-00
net home-y     <=  hm2_7i76e.0.7i76.0.0.input-01
net home-z     <=  hm2_7i76e.0.7i76.0.0.input-02
net home-a     <=  hm2_7i76e.0.7i76.0.0.input-03
net home-b     <=  hm2_7i76e.0.7i76.0.0.input-04
net home-c     <=  hm2_7i76e.0.7i76.0.0.input-05
net home-u     <=  hm2_7i76e.0.7i76.0.0.input-06
net home-v     <=  hm2_7i76e.0.7i76.0.0.input-07


#*******************
#  AXIS X -- Shoulder
#*******************

setp   pid.x.Pgain     [AXIS_0]P
setp   pid.x.Igain     [AXIS_0]I
setp   pid.x.Dgain     [AXIS_0]D
setp   pid.x.bias      [AXIS_0]BIAS
setp   pid.x.FF0       [AXIS_0]FF0
setp   pid.x.FF1       [AXIS_0]FF1
setp   pid.x.FF2       [AXIS_0]FF2
setp   pid.x.deadband  [AXIS_0]DEADBAND
setp   pid.x.maxoutput [AXIS_0]MAX_OUTPUT
setp   pid.x.error-previous-target true
setp   pid.x.maxerror .0005

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

# Step Gen signals/setup

setp   hm2_7i76e.0.stepgen.00.dirsetup        [AXIS_0]DIRSETUP
setp   hm2_7i76e.0.stepgen.00.dirhold         [AXIS_0]DIRHOLD
setp   hm2_7i76e.0.stepgen.00.steplen         [AXIS_0]STEPLEN
setp   hm2_7i76e.0.stepgen.00.stepspace       [AXIS_0]STEPSPACE
setp   hm2_7i76e.0.stepgen.00.position-scale  [AXIS_0]STEP_SCALE
setp   hm2_7i76e.0.stepgen.00.step_type        0
setp   hm2_7i76e.0.stepgen.00.control-type     1
setp   hm2_7i76e.0.stepgen.00.maxaccel         [AXIS_0]STEPGEN_MAXACCEL
setp   hm2_7i76e.0.stepgen.00.maxvel           [AXIS_0]STEPGEN_MAXVEL

# ---closedloop stepper signals---

net x-pos-cmd    <= axis.0.motor-pos-cmd
net x-vel-cmd    <= axis.0.joint-vel-cmd
net x-output     => hm2_7i76e.0.stepgen.00.velocity-cmd
net x-pos-fb     <= hm2_7i76e.0.stepgen.00.position-fb
net x-pos-fb     => axis.0.motor-pos-fb
net x-enable     <= axis.0.amp-enable-out
net x-enable     => hm2_7i76e.0.stepgen.00.enable

# ---setup home / limit switch signals---

net home-x     =>  axis.0.home-sw-in
net x-neg-limit     =>  axis.0.neg-lim-sw-in
net x-pos-limit     =>  axis.0.pos-lim-sw-in

#*******************
#  AXIS Y - Elbow
#*******************

setp   pid.y.Pgain     [AXIS_1]P
setp   pid.y.Igain     [AXIS_1]I
setp   pid.y.Dgain     [AXIS_1]D
setp   pid.y.bias      [AXIS_1]BIAS
setp   pid.y.FF0       [AXIS_1]FF0
setp   pid.y.FF1       [AXIS_1]FF1
setp   pid.y.FF2       [AXIS_1]FF2
setp   pid.y.deadband  [AXIS_1]DEADBAND
setp   pid.y.maxoutput [AXIS_1]MAX_OUTPUT
setp   pid.y.error-previous-target true
setp   pid.y.maxerror .0005

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

# Step Gen signals/setup

setp   hm2_7i76e.0.stepgen.01.dirsetup        [AXIS_1]DIRSETUP
setp   hm2_7i76e.0.stepgen.01.dirhold         [AXIS_1]DIRHOLD
setp   hm2_7i76e.0.stepgen.01.steplen         [AXIS_1]STEPLEN
setp   hm2_7i76e.0.stepgen.01.stepspace       [AXIS_1]STEPSPACE
setp   hm2_7i76e.0.stepgen.01.position-scale  [AXIS_1]STEP_SCALE
setp   hm2_7i76e.0.stepgen.01.step_type        0
setp   hm2_7i76e.0.stepgen.01.control-type     1
setp   hm2_7i76e.0.stepgen.01.maxaccel         [AXIS_1]STEPGEN_MAXACCEL
setp   hm2_7i76e.0.stepgen.01.maxvel           [AXIS_1]STEPGEN_MAXVEL

# ---closedloop stepper signals---

net y-pos-cmd    <= axis.1.motor-pos-cmd
net y-vel-cmd    <= axis.1.joint-vel-cmd
net y-output     => hm2_7i76e.0.stepgen.01.velocity-cmd
net y-pos-fb     <= hm2_7i76e.0.stepgen.01.position-fb
net y-pos-fb     => axis.1.motor-pos-fb
net y-enable     <= axis.1.amp-enable-out
net y-enable     => hm2_7i76e.0.stepgen.01.enable

# ---setup home / limit switch signals---

net home-y     =>  axis.1.home-sw-in
net y-neg-limit     =>  axis.1.neg-lim-sw-in
net y-pos-limit     =>  axis.1.pos-lim-sw-in

#*******************
#  AXIS Z -- Wrist
#*******************

setp   pid.z.Pgain     [AXIS_2]P
setp   pid.z.Igain     [AXIS_2]I
setp   pid.z.Dgain     [AXIS_2]D
setp   pid.z.bias      [AXIS_2]BIAS
setp   pid.z.FF0       [AXIS_2]FF0
setp   pid.z.FF1       [AXIS_2]FF1
setp   pid.z.FF2       [AXIS_2]FF2
setp   pid.z.deadband  [AXIS_2]DEADBAND
setp   pid.z.maxoutput [AXIS_2]MAX_OUTPUT
setp   pid.z.error-previous-target true
setp   pid.z.maxerror .0005

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
net z-pos-fb        =>  pid.z.feedback
net z-output        =>  pid.z.output

# Step Gen signals/setup

setp   hm2_7i76e.0.stepgen.02.dirsetup        [AXIS_2]DIRSETUP
setp   hm2_7i76e.0.stepgen.02.dirhold         [AXIS_2]DIRHOLD
setp   hm2_7i76e.0.stepgen.02.steplen         [AXIS_2]STEPLEN
setp   hm2_7i76e.0.stepgen.02.stepspace       [AXIS_2]STEPSPACE
setp   hm2_7i76e.0.stepgen.02.position-scale  [AXIS_2]STEP_SCALE
setp   hm2_7i76e.0.stepgen.02.step_type        0
setp   hm2_7i76e.0.stepgen.02.control-type     1
setp   hm2_7i76e.0.stepgen.02.maxaccel         [AXIS_2]STEPGEN_MAXACCEL
setp   hm2_7i76e.0.stepgen.02.maxvel           [AXIS_2]STEPGEN_MAXVEL

# ---closedloop stepper signals---

net z-pos-cmd    <= axis.2.motor-pos-cmd
net z-vel-cmd    <= axis.2.joint-vel-cmd
net z-output     => hm2_7i76e.0.stepgen.02.velocity-cmd
net z-pos-fb     <= hm2_7i76e.0.stepgen.02.position-fb
net z-pos-fb     => axis.2.motor-pos-fb
net z-enable     <= axis.2.amp-enable-out
net z-enable     => hm2_7i76e.0.stepgen.02.enable

# ---setup home / limit switch signals---

net home-z     =>  axis.2.home-sw-in
net z-neg-limit     =>  axis.2.neg-lim-sw-in
net z-pos-limit     =>  axis.2.pos-lim-sw-in

#*******************
#  AXIS A -- Ferris Wheel
#*******************

setp limit3.a.maxv [AXIS_3]MAX_VELOCITY
setp limit3.a.maxa [AXIS_3]MAX_ACCELERATION
setp limit3.a.min  [AXIS_3]MIN_LIMIT
setp limit3.a.max  [AXIS_3]MAX_LIMIT
setp limit3.a.in 0  #this gets set to the target number by M110

setp   pid.a.Pgain     [AXIS_3]P
setp   pid.a.Igain     [AXIS_3]I
setp   pid.a.Dgain     [AXIS_3]D
setp   pid.a.bias      [AXIS_3]BIAS
setp   pid.a.FF0       [AXIS_3]FF0
setp   pid.a.FF1       [AXIS_3]FF1
setp   pid.a.FF2       [AXIS_3]FF2
setp   pid.a.deadband  [AXIS_3]DEADBAND
setp   pid.a.maxoutput [AXIS_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-pos-cmd       =>  pid.a.command
net a-pos-fb0       =>  pid.a.feedback
net a-output        =>  pid.a.output


# Step Gen signals/setup

setp   hm2_7i76e.0.stepgen.03.dirsetup        [AXIS_3]DIRSETUP
setp   hm2_7i76e.0.stepgen.03.dirhold         [AXIS_3]DIRHOLD
setp   hm2_7i76e.0.stepgen.03.steplen         [AXIS_3]STEPLEN
setp   hm2_7i76e.0.stepgen.03.stepspace       [AXIS_3]STEPSPACE
setp   hm2_7i76e.0.stepgen.03.position-scale  [AXIS_3]STEP_SCALE
setp   hm2_7i76e.0.stepgen.03.step_type        0
setp   hm2_7i76e.0.stepgen.03.control-type     1
setp   hm2_7i76e.0.stepgen.03.maxaccel         [AXIS_3]STEPGEN_MAXACCEL
setp   hm2_7i76e.0.stepgen.03.maxvel           [AXIS_3]STEPGEN_MAXVEL

# ---closedloop stepper signals---

net a-pos-cmd-in0 sum2.a-cmd.in0 <= axis.3.motor-pos-cmd
net a-output     => hm2_7i76e.0.stepgen.03.velocity-cmd
net a-pos-fb0 sum2.a-fb.in0  <= hm2_7i76e.0.stepgen.03.position-fb
net a-pos-fb-out => axis.3.motor-pos-fb
net a-enable     <= axis.3.amp-enable-out
net a-enable     => hm2_7i76e.0.stepgen.03.enable

# ---command summation math---
net limit-a-out sum2.a-cmd.in1 sum2.a-fb.in1 <= limit3.a.out
net a-pos-cmd    <= sum2.a-cmd.out

# ---feedback subtraction math---
setp sum2.a-fb.gain1 -1.0  #subtract off limit3 signal
net a-pos-fb-out sum2.a-fb.out 

# ---setup home / limit switch signals---

net home-a     =>  axis.3.home-sw-in
net a-neg-limit     =>  axis.3.neg-lim-sw-in
net a-pos-limit     =>  axis.3.pos-lim-sw-in

#*******************
#  AXIS B -- Tipper
#*******************

setp limit3.b.maxv [AXIS_4]MAX_VELOCITY
setp limit3.b.maxa [AXIS_4]MAX_ACCELERATION
setp limit3.b.min  [AXIS_4]MIN_LIMIT
setp limit3.b.max  [AXIS_4]MAX_LIMIT
setp limit3.b.in 0  #this gets set to the target number by M120

setp   pid.b.Pgain     [AXIS_4]P
setp   pid.b.Igain     [AXIS_4]I
setp   pid.b.Dgain     [AXIS_4]D
setp   pid.b.bias      [AXIS_4]BIAS
setp   pid.b.FF0       [AXIS_4]FF0
setp   pid.b.FF1       [AXIS_4]FF1
setp   pid.b.FF2       [AXIS_4]FF2
setp   pid.b.deadband  [AXIS_4]DEADBAND
setp   pid.b.maxoutput [AXIS_4]MAX_OUTPUT
setp   pid.b.error-previous-target true
setp   pid.b.maxerror .0005

net b-index-enable  <=> pid.b.index-enable
net b-enable        =>  pid.b.enable
net b-pos-cmd       =>  pid.b.command
net b-pos-fb0       =>  pid.b.feedback
net b-output        =>  pid.b.output

# Step Gen signals/setup

setp   hm2_7i76e.0.stepgen.04.dirsetup        [AXIS_4]DIRSETUP
setp   hm2_7i76e.0.stepgen.04.dirhold         [AXIS_4]DIRHOLD
setp   hm2_7i76e.0.stepgen.04.steplen         [AXIS_4]STEPLEN
setp   hm2_7i76e.0.stepgen.04.stepspace       [AXIS_4]STEPSPACE
setp   hm2_7i76e.0.stepgen.04.position-scale  [AXIS_4]STEP_SCALE
setp   hm2_7i76e.0.stepgen.04.step_type        0
setp   hm2_7i76e.0.stepgen.04.control-type     1
setp   hm2_7i76e.0.stepgen.04.maxaccel         [AXIS_4]STEPGEN_MAXACCEL
setp   hm2_7i76e.0.stepgen.04.maxvel           [AXIS_4]STEPGEN_MAXVEL

# ---closedloop stepper signals---

net b-pos-cmd-in0 sum2.b-cmd.in0 <= axis.4.motor-pos-cmd
net b-output     => hm2_7i76e.0.stepgen.04.velocity-cmd
net b-pos-fb0 sum2.b-fb.in0  <= hm2_7i76e.0.stepgen.04.position-fb
net b-pos-fb-out => axis.4.motor-pos-fb
net b-enable     <= axis.4.amp-enable-out
net b-enable     => hm2_7i76e.0.stepgen.04.enable

# ---command summation math---
net limit-b-out sum2.b-cmd.in1 sum2.b-fb.in1 <= limit3.b.out
net b-pos-cmd    <= sum2.b-cmd.out

# ---feedback subtraction math---
setp sum2.b-fb.gain1 -1.0  #subtract off limit3 signal
net b-pos-fb-out sum2.b-fb.out 

# ---setup home / limit switch signals---

net home-b     =>  axis.4.home-sw-in
net b-neg-limit     =>  axis.4.neg-lim-sw-in
net b-pos-limit     =>  axis.4.pos-lim-sw-in

#*******************
#  AXIS C -- Shaker
#*******************

setp limit3.c.maxv [AXIS_5]MAX_VELOCITY
setp limit3.c.maxa [AXIS_5]MAX_ACCELERATION
setp limit3.c.min  [AXIS_5]MIN_LIMIT
setp limit3.c.max  [AXIS_5]MAX_LIMIT
setp limit3.c.in 0  #this gets set to the target number by M130

setp   pid.c.Pgain     [AXIS_5]P
setp   pid.c.Igain     [AXIS_5]I
setp   pid.c.Dgain     [AXIS_5]D
setp   pid.c.bias      [AXIS_5]BIAS
setp   pid.c.FF0       [AXIS_5]FF0
setp   pid.c.FF1       [AXIS_5]FF1
setp   pid.c.FF2       [AXIS_5]FF2
setp   pid.c.deadband  [AXIS_5]DEADBAND
setp   pid.c.maxoutput [AXIS_5]MAX_OUTPUT
setp   pid.c.error-previous-target true
setp   pid.c.maxerror .0005

net c-index-enable  <=> pid.c.index-enable
net c-enable        =>  pid.c.enable
net c-pos-cmd       =>  pid.c.command
net c-pos-fb0       =>  pid.c.feedback
net c-output        =>  pid.c.output

# Step Gen signals/setup

setp   hm2_7i76e.0.stepgen.05.dirsetup        [AXIS_5]DIRSETUP
setp   hm2_7i76e.0.stepgen.05.dirhold         [AXIS_5]DIRHOLD
setp   hm2_7i76e.0.stepgen.05.steplen         [AXIS_5]STEPLEN
setp   hm2_7i76e.0.stepgen.05.stepspace       [AXIS_5]STEPSPACE
setp   hm2_7i76e.0.stepgen.05.position-scale  [AXIS_5]STEP_SCALE
setp   hm2_7i76e.0.stepgen.05.step_type        0
setp   hm2_7i76e.0.stepgen.05.control-type     1
setp   hm2_7i76e.0.stepgen.05.maxaccel         [AXIS_5]STEPGEN_MAXACCEL
setp   hm2_7i76e.0.stepgen.05.maxvel           [AXIS_5]STEPGEN_MAXVEL

# ---closedloop stepper signals---

net c-pos-cmd-in0 sum2.c-cmd.in0 <= axis.5.motor-pos-cmd
net c-output     => hm2_7i76e.0.stepgen.05.velocity-cmd
net c-pos-fb0 sum2.c-fb.in0  <= hm2_7i76e.0.stepgen.05.position-fb
net c-pos-fb-out => axis.5.motor-pos-fb
net c-enable     <= axis.5.amp-enable-out
net c-enable     => hm2_7i76e.0.stepgen.05.enable

# ---command summation math---
net limit-c-out sum2.c-cmd.in1 sum2.c-fb.in1 <= limit3.c.out
net c-pos-cmd    <= sum2.c-cmd.out

# ---feedback subtraction math---
setp sum2.c-fb.gain1 -1.0  #subtract off limit3 signal
net c-pos-fb-out sum2.c-fb.out 

# ---setup home / limit switch signals---

net home-c     =>  axis.5.home-sw-in
net c-neg-limit     =>  axis.5.neg-lim-sw-in
net c-pos-limit     =>  axis.5.pos-lim-sw-in

#*******************
#  AXIS U -- EyeLean
#*******************

setp limit3.u.maxv [AXIS_6]MAX_VELOCITY
setp limit3.u.maxa [AXIS_6]MAX_ACCELERATION
setp limit3.u.min  [AXIS_6]MIN_LIMIT
setp limit3.u.max  [AXIS_6]MAX_LIMIT
setp limit3.u.in 0  #this gets set to the target number by M140

setp   pid.u.Pgain     [AXIS_6]P
setp   pid.u.Igain     [AXIS_6]I
setp   pid.u.Dgain     [AXIS_6]D
setp   pid.u.bias      [AXIS_6]BIAS
setp   pid.u.FF0       [AXIS_6]FF0
setp   pid.u.FF1       [AXIS_6]FF1
setp   pid.u.FF2       [AXIS_6]FF2
setp   pid.u.deadband  [AXIS_6]DEADBAND
setp   pid.u.maxoutput [AXIS_6]MAX_OUTPUT
setp   pid.u.error-previous-target true
setp   pid.u.maxerror .0005

net u-index-enable  <=> pid.u.index-enable
net u-enable        =>  pid.u.enable
net u-pos-cmd       =>  pid.u.command
net u-pos-fb0       =>  pid.u.feedback
net u-output        =>  pid.u.output

# Step Gen signals/setup

setp   hm2_7i76e.0.stepgen.06.dirsetup        [AXIS_6]DIRSETUP
setp   hm2_7i76e.0.stepgen.06.dirhold         [AXIS_6]DIRHOLD
setp   hm2_7i76e.0.stepgen.06.steplen         [AXIS_6]STEPLEN
setp   hm2_7i76e.0.stepgen.06.stepspace       [AXIS_6]STEPSPACE
setp   hm2_7i76e.0.stepgen.06.position-scale  [AXIS_6]STEP_SCALE
setp   hm2_7i76e.0.stepgen.06.step_type        0
setp   hm2_7i76e.0.stepgen.06.control-type     1
setp   hm2_7i76e.0.stepgen.06.maxaccel         [AXIS_6]STEPGEN_MAXACCEL
setp   hm2_7i76e.0.stepgen.06.maxvel           [AXIS_6]STEPGEN_MAXVEL

# ---closedloop stepper signals---

net u-pos-cmd-in0 sum2.u-cmd.in0 <= axis.6.motor-pos-cmd
net u-output     => hm2_7i76e.0.stepgen.06.velocity-cmd
net u-pos-fb0 sum2.u-fb.in0  <= hm2_7i76e.0.stepgen.06.position-fb
net u-pos-fb-out => axis.6.motor-pos-fb
net u-enable     <= axis.6.amp-enable-out
net u-enable     => hm2_7i76e.0.stepgen.06.enable

# ---command summation math---
net limit-u-out sum2.u-cmd.in1 sum2.u-fb.in1 <= limit3.u.out
net u-pos-cmd    <= sum2.u-cmd.out

# ---feedback subtraction math---
setp sum2.u-fb.gain1 -1.0  #subtract off limit3 signal
net u-pos-fb-out sum2.u-fb.out 

# ---setup home / limit switch signals---

net home-u     =>  axis.6.home-sw-in
net u-neg-limit     =>  axis.6.neg-lim-sw-in
net u-pos-limit     =>  axis.6.pos-lim-sw-in

#*******************
#  AXIS V -- Bowtie
#*******************

setp limit3.v.maxv [AXIS_7]MAX_VELOCITY
setp limit3.v.maxa [AXIS_7]MAX_ACCELERATION
setp limit3.v.min  [AXIS_7]MIN_LIMIT
setp limit3.v.max  [AXIS_7]MAX_LIMIT
setp limit3.v.in 0  #this gets set to the target number by M140

setp   pid.v.Pgain     [AXIS_7]P
setp   pid.v.Igain     [AXIS_7]I
setp   pid.v.Dgain     [AXIS_7]D
setp   pid.v.bias      [AXIS_7]BIAS
setp   pid.v.FF0       [AXIS_7]FF0
setp   pid.v.FF1       [AXIS_7]FF1
setp   pid.v.FF2       [AXIS_7]FF2
setp   pid.v.deadband  [AXIS_7]DEADBAND
setp   pid.v.maxoutput [AXIS_7]MAX_OUTPUT
setp   pid.v.error-previous-target true
setp   pid.v.maxerror .0005

net v-index-enable  <=> pid.v.index-enable
net v-enable        =>  pid.v.enable
net v-pos-cmd       =>  pid.v.command
net v-pos-fb0       =>  pid.v.feedback
net v-output        =>  pid.v.output

# Step Gen signals/setup

setp   hm2_7i76e.0.stepgen.07.dirsetup        [AXIS_7]DIRSETUP
setp   hm2_7i76e.0.stepgen.07.dirhold         [AXIS_7]DIRHOLD
setp   hm2_7i76e.0.stepgen.07.steplen         [AXIS_7]STEPLEN
setp   hm2_7i76e.0.stepgen.07.stepspace       [AXIS_7]STEPSPACE
setp   hm2_7i76e.0.stepgen.07.position-scale  [AXIS_7]STEP_SCALE
setp   hm2_7i76e.0.stepgen.07.step_type        0  
setp   hm2_7i76e.0.stepgen.07.control-type     1  #PID control => 1
setp   hm2_7i76e.0.stepgen.07.maxaccel         [AXIS_7]STEPGEN_MAXACCEL
setp   hm2_7i76e.0.stepgen.07.maxvel           [AXIS_7]STEPGEN_MAXVEL

# ---closedloop stepper signals---

net v-pos-cmd-in0 sum2.v-cmd.in0 <= axis.7.motor-pos-cmd
net v-output     => hm2_7i76e.0.stepgen.07.velocity-cmd
net v-pos-fb0 sum2.v-fb.in0  <= hm2_7i76e.0.stepgen.07.position-fb
net v-pos-fb-out => axis.7.motor-pos-fb
net v-enable     <= axis.7.amp-enable-out
net v-enable     => hm2_7i76e.0.stepgen.07.enable

# ---command summation math---
net limit-v-out sum2.v-cmd.in1 sum2.v-fb.in1 <= limit3.v.out
net v-pos-cmd    <= sum2.v-cmd.out

# ---feedback subtraction math---
setp sum2.v-fb.gain1 -1.0  #subtract off limit3 signal
net v-pos-fb-out sum2.v-fb.out 

# ---setup home / limit switch signals---

net home-v     =>  axis.7.home-sw-in
net v-neg-limit     =>  axis.7.neg-lim-sw-in
net v-pos-limit     =>  axis.7.pos-lim-sw-in


#******************************
# connect miscellaneous signals
#******************************

#  ---HALUI signals---

net joint-select-a        halui.joint.0.select
net x-is-homed            halui.joint.0.is-homed
net jog-x-pos             halui.jog.0.plus
net jog-x-neg             halui.jog.0.minus
net jog-x-analog          halui.jog.0.analog
net joint-select-b        halui.joint.1.select
net y-is-homed            halui.joint.1.is-homed
net jog-y-pos             halui.jog.1.plus
net jog-y-neg             halui.jog.1.minus
net jog-y-analog          halui.jog.1.analog
net joint-select-c        halui.joint.2.select
net z-is-homed            halui.joint.2.is-homed
net jog-z-pos             halui.jog.2.plus
net jog-z-neg             halui.jog.2.minus
net jog-z-analog          halui.jog.2.analog
net joint-select-d        halui.joint.3.select
net a-is-homed            halui.joint.3.is-homed
net jog-a-pos             halui.jog.3.plus
net jog-a-neg             halui.jog.3.minus
net jog-a-analog          halui.jog.3.analog
net joint-select-e        halui.joint.4.select
net b-is-homed            halui.joint.4.is-homed
net jog-b-pos             halui.jog.4.plus
net jog-b-neg             halui.jog.4.minus
net jog-b-analog          halui.jog.4.analog
net joint-select-f        halui.joint.5.select
net c-is-homed            halui.joint.5.is-homed
net jog-c-pos             halui.jog.5.plus
net jog-c-neg             halui.jog.5.minus
net jog-c-analog          halui.jog.5.analog
net joint-select-g        halui.joint.6.select
net u-is-homed            halui.joint.6.is-homed
net jog-u-pos             halui.jog.6.plus
net jog-u-neg             halui.jog.6.minus
net jog-u-analog          halui.jog.6.analog
net joint-select-h        halui.joint.7.select
net v-is-homed            halui.joint.7.is-homed
net jog-v-pos             halui.jog.7.plus
net jog-v-neg             halui.jog.7.minus
net jog-v-analog          halui.jog.7.analog

net jog-selected-pos      halui.jog.selected.plus
net jog-selected-neg      halui.jog.selected.minus
net machine-is-on         halui.machine.is-on
net jog-speed             halui.jog-speed 
net MDI-mode              halui.mode.is-mdi



#  ---motion control signals---

net in-position               <=  motion.in-position
net machine-is-enabled        <=  motion.motion-enabled

#  ---digital in / out signals---

# Outputs:
# 3 for pneumatics
# 1 for motor
# 6 pumps
# 3 light show
# 
# Inputs:
# 8 Home Switch inputs
# 1 E-stop input


net dout-00     <=  motion.digital-out-00
net dout-01     <=  motion.digital-out-01
net dout-02     <=  motion.digital-out-02
net dout-03     <=  motion.digital-out-03
net dout-04     <=  motion.digital-out-04
net dout-05     <=  motion.digital-out-05
net dout-06     <=  motion.digital-out-06
net dout-07     <=  motion.digital-out-07
net dout-08     <=  motion.digital-out-08
net dout-09     <=  motion.digital-out-09
net dout-10     <=  motion.digital-out-10
net dout-11     <=  motion.digital-out-11
net dout-12     <=  motion.digital-out-12

#  ---estop signals---

net estop-out     <=  iocontrol.0.user-enable-out
net estop-out     =>  iocontrol.0.emc-enable-in

# --- ESTOP-EXT ---
#net estop-ext     <=  hm2_7i76e.0.7i76.0.0.input-04
#net estop-ext     =>  iocontrol.0.emc-enable-in

I am starting to implement dgarrett's extra-joints branch , so this might be a moot point.

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

More
19 Mar 2019 20:08 #128993 by Todd Zuercher
Don't know if it would make a difference. Have you tried to use Hal's offset component instead of using two sum2s?
linuxcnc.org/docs/html/man/man9/offset.9.html
It would at least make your hal file a little cleaner, and your fb sum2 is using the limit3 value from the previous servo thread cycle. But that may or may not matter. Some Halscope traces when the following error alarm trips probably would be enlightening.
The following user(s) said Thank You: cogzoid

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

More
19 Mar 2019 20:48 #128998 by cogzoid
Oh geeze, that looks like the perfect component for my situation. Thanks for pointing that out! I can definitely clean up my hal file with that. I'm going to try utilizing dgarrett's approach first, though. Thanks!

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

Time to create page: 0.334 seconds
Powered by Kunena Forum