SetAxisVelocityPid
Configures the PID settings used by an axis in the velocity mode.
Syntax
KsError SetAxisVelocityPid(
int Index,
McPidSettings Settings
);
Parameters
Index: the index of an axis. Indexes are zero based. Aliases affect this parameter.
Settings: the McPidSettings structure that has all PID settings for the velocity mode. You need to fill in every field.
Return value
If the function succeeds, it returns errNoError
, otherwise an error code. For more information about the error code, see the KsError list.
Remarks
- This function can only be used when an axis is power off.
- If you want to use Master Interpolation Velocity (modeMasterIntVel) or PID Velocity (modePidVel) mode to control the velocity sent to the PID, you should use SetAxisControlMode to configure an axis's control mode before calling this function.
Example
VOID UpdatePid(INT Index) {
McPidSettings myPid = {
1, //KP
0, //KI
0, //KI_LIMIT_PERCENT
0, //KD
1, //KV
0.003, //KAA
0.003, //KAD
0, //KJ
0.2, //REDUCED_GAIN_DELAY
0.1, //REDUCED_GAIN_FACTOR
TRUE, //KI_STOPPED_ONLY
FALSE, //KD_USE_INTERNAL_ENCODER
0, //MINIMUM_OUTPUT
5000 //MAXIMUM_OUTPUT
};
int nRet = SetAxisVelocityPid(Index, myPid);
}
Requirements
RT | Win32 | |
---|---|---|
Minimum supported version | 4.0 | 4.0 |
Header | ksmotion.h | ksmotion.h |
Library | KsApi_Rtss.lib | KsApi.lib |
See also