How to configure a rotational motor axis
-
I'm trying to configure a rotational axis, for the nozzle rotation motors of an OpenPnP build (this thread title might sound similar to another thread I just opened here, but it's very much a different end goal.
Whilst I can configure the axis to accept degrees, how do I get rid of the axis limit values?
For example, I might need to rotate a nozzle +180degrees, 1000 times in a row.
Presumably I could just set a very high axis travel limit, but that'd still only a band aid. Presumably there's an M code I'm missing to continue a rotational axis with no limit?
-
@jwilo said in How to configure a rotational motor axis:
Presumably I could just set a very high axis travel limit, but that'd still only a band aid.
That's the only option I'm aware of for now. But maybe you can rotate -180° while the tool is empty? During a travel-move back to the pickup place...
-
For my sand table, which has a true continuous rotation axis, all I do is a very high limit (3,600,000 degrees, so 10,000 revolutions).
The motor steps register is a 32 bit signed value, I believe, so your hard limit is 2.14 E9 steps - that's (probably) a lot more than 500 rotations, so if your 180 degrees 1000 times is an upper limit you're fine. (I will admit I'm assuming there's no rounding errors problems as might occur with the steps register being multiplied by a smaller number - but if operations on it are additions and subtractions, I think it should be OK, and I've never detected any abnormal behaviour from the table).
My sand table has 115,200 steps per rev (400 step motor, x16 microstepping, 1:18 gearing) and that still allows for in excess of 18,640 revolutions. I concluded that while it looked like a fudge, the pragmatic approach was to accept it - it will take weeks of running in the same direction to get to the limit.
You can also throw in some
G92 Y{mod(move.axes[1].userPosition,360.0)}
periodically, which will 'unwind' the axis. That is, if the machine thinks the axis is at (say) 724 degrees, it will reset it to 4 degrees without actually moving anything. Obviously, if you do this you need to adjust your gcode moves accordingly (unless you're using relative moves exclusively). I tend to just put it in the ending gcode, so the axis doesn't wind up from one job to the next (though if you home every job that won't be needed). -
@achrn OK thanks, good to know I'm at least not chasing something that doesn't exist.
Next up then, is how to even configure a rotary axis? At the moment, my rotary axis is successfully configured as a linear axis, and the microstepping configure along with the steps/mm, such that if I try to move '1mm', I get 1 full rotation.
M569 P1 D3 S1 ; physical drive A axis goes clockwise M584 A1 ; set drive mapping for rotational nozzle axes M92 A800
But, that's not what I'd like. I want to be able to command the axis by degrees, is this possible? Adding R1 to M584 should apparently make the axis rotational, but it doesn't change behaviour at all, as far as I can tell.
-
@jwilo Divide your M92 steps per mm by 360, then one millimetre of movement will equal 1 degree of rotation; ie
M92 A2.222
Rotational axes are effectively treated the same as linear axes, unless you make use the M584 S parameter to control the feedrate; see section 2.1.2.5 of the NIST GCode standard for how the feedrate is interpreted in this instance: https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=823374
2.1.2.5 Feed Rate
The rate at which the controlled point or the axes move is nominally a steady rate which may be
set by the user. In the Interpreter, the interpretation of the feed rate is as follows unless inverse
time feed rate mode is being used in the RS274/NGC view (see Section 3.5.19). The canonical
machining functions view of feed rate, as described in Section 4.3.5.1, has conditions under which
the set feed rate is applied differently, but none of these is used in the Interpreter.A. For motion involving one or more of the X, Y, and Z axes (with or without simultaneous
rotational axis motion), the feed rate means length units per minute along the
programmed XYZ path, as if the rotational axes were not moving.B. For motion of one rotational axis with X, Y, and Z axes not moving, the feed rate means
degrees per minute rotation of the rotational axis.C. For motion of two or three rotational axes with X, Y, and Z axes not moving, the rate is
applied as follows. Let dA, dB, and dC be the angles in degrees through which the A, B,
and C axes, respectively, must move. Let D = . Conceptually, D is a
measure of total angular motion, using the usual Euclidean metric. Let T be the amount
of time required to move through D degrees at the current feed rate in degrees per
minute. The rotational axes should be moved in coordinated linear motion so that the
elapsed time from the start to the end of the motion is T plus any time required for
acceleration or deceleration.Ian