Changing A axis to C axis

  • my1987toyota
  • my1987toyota's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
15 Aug 2021 13:55 #217810 by my1987toyota
Changing A axis to C axis was created by my1987toyota
  Still being a bit of a Noobie I had struggled to change the ini. and hal. files from an A axis to a C axis.
I have finally succeeded. Why was it necessary? On a PnP the picking head needs to orient the part to
the pad on the PCB. A axis is the wrong plane of opperation for this application.
Right now it's more of a principle of the thing ( making sure the correct axis is
represented ) does it truly matter ? Well it hasn't yet. I am sure it will in the future in my project.
I tried looking around the forum and the manual and I didn't find anything helpful.
  Maybe this will help someone in the future. These codes may require some tweaking for individuals applications.
With that said This is " AS IS " use at your own risk I would suggest saving a backup copy of your system before making changes.

  Below is the codes I had to change
the ini. file
in INI file

replace
[KINS]
JOINTS = 4
KINEMATICS = trivkins coordinates=XYZC

with
[KINS]
JOINTS = 4
KINEMATICS = trivkins coordinates=XYZC

[TRAJ]
COORDINATES =  XYZC

add
[AXIS_C]
instead of
[AXIS_A]

The hal. file
in hal file

comment out
#loadrt pid names=pid.x,pid.y,pid.z,pid.a,pid.s
and add
loadrt pid names=pid.x,pid.y,pid.z,pid.c,pid.s

comment out
#addf pid.a.do-pid-calcs       servo-thread
and add
addf pid.c.do-pid-calcs       servo-thread


#*******************
#  AXIS C JOINT 3
#*******************

setp   pid.c.Pgain     [JOINT_3]P
setp   pid.c.Igain     [JOINT_3]I
setp   pid.c.Dgain     [JOINT_3]D
setp   pid.c.bias      [JOINT_3]BIAS
setp   pid.c.FF0       [JOINT_3]FF0
setp   pid.c.FF1       [JOINT_3]FF1
setp   pid.c.FF2       [JOINT_3]FF2
setp   pid.c.deadband  [JOINT_3]DEADBAND
setp   pid.c.maxoutput [JOINT_3]MAX_OUTPUT
setp   pid.c.error-previous-target true
# This setting is to limit bogus stepgen
# velocity corrections caused by position
# feedback sample time jitter.
setp   pid.c.maxerror 0.000500

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

# Step Gen signals/setup

setp   [HMOT](CARD0).stepgen.03.dirsetup        [JOINT_3]DIRSETUP
setp   [HMOT](CARD0).stepgen.03.dirhold         [JOINT_3]DIRHOLD
setp   [HMOT](CARD0).stepgen.03.steplen         [JOINT_3]STEPLEN
setp   [HMOT](CARD0).stepgen.03.stepspace       [JOINT_3]STEPSPACE
setp   [HMOT](CARD0).stepgen.03.position-scale  [JOINT_3]STEP_SCALE
setp   [HMOT](CARD0).stepgen.03.step_type        0
setp   [HMOT](CARD0).stepgen.03.control-type     1
setp   [HMOT](CARD0).stepgen.03.maxaccel         [JOINT_3]STEPGEN_MAXACCEL
setp   [HMOT](CARD0).stepgen.03.maxvel           [JOINT_3]STEPGEN_MAXVEL

# ---closedloop stepper signals---

net c-pos-cmd    <= joint.3.motor-pos-cmd
net c-vel-cmd    <= joint.3.vel-cmd
net c-output     <= [HMOT](CARD0).stepgen.03.velocity-cmd
net c-pos-fb     <= [HMOT](CARD0).stepgen.03.position-fb
net c-pos-fb     => joint.3.motor-pos-fb
net c-enable     <= joint.3.amp-enable-out
net c-enable     => [HMOT](CARD0).stepgen.03.enable

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

net c-home-sw     =>  joint.3.home-sw-in
net c-neg-limit     =>  joint.3.neg-lim-sw-in
net c-pos-limit     =>  joint.3.pos-lim-sw-in


compare the below and replace as necessary
#******************************
# connect miscellaneous signals
#******************************

#  ---HALUI signals---



net axis-select-c  halui.axis.c.select
net jog-c-pos      halui.axis.c.plus
net jog-c-neg      halui.axis.c.minus
net jog-c-analog   halui.axis.c.analog
net c-is-homed     halui.joint.3.is-homed


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

More
17 Aug 2021 11:26 #217972 by jpg
Replied by jpg on topic Changing A axis to C axis
Hello and thank you for sharing, I also tried the C axis for my lathe, but it is a bit confusing, I try your configuration as soon as possible, I will try with Chinese BOB and servos
:
   

Small question: are you in port // or on FPGA cards type MESA ?
 Thanks again
The following user(s) said Thank You: my1987toyota

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

  • my1987toyota
  • my1987toyota's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
19 Aug 2021 09:18 #218123 by my1987toyota
Replied by my1987toyota on topic Changing A axis to C axis
Hi jpg. I am using the AXIS GUI and Mesa cards. I do have to make a small change in the .hal file . If you're using homing switches
you will need to slightly change the code I have on the current file
from this
#--- setup home / limit switch signals---
net c-home-sw   =>  joint.3.home-sw-in

to this
#--- setup home / limit switch signals---
net c-home   =>  joint.3.home-sw-in

if you have any other questions don't hesitate to ask

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

More
19 Aug 2021 11:28 #218133 by jpg
Replied by jpg on topic Changing A axis to C axis
Hello, another question, I often see examples with the component "ORIENT" ( it is Andy who developed it, I think) 
you don't use it in your configuration?  I didn't know that you could do without it.
thanks for sharing.
The following user(s) said Thank You: my1987toyota

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

  • my1987toyota
  • my1987toyota's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
19 Aug 2021 22:15 #218184 by my1987toyota
Replied by my1987toyota on topic Changing A axis to C axis

Hello, another question, I often see examples with the component "ORIENT" ( it is Andy who developed it, I think) 
you don't use it in your configuration?  I didn't know that you could do without it.
thanks for sharing.
 

I haven't needed to use "ORIENT" so far. If I do, I will make note of that so others will know as well.

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

Time to create page: 0.052 seconds
Powered by Kunena Forum