Spindle Step/Dir servo ramp down before stop on M stop command.

More
5 years 5 months ago #209201 by NoJo

andypugh wrote:

This might actually be possible...

Firstly, the machine would probably need to be configured to start up in C-axis mode, and with the C-axis as part of the homing sequence.
The C axis should then be configured in the INI with HOME_USE_INDEX = 1 , HOME_SEARCH_VELOCITY = 0 and HOME_LATCH_VELOCITY = 100 (or some suitable number)

Then connect joint.2.index-enable to the encoder index-enable
Not sure how to do this - where/what is 'encoder index-enable' ?


Remove the "setp index-enable" line from the M100 script. Instead use:

Code:
halcmd setp halui.joint.2.unhome 1 sleep 1 halcmd setp halui.joint.2.unhome 0 halcmd setp joint.2.home 1 sleep 1 halcmd setp joint.2.home 0


There is no "setp index-enable" line in the M100 script - this is what we had:
Code:
#! /bin/bash halcmd setp pid.c.enable 1 halcmd setp mux2.0.sel 1 halcmd sets spindle-index-enable 1
Do you mean remove set S spindle-index-enable ?

Please Log in to join the conversation.

More
5 years 5 months ago #209212 by andypugh

RBC wrote: I need to poll for stepgen velocity=0 before executing position-reset so I dont get the following errors.
Is this something I can do?


Yes, I would imagine so. A bash script can use "halcmd getp" to get a value, and Python can either use that in an exec() or query the status structure.

Quite how you poll and wait in bash I can't say, but I imagine that the info is online.

Please Log in to join the conversation.

More
5 years 5 months ago #209213 by andypugh

NoJo wrote: Then connect joint.2.index-enable to the encoder index-enable
Not sure how to do this - where/what is 'encoder index-enable' ?


In the HAL file. The HAL already has a signal defined
Code:
net spindle-index-enable <=> [HMOT](CARD0).encoder.00.index-enable
so use that signal.
Code:
net spindle-index-enable joint.2.index-enable net spindle-index-enable pid.c.index-enable


Do you mean remove set S spindle-index-enable ?

Yes.

Please Log in to join the conversation.

More
5 years 5 months ago #209246 by NoJo

andypugh wrote:

NoJo wrote:

Code:
net spindle-index-enable joint.2.index-enable net spindle-index-enable pid.c.index-enable

Shows still how little I understand...

I tried 'almost' that in the file, but swapped like so
net joint.2.index-enable spindle-index-enable

as you sort of had that sentence order in your comment:
Then connect joint.2.index-enable to the encoder index-enable...
And it gave an error about same name pins...

Ok, I have the files set as I think you want, but am sure I still have something incorrect.
The behaviour now -
Do HOME ALL - All axes home, C rotates slowly to index and stops ( is it the index position?)
Then in MDI, do M100
> gives error = 'must be in joint mode or disabled to un-home'

Then M101, and spin the axis in manual - M03 S100 M05.
The M100 > C oscillates wildly, and goes back to the C DRO position that was set before the M101. The axis is not 'homed' .
and > gives error = 'must be in joint mode or disabled to un-home'

Hal file section:
Code:
#******************* # AXIS C JOINT 2 #******************* setp pid.c.Pgain [JOINT_2]P setp pid.c.Igain [JOINT_2]I setp pid.c.Dgain [JOINT_2]D setp pid.c.bias [JOINT_2]BIAS setp pid.c.FF0 [JOINT_2]FF0 setp pid.c.FF1 [JOINT_2]FF1 setp pid.c.FF2 [JOINT_2]FF2 setp pid.c.deadband [JOINT_2]DEADBAND setp pid.c.maxoutput [JOINT_2]MAX_OUTPUT setp pid.c.error-previous-target true net c-pos-cmd => pid.c.command net spindle-revs scale.degrees.in setp scale.degrees.gain 360 net spindle-degrees scale.degrees.out => pid.c.feedback net c-output pid.c.output => mux2.0.in1 net spindle-index-enable joint.2.index-enable net spindle-index-enable pid.c.index-enable # Here we setup to start machine in C_Axis mode setp pid.c.enable 1 setp mux2.0.sel 1 net c-pos-cmd <= joint.2.motor-pos-cmd joint.2.motor-pos-fb net c-vel-cmd <= joint.2.vel-cmd

INI Section:
Code:
#****************************************** #-# Add Axis C [AXIS_C] MAX_VELOCITY = 1440.0 #was 360 MAX_ACCELERATION = 12000.0 #was 3000 MIN_LIMIT = -3600 MAX_LIMIT = 3600 [JOINT_2] TYPE = ANGULAR HOME = 0 FERROR = 1.0 MIN_FERROR = .1 MAX_VELOCITY = 1440 MAX_ACCELERATION = 12000 P =0.1 I = 0.0 D = 0.0 FF0 = 0.0 FF1 = 0.0027777 FF2 = 0.0 BIAS = 0.0 DEADBAND = 0.05 MAX_OUTPUT = 400 MIN_LIMIT = -3600 MAX_LIMIT = 3600 HOME_OFFSET = 0.000000 HOME_SEARCH_VEL = 0.0 HOME_LATCH_VEL = 50 HOME_SEQUENCE = 1 HOME_USE_INDEX = 1 #******************************************

M100 Script:
Code:
#! /bin/bash halcmd setp pid.c.enable 1 halcmd setp mux2.0.sel 1 halcmd setp halui.joint.2.unhome 1 sleep 1 halcmd setp halui.joint.2.unhome 0 halcmd setp joint.2.home 1 sleep 1 halcmd setp joint.2.home 0

M101 Script
Code:
#! /bin/bash halcmd setp pid.c.enable 0 halcmd setp mux2.0.sel 0

Please Log in to join the conversation.

More
5 years 5 months ago #209256 by andypugh

NoJo wrote: Shows still how little I understand...


I am winging it myself now too.

I tried 'almost' that in the file, but swapped like so
net joint.2.index-enable spindle-index-enable


That actually creates a new signal called "joint.2.index-enable" which is also an existing pin, so may be disallowed, but would be confusing if not.


Ok, I have the files set as I think you want, but am sure I still have something incorrect.

More likely I have something incorrect, actually.

The behaviour now -
Do HOME ALL - All axes home, C rotates slowly to index and stops ( is it the index position?)
Then in MDI, do M100
> gives error = 'must be in joint mode or disabled to un-home'


Now that I am back at a LinuxCNC machine I am able to experiment.
Try this:

M100 Script:
Code:
#! /bin/bash halcmd setp pid.c.enable 1 halcmd setp mux2.0.sel 1 halcmd setp halui.mode.joint 1 sleep 1 halcmd setp halui.mode.joint 0 halcmd setp joint.2.home 1 sleep 1 halcmd setp joint.2.home 0

Please Log in to join the conversation.

More
5 years 5 months ago #209257 by andypugh

NoJo wrote: Do HOME ALL - All axes home, C rotates slowly to index and stops ( is it the index position?)


Should be. Does it look like it?

You can make it move faster by changing the [JOINT_2]LATCH_VELOCITY

Please Log in to join the conversation.

More
5 years 5 months ago #209262 by NoJo

andypugh wrote:

NoJo wrote: Do HOME ALL - All axes home, C rotates slowly to index and stops ( is it the index position?)


Should be. Does it look like it?

You can make it move faster by changing the [JOINT_2]LATCH_VELOCITY


I made an alignment mark on the spindle to headstock, aligned when the encoder is on index, so yes, it is on index - my sentence was structured badly - I guess I meant to ask if it is supposed to home and stop at index - But Yes it is...

The rotation speed to index is fine - takes maybe 1 sec to do 180deg - for homing that is ok..

Please Log in to join the conversation.

More
5 years 5 months ago #209264 by andypugh
I have been thinking about this a little more, and it might be necessary to do a little more fiddling with pins.

I think that, at the very least, we need to turn on the pid and the mux at the same time as the homing command. At the moment they are active for 2 seconds before homing begins and that is probably a problem.
Code:
#! /bin/bash halcmd setp halui.mode.joint 1 sleep 1 halcmd setp halui.mode.joint 0 halcmd setp joint.2.home 1 halcmd setp pid.c.enable 1 halcmd setp mux2.0.sel 1 sleep 1 halcmd setp joint.2.home 0

Please Log in to join the conversation.

More
5 years 5 months ago #209308 by NoJo

andypugh wrote: I have been thinking about this a little more, and it might be necessary to do a little more fiddling with pins.

I think that, at the very least, we need to turn on the pid and the mux at the same time as the homing command. At the moment they are active for 2 seconds before homing begins and that is probably a problem.


Glad you know where to fiddle..but more fiddling needed:

HOME ALL > C rotates to index, stops momentarily ,shoots past, oscillates, converges to index and stops. Axes all show home icon
  • Jog C to 90deg - C rotates OK, DRO increments to 90deg

  • M101 > Jog works on all axes, C does not rotate but DRO changes.
  • Jog C DRO to 270deg

  • M100 > C does not home but rotates to DRO setting = 270deg, rotate is very fast and oscillates about 270deg, to standstill.
  • The start of this rotation appears to be delayed maybe 2 seconds after the M100 ( 2 x sleep 1 ?)
  • DRO's still all show home icon.
  • Jog no longer works on any axis.

  • M101 > Jog works again, as above M101
    M100 > C stays where it is - did not move from DRO position so no motion, but does not home, Jog not working.

    Please Log in to join the conversation.

    More
    5 years 5 months ago #209383 by andypugh

    NoJo wrote: HOME ALL > C rotates to index, stops momentarily ,shoots past, oscillates, converges to index and stops. Axes all show home icon

    That was better before, I think?

    M101 > Jog works on all axes, C does not rotate but DRO changes.

    To be expected, really. Add "setp axis.c.jog-enable 0" to M101 and "setp axis.c.jog-enable 1" to M100 to fix that.

    M100 > C does not home but rotates to DRO setting = 270deg, rotate is very fast and oscillates about 270deg, to standstill.

    That's odd.


    It is starting to look like my idea for a simple way to do this wasn't very good.

    I think you had something usable about 2 iterations ago, and it has got worse since?

    Please Log in to join the conversation.

    Time to create page: 0.725 seconds
    Powered by Kunena Forum