Arrows keys -> spindle in wrong direction

More
26 Sep 2017 19:08 #99481 by tecno
Can somebody please help me as I can not wrap my head around this what is wrong here.

1. Homeing sequence is OK. Home position is left back for X/Y and Z knee down

2. Only Z is moving correctly, PgDn is moving in minus direction

3. X/Y are moving in opposite direction



#********************
# Axis X
#********************
[AXIS_0]

DIRSETUP = 400
DIRHOLD = 400
STEPLEN = 800
STEPSPACE = 800
STEP_SCALE = 1000
MIN_LIMIT = -430
MAX_LIMIT = 10
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = 10.00000
HOME_LATCH_VEL = 3.00000
HOME_FINAL_VEL = .500000


#********************
# Axis Y
#********************
[AXIS_1]

DIRSETUP = 400
DIRHOLD = 400
STEPLEN = 800
STEPSPACE = 800
STEP_SCALE = 1000
MIN_LIMIT = -90
MAX_LIMIT = 240.0
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -10.00000
HOME_LATCH_VEL = -3.00000
HOME_FINAL_VEL = -.500000

#********************
# Axis Z
#********************
[AXIS_2]

DIRSETUP = 400
DIRHOLD = 400
STEPLEN = 800
STEPSPACE = 800
STEP_SCALE = 2000
MIN_LIMIT = -300.0
MAX_LIMIT = 0.01
HOME_OFFSET = 0.00000
HOME_SEARCH_VEL = 10.00000
HOME_LATCH_VEL = 3.000000
HOME_FINAL_VEL = .500000
Attachments:

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

More
26 Sep 2017 19:47 - 26 Sep 2017 19:50 #99486 by Todd Zuercher
Change the sign of the HOME_SEARCH_VEL and HOME_LATCH_VEL to reverse the direction that they travel when homing.

I am pretty sure that the HOME_FINAL_VEL is optional and should always be a positive number. (Probably a larger one.)

What each of these do:
HOME_SEARCH_VEL It sets the speed and direction that the axis searches for the home switch
HOME_LATCH_VEL It sets the speed and direction that the axis does the final touch of the home switch when setting the home position.
If the sign of the HOME_LATCH_VEL is the same as the HOME_SEARCH_VEL the machine will back off the switch and touch the switch in the same direction as it searched for it initially.
If the sign of the HOME_LATCH_VEL is opposite of the HOME_SEARCH_VEL the machine will back off the switch and latch the home position when the switch state changes while backing off.

HOME_FINAL_VEL Is optional, it sets the velocity that the axis moves from the home latch point to the HOME position. If it isn't specified, it moves at the rapid (G0) feed rate. If HOME=0 (what yours is since you haven't specified one) and HOME_OFFSET=0, then there will be no move to be made at HOME_FINAL_VEL.

I suggest you either make HOME_OFFSET = to something other than zero, and/or HOME = to something other than zero, so that the axis will not park smack up against your switch. (very important if the home switch is also a limit switch.)

Maybe I better give you the definitions of HOME_OFFSET and HOME while I'm at it.
HOME_OFFSET is the position value given to the point where the home switch or index (for "Home To Index" with an encoder) is triggered during the home latch move.
HOME Is the position the axis moves to and stops at the end of home move, this final move is done at the HOME_FINAL_VEL or max velocity if not specified.
Last edit: 26 Sep 2017 19:50 by Todd Zuercher.

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

More
26 Sep 2017 19:50 #99487 by tecno
Homeing is working OK as is.

Arrow keys for jogging X/Y is going in wrong direction

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

More
26 Sep 2017 20:14 #99490 by Todd Zuercher
Oops I'm sorry. If the axis are jogging in the wrong direction, then the direction of the motors needs to be reversed. Once that is corrected you will also find that you need to reverse the homing directions.

Ok to change the direction of movement. There are a lot of ways to change the direction of a stepper machine, here are a few.
You could just change the sign of the STEP_SCALE
In you hal file you could invert the dir pin.
You could just change the wiring to the motor.

I know you have been working on a stepper config with encoder feedback. Is this the machine? Is the encoder directions correc?
That adds another wrinkle to getting the directions right.

Also don't forget that with moving table format machines the direction of movement is opposite of the jog key arrows.
When you push the right arrow button the table should move to the left. The jog keys are tool centric, such that pressing the right arrow should move the tool to the right side of the table, moving the table to the left. (it is amazing how many people get this wrong.)

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

More
26 Sep 2017 20:30 #99491 by tecno
Yes this the same milling machine, it looks like the encoders are working.

For me the tool has to move in arrow key direction and only Z acts correctly now. Will do some edits tomorrow and hopefully I get this working properly.

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

More
27 Sep 2017 02:29 #99499 by Todd Zuercher
If the encoders are working, does the DRO also go the wrong way? You will also likely need to change the sign of the encoder scale.

Are you running the steppers closed loop, feeding the encoder feedback into the PID loop?

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

More
27 Sep 2017 06:13 #99504 by tecno
DRO shows correct.

I am not sure if I am actually running Closed Loop yet, it has been so many things to get functional.
Assuming HAL give the answer.

File Attachment:

File Name: combimillx...9-27.ini
File Size:5 KB

File Attachment:

File Name: combimillx...9-27.hal
File Size:17 KB
Attachments:

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

More
27 Sep 2017 11:12 #99515 by tecno
I did change Step_Scale and homing settings and now have tool movement as arrow keys point.

So now maybe we can have a look at closing the loop and connect encoders to PID?

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

More
27 Sep 2017 13:05 #99517 by Todd Zuercher
You need to remember running in true closed loop with ordinary stepper motors could give mixed results.
If the final results are unsatisfactory, you can just use the encoder feed back for only DRO and following error and leave it out of the PID loop.

Right now it does not appear that the encoder feedback is actually used for any of the axis' feedback.

One thing you will have to do after connecting the encoders to the PID loop is tune the PID loop. The default setting of P=1000 will not work. It will have to be lower, maybe much lower. Start with a number like P=10 and increase it until you find the right balance of response and minimal overshoot.. If you have never tuned a velocity loop servo, read up on some of the tutorials, this should be very similar.

Here is what to do to connect encoder.00 to the X-axis. the other axis would be similar
The changes needed are simply adding two lines of hal code and changing one line.
change:
net x-pos-fb <= hm2_7i76e.0.stepgen.00.position-fb
to:
net x-pos-fb <= hm2_7i76e.0.encoder.00.position
and add:
net x-vel-fb => pid.x.feedback-deriv
net x-vel-fb <= hm2_7i76e.0.encoder.00.velocity

Here is how I'd put it in the AXIS X section of your Hal file
#*******************
#  AXIS X
#*******************

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  (this line is not right and should probably be remeoved)

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-vel-fb        =>  pid.x.feedback-deriv
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        2
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     <= hm2_7i76e.0.encoder.00.position
net x-vel-fb     <= hm2_7i76e.0.encoder.00.velocity
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 min-x     =>  axis.0.neg-lim-sw-in
net max-x     =>  axis.0.pos-lim-sw-in

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

More
27 Sep 2017 13:45 #99519 by tecno
AC servos with S/D interface.

I will give it a go and see what happens.

Thanks for your kind support.

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

Time to create page: 0.095 seconds
Powered by Kunena Forum