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 motion.spindle-orient disconnect the spindle control and connect to the orient-pid loop:
loadrt pid names=orient-pid
net orient-angle motion.spindle-orient-angle orient.angle
net orient-mode motion.spindle-orient-mode orient.mode
net orient-enable motion.spindle-orient orient.enable orient-pid.enable
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