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

More
14 May 2021 15:46 #208812 by NoJo

Is it possible to do a full re-home on the C axis when returning to Axis mode?


I don't know -
Perhaps like this:
In M101 mode - When HOMING - HOME C 'status', and DRO.
Then when going M100, first rotate C till index, zero encoder counter, then rotate to commanded angle ( zero in this case, after homing)
Then, after a Gx Cxxx position command, if exiting via M101, and running the spindle, and the going back into C axis mode with M100, first rotate C till index, then zero encoder count, then rotate to original commanded C axis position...

I wonder if some of the behavior is motor drive related, that is, does the drive "remember"
its position when disabled?

No, the drive and motor is dumb - it is basically just a stepper that does not lose steps ( within reason..)

Ok for you and Andy, I did a few Halscope plots - that is tedious! Transfer the log file windows, excel, screen capture, etc, etc..

I set up the scope to capture:
axis.c.pos-cmd
hm2_7i92.0.encoder.00.count
hm2_7i92.0.encoder.00.position

I also opened a few Halmeters:
hm2_7i92.0.encoder.00.position
hm2_7i92.0.encoder.00.count
pid_c_command
pid_c_feedback

Procedure:
After starting LCNC I HOME_All, then the column 'user input' are the commands/mouse clicks I execute.
The resulting values of the parameters are then shown the the same line as the user input, for that input.
user input	7i92enc.pos	7i92enc.cnt	pid_c_cmd	pid_c_feedbk	DRO Value

HOME_ALL		0		0		0		0		0	
then M100,
   G0 C360		1		-4096		360		360		360
				[see halscope Stable_360.jpg -	move to 360deg was stable]

Then F2
Move C 3 turns
     Manually		4.33		-17739		1559		360		360
  Then F2		1		-4096		360		360		360 
				[see halscope F2_Unwind.jpg : When axis enabled-F2
				it unwinds the 3 manual turns first -wild oscillation
				DRO did not change during manual move of C axis]

Leave as above, M100	1		-4096		360		360		360
is active, C@360
 Then M101, F2
Move C 3 turns
     Manually		4.23		-17339		1523		360		360
 Then F2, M100		1		-4096		360		360		360
				[did NOT unwind the 3 turns, went to the 360deg pos, oscillated
 				briefly, and stopped. NOTE : DRO did NOT change during all
				 of this see Halscope F2_NO_Unwind.jpg]

Leave as above, M100
is active, C@360
then HOME_ALL		1		-4096		360		360		0
						[ NOTE - DRO went to 0 during HOME _ALL, but
						 pos, cnt and cmd remained as they were]

Now G0 C360		2		-8192		720		720		360
						[Now the DRO is correct, but the encoder pos and
						 counts are 'out'  See halscope - HOME_C360.jpg
Attachments:

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

More
14 May 2021 16:01 #208815 by NoJo

Can you clarify the current status:
Position mode works OK if the lathe hasn't been used in lathe mode
After using lathe mode, position mode sort-of works, but takes a very long time and many oscillations to settle?
I am not clear if jogging works in position mode. (Do you see the DRO angle change if you jog?)


Sorry for obfuscating thigs so badly - I had indicating the status in detail in posts about 6 or 8 previous, but its lost in the verbose detail...

In summary:
The very first M100 C axis enable followed with a move > 30 deg or so ,after HOME cmd, can be unstable - not always, but often.
ANY move after that, with M100 active, is ALWAYS stable, clean and critically damped.
If you disable the axis (F2) and move it, or M101 and run the spindle with M03 Sxxx, then M05, then M100 again, it will oscillate till at position - for seconds. Thereafter, as above, ALL further moves are stable and clean.
(NOTE - I have tamed that oscillation with your suggestion of pid.c.maxoutput = 5, and increased max_vel and max_accel., but this is just masking the issue).

WRT jogging.

After HOME-ING (all) , X and Z jog correctly ( jog wheel, AXIS mouse button, User pushbuttons)
C does not jog, C DRO does not change - C at this point is in M101.

THEN, if you go M100, none of the axes jog anymore - no jogwheels, no user jog buttons work.
However, ( in M100 say) if you use the mouse and jog X or Z momentarily on the AXES screen jog buttons, the axis jogs and THEN all the jog wheels and user pushbuttons work again - including jog C axis , if in M100.

THEN, if you do M101, the jog no longer works again. But do the AXIS screen button jog trick with X or Z again, and all works again...

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

More
14 May 2021 16:04 - 14 May 2021 16:05 #208816 by PCW
1. Encoder counts are not used so there no point in plotting them.
really only interested in encoder position (position feedback)
and position command

2. Not sure why the spindle position is scaled, this makes it hard to
interpret what's going. Its certainly not needed for a normal C axis,
and since the motion issues are all on Axis mode. this part should be as straight
forward as possible. Scaling the spindle speed for spindle mode
has fewer side effects
Last edit: 14 May 2021 16:05 by PCW.

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

More
14 May 2021 17:00 #208823 by NoJo

1. Encoder counts are not used so there no point in plotting them.
really only interested in encoder position (position feedback)
and position command

2. Not sure why the spindle position is scaled, this makes it hard to
interpret what's going. Its certainly not needed for a normal C axis,
and since the motion issues are all on Axis mode. this part should be as straight
forward as possible. Scaling the spindle speed for spindle mode
has fewer side effects


Ok, so are those plots useless? I am as I stated often, not familiar with all the syntax, parameter names, etc - I am learning, but ..

You asked for halscope plots of encoder position and commanded position - no mention of 'feedback' there so I can maybe be forgiven?
I will redo as needed, - can you be specific as to what parameters I should plot?


The spindle position scaling - All the CAM programs I have used ( BoBCAM, ECAM, SpruteCAM, all command C axis on a lathe in degrees - the G01 Cxx are xx i\n degrees, so the units of 0 to 1 in LCNC meaning 0 to 360deg is not of much use...

....and since the motion issues are all on Axis mode

- I don't know what that means..

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

More
14 May 2021 17:16 - 14 May 2021 17:18 #208826 by PCW
encoder position is the feedback position

If the C axis were scaled in degrees (which would be standard)
The encoder position would match the commanded position, making it easier
to see what's going on. in Axis mode (you have two modes, one I would call
axis mode and the other, spindle mode)

If the axis is scaled in degrees you would need to scale the feedback
to LinuxCNC in rotations for spindle mode. But spindle mode is much
simpler, you don't even need PID

I do think that you need somehow to do what linuxCNC does when it first
initializes an axis: set its joint commanded position = to the joint feedback
position so there is no jump when changing modes. I dont know if this
happen when you re-home an axis or if you can programmatically
force a re-home
Last edit: 14 May 2021 17:18 by PCW.

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

More
14 May 2021 19:55 - 14 May 2021 20:02 #208848 by NoJo
Forgive me, I am somewhat confused...
You stated:
2. Not sure why the spindle position is scaled, this makes it hard to
interpret what's going.


And now you said:
If the C axis were scaled in degrees (which would be standard)

The C axis IS scaled in degrees, or at least that's my understanding - I command it with Gx C(degrees)
My understanding is that 'spindle position' and 'C_Axis position' is the same thing in M100 ( C axis enabled mode) - the angle that the encoder on the spindle has been rotated to.
C_axis mode, which I believe you refer to as Axis mode, which I enable by means of an M100 code, IS scaled in degrees.
And then Spindle mode is the non-angular spindle mode, ie, exit from M100 mode with a M101 command, at which point a spindle-on, speed command - M03 S1000 - would turn on the spindle at 1000rpm.


2. Not sure why the spindle position is scaled, this makes it hard to
interpret what's going. Its certainly not needed for a normal C axis,
and since the motion issues are all on Axis mode


So, I don't understand that statement , what 'spindle position' means since I thought the spindle has no position in 'Spindle mode' - it just turns at a commanded speed...And therefore I am not aware that it is scaled..
Also I thought you said If the C axis were scaled in degrees (which would be standard, but then say Its certainly not needed for a normal C axis,

I have a headache..!

Sorry, battling to understand this stuff!

Edit:
WRT the parameters to plot -
'encoder position(feedback position) and commanded position'
Do you mean pid.c.command and pid.c.feedback?
Last edit: 14 May 2021 20:02 by NoJo.

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

More
14 May 2021 20:41 - 14 May 2021 20:42 #208851 by PCW
The spindle in not natively scaled is degrees, its been patched with the scale component.

I guess what I am saying is it looks like a C axis mode was added to the
native spindle mode (which is scaled in turns) rather than starting with a C
axis and adding the simpler spindle mode.

If the Axis mode was the native mode, the only external scaling applied would be in the
spindle mode (multiply the position in degrees by 1/360 to feed to LinuxCNCs
spindle.0.revs pin when running in spindle mode) This means in axis mode the joint
position command and joint position feedback are both in degrees. (and FF1=1.00)
Last edit: 14 May 2021 20:42 by PCW.

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

More
15 May 2021 06:38 #208894 by NoJo
PCW, Thanks for trying to get me to understand things!
It is not easy for me I fear - I used Stepconfig and Pnconfig to define a setup for a benchtop mill and a gantry router - that worked fine, was easy, but that method isolates me totally from the guts of the thing - nothing to fiddle with in the HAL/ini files so one learns nothing.

This lathe is very complicated for me. The basic lathe was complicated by the use of a step/dir servo for the main spindle drive. That required step pulse manipulation for the M05 type command to not bang the spindle to a halt from 2500rpm - I am not capable of implementing that sort of function as I know far to little of the software system and its innards. Andy kindly assisted with that. And then the basic lathe (2 axis) worked, and works nicely.

If I could not implement the step pulse control myself, for the decel control, there is no way I will manage the C_axis, and so I rely on the goodwill and kind assistance of people like you and Andy. I have no option. But that means that if you wish to assist, you have most of the work to do. I work very hard at researching and digging into what has been suggested to try understand how it works, what it does, and how the hardware and software tie together. But I can only do so after the effect - I cannot invent the solution -
Perhaps in due course, if the solution begins to solidify, I can learn from it and begin to understand better, but at the moment I remain un-enlightened, and trying.

The spindle in not natively scaled is degrees, its been patched with the scale component.
Again, I am unaware of what was done here, my understanding is that the
spindle mode ( normal 2 axis lathe spindle M03 Sxxx) is left untouched, but in C_Axis mode ( M100, C_axis enabled), the Gx Cxxx commands are scaled to be in degrees, not units of 1. Obviously I have not understood this correctly, but cannot fathom what goes on here, and how it links to the rest of the control:

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


To me there are many mixed things here - spindle-revs appear to be scaled in degrees, etc, and I am lost ...

If the Axis mode was the native mode, the only external scaling applied would be in the
spindle mode (multiply the position in degrees by 1/360 to feed to LinuxCNCs
spindle.0.revs pin when running in spindle mode)


Again, I have no idea how to do that - I followed Andy's guidance - As Andy said, he is also learning with this implementation - if there is a more appropriate and correct method, could you provide an Implementation to get us going?

If the axis is scaled in degrees you would need to scale the feedback
to LinuxCNC in rotations for spindle mode. But spindle mode is much
simpler, you don't even need PID

I do think that you need somehow to do what linuxCNC does when it first
initializes an axis: set its joint commanded position = to the joint feedback
position so there is no jump when changing modes. I dont know if this
happen when you re-home an axis or if you can programmatically
force a re-home


Where can we start to actually implement this concept, together with all the other bits - Servo speed control during spindle stop, etc?
I am willing to start from scratch as many times as it takes!
But I do need a clear setup, eg, a defined HAL and ini file, that implements the concepts. Then I can test, and try understand how to make it work.
That means the folk who wish to help me are going to be harassed even more by me, and I do not wish to annoy more that I already have..

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

More
15 May 2021 15:04 #208917 by andypugh

The spindle in not natively scaled is degrees, its been patched with the scale component.

I guess what I am saying is it looks like a C axis mode was added to the
native spindle mode (which is scaled in turns) rather than starting with a C
axis and adding the simpler spindle mode.


I think that we need both, as this is a lathe, so needs turns on a 0 to 1 scale fed in to spindle.0.revs for feed-per rev mode and for threading.

So, however the encoder is scaled, we need to derive the other.

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

More
15 May 2021 15:23 - 15 May 2021 15:24 #208919 by andypugh

If you disable the axis (F2) and move it, or M101 and run the spindle with M03 Sxxx, then M05, then M100 again, it will oscillate till at position - for seconds. Thereafter, as above, ALL further moves are stable and clean.
(NOTE - I have tamed that oscillation with your suggestion of pid.c.maxoutput = 5, and increased max_vel and max_accel., but this is just masking the issue).


To an extent you are always masking issues with PID. You have to find a compromise that works in all conditions.
Something that might work would be to set the pid.c.maxoutput to a low value in the M100 script, wait a few seconds, and set it back.

I think that inserting
halcmd setp pid.c.maxoutput 1
sleep 2
halcmd setp pid.c.maxoutput 10
Might work.


WRT jogging.
After HOME-ING (all) , X and Z jog correctly ( jog wheel, AXIS mouse button, User pushbuttons)
C does not jog, C DRO does not change - C at this point is in M101.


Is C showing a "homed" marker in the DRO at this point?


THEN, if you go M100, none of the axes jog anymore - no jogwheels, no user jog buttons work.
However, ( in M100 say) if you use the mouse and jog X or Z momentarily on the AXES screen jog buttons, the axis jogs and THEN all the jog wheels and user pushbuttons work again - including jog C axis , if in M100.


I think that this is just Axis GUI behaviour. If you switch to the MDI window then the machine is put in MDI mode. You can only jog in Manual mode. Just switching to the Manual tab is probably enough to re-enable jogging.

The C-axis jogging looks similar enough to the Z axis that it isn't clear why it doesn't jog, assuming that you have the Z/C switch set to C mode?

The DRO in Axis can be set to display actual position and commanded position. Make sure that it is showing commanded position and check that the C axis DRO position command doesn't jog. If it doesn't then it is something in the Jogging HAL, not in the spindle-mode HAL.

One possible complication is axis / joint mode. It is probably a good idea to double-up all the jog HAL lines to jog joints and axes.

ie, for example change:
net mpg-z axis.z.jog-enable <= [HMOT](CARD0).7i73.0.1.input-23
to
net mpg-z axis.z.jog-enable  joint.1.jog-enable <= [HMOT](CARD0).7i73.0.1.input-23
And the same for all axis.L.jog-***** entries. You have
KINEMATICS = trivkins coordinates=XZC
in the INI so X = 0, Z = 1, C = 2 when referring to joint numbers.
Last edit: 15 May 2021 15:24 by andypugh.

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

Time to create page: 0.118 seconds
Powered by Kunena Forum