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.

LAUNCHXL-F28069M: How to switch sign of torque with high frequency? (Motorware)

Part Number: LAUNCHXL-F28069M
Other Parts Discussed in Thread: MOTORWARE

Hello,

I'm working on Inertia wheel inverted pendulum project. I'm trying to stabilize that pendulum by changes of torque on motor with inertia wheel on shaft.

I use lab 12b becouse i need feedback from encoder in my project.  Angular position of whole construction is given by gyro sensor.

The goal of the project is to keep the contruction balancing on its edge. There is LQR controller, which calculate torque of wheel.

The problem is: LQR controller changes torque sign very quickly, and system needs that rapid changes to remain stability, but motorware software does not change direction of torque so quickly.

To control torque I disable velocity controller:

STVELCTL_setEnable(stObj->velCtlHandle, false);

and directly set torque, by q-axis current:

CTRL_setIq_ref_pu(ctrlHandle, Iq_ref_threshold);

But when I enable motor, it looks like there is a large delay beetween moment  when Iq_ref_threshold changes sign and moment when motor changes direction of torque. (about 1 second)

Is it possible to make it changing direction of torque about 50 times per second?

Regards,
Wojciech

  • You might try the motion control, not only speed close loop or torque close control. And what PWM and control frequency are you using? Yes, you can change the direction of torque very frequently, but you must need a high control bandwidth to response the changing as well.
  • Hi

    To  use the motion control what lab should I use? Currently Im using 12b.  

    PWM:

    #define USER_PWM_FREQ_kHz                (15.0) 

    CTRL:

    #define USER_CTRL_FREQ_Hz  (uint_least32_t)(USER_ISR_FREQ_Hz/USER_NUM_ISR_TICKS_PER_CTRL_TICK)
    #define USER_ISR_FREQ_Hz ((float_t)USER_PWM_FREQ_kHz * 1000.0 / (float_t)USER_NUM_PWM_TICKS_PER_ISR_TICK)
    #define USER_NUM_PWM_TICKS_PER_ISR_TICK        (1)
    #define USER_NUM_ISR_TICKS_PER_CTRL_TICK       (1)     

    So my PWM frequency = CTRL frecuency = 15kHz

  • There are my user.h and user_j5.h files:

    6683.user.h

    1781.user_j5.h

  • It seems like there is no problem in both header files, you might try Lab13b and Lab13c for position control in your case.

  • Ok, I will try this labs.

    But will it bring changes when I turn off position controller? (Becouse I need torque control)

                // disable the SpinTAC Position Controller
                STPOSCTL_setEnable(stObj->posCtlHandle, false);//orginally was true

    and set torque by:

     CTRL_setIq_ref_pu(ctrlHandle, My_torque_reference)

  • I carried out several tests in lab13b, directly controlling the torque. Unfortunately, the delay in the change of torque direction still occurs.

    Maybe there is a PI current controller which makes that delay?

  • You might try to use the braking for the motor, increase the gain of the current PI controller, or improve the control frequency/bandwidth based on your requirement.
  • I found some errors in my code, for example gyroscope filter had too much delay. Now it works :)
    Thank You for help.
    Regards, Wojciech

    Update:

    If there is someone with problems about torque mode, I share my solution to one of my bugs/problems:

    To use torque mode in lab12b and other speed/motion labs you have to disable speed controller:

    STVELCTL_setEnable(stObj->velCtlHandle, false);

    and directly set torque, by q-axis current:

    CTRL_setIq_ref_pu(ctrlHandle, Iq_ref_My_torque);

    And important thing:

    disable existing torque setting in ST_runVelCtl function:

    void ST_runVelCtl(ST_Handle handle, CTRL_Handle ctrlHandle)
    {
    .
    .
    .
    //CTRL_setIq_ref_pu(ctrlHandle, iqReference);
    CTRL_setIq_ref_pu(ctrlHandle, Iq_ref_My_torque); //and set your torque here
    }

    In my program, I made the mistake of putting it in the main loop instead of in the ST_runVelCtl function. And I did not comment out that iqReference.. So it's no wonder that there was delay in changing torque sign, becouse motor was receiving two references, once from my torque controlling code, and another from speed controller. 

    Regards, Wojciech