orient - Provide a PID command input for orientation mode based on current spindle position, target angle and orient mode
loadrt orient [count=N|names=name1[,name2...]] |
This component is designed to support a spindle orientation PID loop by providing a command value, and fit with the motion spindle-orient support pins to support the M19 code.
The spindle is assumed to have stopped in an arbitrary position. The spindle encoder position is linked to the position pin. The current value of the position pin is sampled on a positive edge on the enable pin, and command is computed and set as follows: floor(number of full spindle revolutions in the position sampled on positive edge) plus angle/360 (the fractional revolution) +1/-1/0 depending on mode.
The mode pin is interpreted as follows:
0: the spindle rotates in the direction with the lesser angle, which may be clockwise or counterclockwise.
1: the spindle rotates always rotates clockwise to the new angle.
2: the spindle rotates always rotates counterclockwise to the new angle.
On spindle.N.orient disconnect the spindle control and connect to the orient-pid loop:
loadrt orient
names=orient
loadrt pid names=orient-pid
net orient-angle spindle.N.orient-angle orient.angle
net orient-mode spindle.N.orient-mode orient.mode
net orient-enable spindle.N.orient orient.enable
orient-pid.enable
net spindle-in-pos orient.is-oriented spindle.N.is-oriented
net spindle-pos encoder.position orient.position
orient-pid.feedback
net orient-command orient.command orient-pid.command
orient.N (requires a floating-point thread)
Update command based on enable, position, mode and angle.
orient.N.enable bit in
enable angular output for orientation mode
orient.N.mode s32 in
0: rotate - shortest move; 1: always rotate clockwise; 2: always rotate counterclockwise
orient.N.position float in
spindle position input, unit 1 rev
orient.N.angle float in
orient target position in degrees, 0 <= angle < 360
orient.N.command float out
target spindle position, input to PID command
orient.N.poserr float out
in degrees - aid for PID tuning
orient.N.is-oriented bit out
This pin goes high when poserr < tolerance. Use to drive spindle.N.is-oriented
orient.N.tolerance float in (default: 0.5)
The tolerance in degrees for considering the align completed
Michael Haberler
GPL