I need to dynamically change the motor current limit, because the board may be powered from various power sources and I need as much torque as possible without overcurrent.
USER_MOTOR_MAX_CURRENT according Instaspin manual chapter 5.1.4 affects output of speed controller. I tried CTRL_setSpeed_outMax_pu, but it didn't help. Also PID_setMinMax(handle->pidHandle_spd,...,...), but this method is called in crtl_run and overrides limits from TRAJ module. So I tried to configure TRAJ
TRAJ_setTargetValue(handle->trajHandle_spdMax,motorInst.maxCurrent_pu);
TRAJ_setMaxValue(handle->trajHandle_spdMax,motorInst.maxCurrent_pu);
TRAJ_setIntValue(handle->trajHandle_spdMax,motorInst.maxCurrent_pu);
TRAJ_setMaxDelta(handle->trajHandle_spdMax,motorInst.maxCurrent_pu);
without success
It is not necessarily to cap current limit directly, probably some other variable can help to reduce peak current.
Can anybody help me with it please?