Hi Funding33,
Yes,what is the right way to feed ("software connect") output of one PID loop to the position input of another loop?
WaitNextTimeSlice();
chZ.Dest += chV.Output; // Z position loop,
In a User Thread forever loop is the normal way to perform a dual loop. It causes the Output of one Axis to drive the Velocity of another Axis.
A somewhat better technique (but a little more complex) is to use a User Callback so the Destination is advanced every Servo Sample (90us) instead of every other Servo Sample (180us) or so depending on number of Active Threads. The User Thread approach is simpler and usually works fine, but if you want to use the Callback approach see the UserCallBack.c and StopCallBack.c examples.
Pre-filtering the Voltage feedback shouldn't be necessary. You should be able to achieve the exact same result by filtering the Output in the normal manner. Possibly a 2nd Order Low Pass of Freq=300Hz Q=1.4.I'm trying to improve response of plasma Volt/Zaxis control. Suspicion is that due to nature of voltage noise derivative term gets too much distorted.
My idea is to try filter it using spare loop filters an only then feed in to loop which controls Z height error output aka chZ.Dest += ZErrorOutput.
I see there is "User Input" axis mode, but how do we use it for something else beside resolver?
Is there way to interconnect then inside system thread or should it be coded in user C program
forver loop like
for (;
{
...
chV.Position = VoltFilterOut; // Volt Height loop, outputs Z speed
chZ.Dest += chV.Output; // Z position loop,
...
}
But I suppose the method you show would also work with slightly more delay.