Hal help for home to index with stepgen firmware update

More
12 Feb 2023 19:24 - 12 Feb 2023 19:59 #264372 by Lcvette
Hello all,

I am hoping this can be solved here and used as future reference for those connecting index pulse on a step direction system with motor encoders,  but not using the encoders for feedback to close the loop. 

My system: 7i92+7i76+7i77
- I control the servos drives with the 7i76 in step and direction
- I feed the motor encoders to the 7i77
- I do not run in feedback control mode due to rough operation that could not be resolved. 
- Goal: utilize motor encoder index pulse to more accurately/ repeatability home the machine. 
- I have new firmware for utilizing this feature from @PCW at Mesa Electronics
- I have attached the new firmware below as well.

  

File Attachment:

File Name: 7i92_chris.zip
File Size:130 KB


Notes from PCW:  There are now 2 index-enable hal pins per encoder: the encoder index enable and the stepgen index enable.


Below is the X axis portion from my existing non index pulse home configuration.  There are some commented out lines from when we were testing feedback mode.

#*******************
# AXIS X JOINT 0
#*******************

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 0

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_7i92.0.stepgen.00.dirsetup             [JOINT_0]DIRSETUP
setp hm2_7i92.0.stepgen.00.dirhold              [JOINT_0]DIRHOLD
setp hm2_7i92.0.stepgen.00.steplen              [JOINT_0]STEPLEN
setp hm2_7i92.0.stepgen.00.stepspace            [JOINT_0]STEPSPACE
setp hm2_7i92.0.stepgen.00.position-scale       [JOINT_0]STEP_SCALE
setp hm2_7i92.0.stepgen.00.step_type            0
setp hm2_7i92.0.stepgen.00.control-type         1
setp hm2_7i92.0.stepgen.00.maxaccel             [JOINT_0]STEPGEN_MAXACCEL
setp hm2_7i92.0.stepgen.00.maxvel               [JOINT_0]STEPGEN_MAXVEL

# ---closedloop stepper signals---

net x-pos-cmd <= joint.0.motor-pos-cmd
net x-vel-cmd <= joint.0.vel-cmd
net x-output <= hm2_7i92.0.stepgen.00.velocity-cmd
net x-pos-fb <= hm2_7i92.0.stepgen.00.position-fb
##net x-pos-fb <= hm2_7i92.0.encoder.00.position
net x-pos-fb => joint.0.motor-pos-fb
##net x-encpos-fb => joint.0.motor-pos-fb
net x-enable <= joint.0.amp-enable-out
net x-enable => hm2_7i92.0.stepgen.00.enable

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

setp hm2_7i92.0.encoder.00.counter-mode 0
setp hm2_7i92.0.encoder.00.filter 1
setp hm2_7i92.0.encoder.00.index-invert 0
setp hm2_7i92.0.encoder.00.index-mask 0
setp hm2_7i92.0.encoder.00.index-mask-invert 0
setp hm2_7i92.0.encoder.00.scale                      [JOINT_0]ENCODER_SCALE

# ****the following line is for drive tuning purposes only****

net x-encpos-fb <= hm2_7i92.0.encoder.00.position
net x-vel-fb <= hm2_7i92.0.encoder.00.velocity
net x-pos-fb => joint.0.motor-pos-fb
net x-index-enable joint.0.index-enable <=> hm2_7i92.0.encoder.00.index-enable
net x-pos-rawcounts <= hm2_7i92.0.encoder.00.rawcounts

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

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





My hope is to create a hal example for an axis for future searchable reference regarding this scenario as I could not find anything specifically related to this method with updated firmware and linuxcnc 2.9, and did not see an option to select in the config builder softwares like mesact, pncconfig, etc.

Any help is greatly appreciated! 

Chris
Attachments:
Last edit: 12 Feb 2023 19:59 by Lcvette.
The following user(s) said Thank You: Clive S

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

More
16 Feb 2023 06:15 - 16 Feb 2023 07:02 #264600 by Lcvette
I am updating this thread as I have gotten my machine running with home to index using step direction in open loop mode but with the use of encoders being connected to one of my mesa boards.  below is the current working hardware configuration.

7i92+7i76+7i77

This configuration requires the use of an updated firmware from Mesa to utilize a second stepgen encoder enable signal.  once the new firmware is obtained, the following x axis Hal excerpt can be used as a guide template for what will be needed in Hal.

I started with a config built using PNCCONFIG to create the Hal files. the following are the selections required to make the config correct for editing:

-  FEEDBACK = ACTUAL (this creates the encoder halpins which we need, but we will edit some Hal lines to disable feedback control.)

-  Set the joint STEPGENS and ENCODERs on the same designation, For  Example: X Axis, joint, would be configured on STEPGEN.00 and ENCODER.00   They need to match for setting the stepgen index enable signal.

-  The rest must be configured such that you are using the correct cards and in the correct order as the firmware you have.  these instructions may come with your firmware notes.

For the Hal edits, there are really only two needed once you have a feedback type config built from PNCCONFIG.  This is to remove the feedback loop to the PID, This is shown below in Bold BLUE, we are simply renaming the net so that it isn't the source of feedback the PID uses for motion.

net x-pos-fb <= hm2_7i92.0.encoder.00.position

will be changed to:

net x-encpos-fb <= hm2_7i92.0.encoder.00.position


The next change is where we define the index enable pin.

net x-index-enable joint.0.index-enable <=> hm2_7i92.0.encoder.00.index-enable

will be changed to:

net x-index-enable joint.0.index-enable <=> hm2_7i92.0.stepgen.00.index-enable


This should b the extent of what will be required to change in Hal.  You will need to update the INI file joint homing sections and change the following highlighted items to enable home to index. The other settings will be per your own machine requirements.  HOME_USE_INDEX = YES.

From the INI file of the configuration output change the line as show below:

MIN_LIMIT = 0
MAX_LIMIT = 26.5
HOME_OFFSET = .170
HOME_SEARCH_VEL = -2.00
HOME_LATCH_VEL = .100
HOME_FINAL_VEL = .400
HOME_USE_INDEX = YES
HOME_SEQUENCE = 1


Note these edits will of course need to be done for ALL of your used JOINTS (X, Y, Z, A, B etc...)


Hopefully this helps someone out, It was new and as of yet undocumented and the information was rather spread out and hidden in various threads.  thanks to the help of PCW and Tom_L I was able to get my machine homing to index! and it is Glorious!


Edit the above Hal Lines from the Hal File, their location is shown below for clarity:

#*******************
# AXIS X JOINT 0
#*******************

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 0

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

# Step Gen signals/setup

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

# ---closedloop stepper signals---

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

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

setp hm2_7i92.0.encoder.00.counter-mode 0
setp hm2_7i92.0.encoder.00.filter 1
setp hm2_7i92.0.encoder.00.index-invert 0
setp hm2_7i92.0.encoder.00.index-mask 0
setp hm2_7i92.0.encoder.00.index-mask-invert 0
setp hm2_7i92.0.encoder.00.scale      [JOINT_0]ENCODER_SCALE

net x-encpos-fb <= hm2_7i92.0.encoder.00.position
net x-vel-fb    <= hm2_7i92.0.encoder.00.velocity
net x-pos-fb    => joint.0.motor-pos-fb
net x-index-enable joint.0.index-enable <=> hm2_7i92.0.stepgen.00.index-enable
net x-pos-rawcounts  <= hm2_7i92.0.encoder.00.rawcounts
Last edit: 16 Feb 2023 07:02 by Lcvette.
The following user(s) said Thank You: spumco

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

More
29 May 2023 00:54 #272381 by jhandel
I should read the whole thread (especially the first part)... you are running 2.9... thanks and sorry for the noise.. I would delete the previous post if it was allowed.

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

More
29 May 2023 11:09 #272420 by tommylight
Deleted.
Pretty sure you should be able to delete your own posts, but can not recall for sure.

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

More
29 May 2023 23:07 #272462 by rodw

Deleted.
Pretty sure you should be able to delete your own posts, but can not recall for sure.

No, its not possible. Best solution is to delete the content and put a note in 
The following user(s) said Thank You: tommylight

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

Time to create page: 0.472 seconds
Powered by Kunena Forum