This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28069: InstaSpin Motion Position Controller delay, lab13a

Part Number: TMS320F28069
Other Parts Discussed in Thread: MOTORWARE

Hello.

I use motorware to build camera stabilization system and choose lab13a to control motor position. Everything works as expected but I have delay in motor position changes when setting position reference to Position Controller with:

STPOSCTL_setPositionReference_mrev(stObj->posCtlHandle, target_position);

Is it possible to make Position Controller act fast on reference position changes?

 

  • The reference takes effect when you call STPOSCTL_run(). Is there some code between when you set the reference and when you call the position controller run function?

    Sean
  • Thank for replay Sean, I use lab13a with small modification, where instead of setting 0 as reference  in to position controller I pass variable target_position, and there is delay between changes of value "target_position" and motor position changes. Here is my position controller run function:

    void ST_runPosCtl(ST_Handle handle, CTRL_Handle ctrlHandle)
    {
        ST_Obj *stObj = (ST_Obj *)handle;
    
        // provide the updated references to the SpinTAC Position Control
        STPOSCTL_setPositionReference_mrev(stObj->posCtlHandle, target_position);
        STPOSCTL_setVelocityReference(stObj->posCtlHandle, 0);
        STPOSCTL_setAccelerationReference(stObj->posCtlHandle, 0);
        // provide the feedback to the SpinTAC Position Control
        STPOSCTL_setPositionFeedback_mrev(stObj->posCtlHandle, STPOSCONV_getPosition_mrev(stObj->posConvHandle));
    
        // Run SpinTAC Position Control
        STPOSCTL_run(stObj->posCtlHandle);
    
        // Provide SpinTAC Position Control Torque Output to the FOC
        CTRL_setIq_ref_pu(ctrlHandle, STPOSCTL_getTorqueReference(stObj->posCtlHandle));
    
    }
    

  • Hi Harry, sorry for the delay in response. STPOSCTL depends on the reference and feedback, so those two API need to be run before STPOSCTL_run(). Can you try positioning these such that their calls are immediately before the SpicTAC position control function? Also, what's the SpinTAC bandwidth? You can try increasing this to decrease time from update to reaction, but it could also come at the cost of stability

    Sean
  • Hi Sean, here is my SpinTAC loop in mainISR:

    // Run the SpinTAC Components
      if(stCnt++ >= ISR_TICKS_PER_SPINTAC_TICK)
      {
          {
              ST_Obj *stObj = (ST_Obj *)stHandle;
    
              // get the electrical angle from the ENC module
              ////STPOSCONV_setElecAngle_erev(stObj->posConvHandle, ENC_getElecAngle(encHandle));
              STPOSCONV_setElecAngle_erev(stObj->posConvHandle, elecAngle);
    
              if(USER_MOTOR_TYPE ==  MOTOR_Type_Induction) {
                // The CurrentVector feedback is only needed for ACIM
                // get the vector of the direct/quadrature current input vector values from CTRL
                STPOSCONV_setCurrentVector(stObj->posConvHandle, CTRL_getIdq_in_addr(ctrlHandle));
              }
    
              // run the SpinTAC Position Converter
              STPOSCONV_run(stObj->posConvHandle);
    
              if(USER_MOTOR_TYPE ==  MOTOR_Type_Induction) {
                // The Slip Velocity is only needed for ACIM
                // update the slip velocity in electrical angle per second, Q24
                SLIP_setSlipVelocity(slipHandle, STPOSCONV_getSlipVelocity(stObj->posConvHandle));
              }
          }
          ST_runPosCtl(stHandle, ctrlHandle);
          stCnt = 1;
      }

    as you can see STPOSCONV_run() and ST_runPosCtl() execute at same rate but I still have delay on system response to position I set in  ST_runPosCtl()

    here is chart where system run with bandwidth 20 rad/s 

    It is plotted at 100 Hz and delay between commanded position(blue line) and encoder position changes(orange line) is about 0.08 seconds.

    when I increase bandwidth to 30 rad/s the motors become noisy but it still holds position and delay is 0.05 seconds:

    I can't increase bandwidth more than 30 rad/s because it starts osculating.

  • What sensor are you using? Does the sensor have sufficient bandwidth to continue driving the position control bandwidth higher? You may be limited by the hardware here

    Sean
  • Hi Harry, any update here? I will mark this closed but feel free to reject the answer and re-open the thread for more comment

    Sean