3.3.26.4 mcPosI_PositionControlAuto

C


/* Perform automatic position control */
void mcPosI_PositionControlAuto(  const tmcPos_Parameters_s * const pParameters,
                                              const float32_t ref, const float32_t act, float32_t * const pOut )

	

Summary

Perform the position control operation.

Description

This function controls rotor position using a PI controller. It calculates the error between the reference and actual position, controls the position error using the PI controller based on the state of the position control module, and updates the reference speed value.

Precondition

The position control module must be initialized and enabled.

Parameters

ParamDescription
pParametersA pointer to the position control module parameter structure
refReference position value.
actActual position value.
pOutA pointer to a variable where the output of the PI controller will be stored.

Returns

None

Example

// Define the position control module data structure
tmcPos_Parameters_s posParameters;

float32_t ref = 1000.0f;
float32_t act = 950.0f;
float32_t nref

/** Execute position control loop */
void mcPosI_PositionControlAuto(&posParameters, ref, act, &nref);
    

Remarks

None.