I'm trying to switch between torque and position mode.
I'm using lab13e as base.
The torque mode works like this:
_iq24 Iq_ref_pu = _IQmpy(gMotorVarsTemp.ActualCur_A,_IQ(1.0/USER_IQ_FULL_SCALE_CURRENT_A));
// set the speed reference so that the forced angle rotates in the correct direction for startup
if(_IQabs(gMotorVars.MeasuredVel_krpm) < _IQ24(0.01))
{
if(Iq_ref_pu < _IQ24(0.0))
{
CTRL_setSpd_ref_krpm(ctrlHandle,_IQ24(-0.01));
}
else if(Iq_ref_pu > _IQ24(0.0))
{
CTRL_setSpd_ref_krpm(ctrlHandle,_IQ24(0.01));
}
}
// Set the Iq reference that used to come out of the PI speed control
CTRL_setIq_ref_pu(ctrlHandle, Iq_ref_pu);
When i use torque mode i don't run ST_runPosCtl
When i switch back to running ST_runPosCtl i get a big torque spike.
What i'd like to get is be able to switch between torque mode and run the motor like that for a while and then switch back to position mode without this torque spike.
What do i need to update to get this to work?
Is it something in ST_runPosCtl or do i also need to update something in ST_runPosMove?