3.4.3 mcRpcI_RotorPositionCalc
C
/* Perform rotor position calculation */
void mcRpcI_RotorPositionCalc( tmcRpc_ModuleData_s * const pModule )
Summary
Performs rotor position calculation.
Description
This function calculates the rotor's electrical position and velocity using encoder feedback. The function updates the rotor position and speed outputs based on the encoder pulse count and applies compensation for encoder wraparound. If the rotor position calculation is disabled, the function resets the rotor position estimation and sets the outputs to zero.
Precondition
Rotor position calculation module must be initialized and enabled.
Parameters
Param | Description |
---|---|
pParameters | A pointer to the rotor position calculation module parameter structure |
Returns
None
Example
// Define the rotor position calculation module data structure
tmcRpc_Parameters_s rpcParameters;
/** Calculate rotor position */
mcRpcI_RotorPositionCalc(&rpcParameters);
Remarks
Note: Ensure that the
pParameters
structure
is properly updated with valid values before calling this function