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.

Lab 13b : haptic effect with instaspin

Hi, 

I want to generate an accuracy torque with zero speed (generate an haptic).
-which is the best lab for this?
After identification inertia (Lab 12a), doing labs 12b and 13a successfully, then I passed to lab 13b.
knowing that the current is the Image of Torque (T=ka Iq):
-I'd like to realize force feedback, How can I modify the code source? in this case : the position reference is giving by hand acting on the shaft,  and the velocity is
zero.
Best regard
  • Sanet,

    You might want to consider using Lab 13a, this lab uses a fixed position/velocity/acceleration references of 0.  So in your code you would want your pot/wheel/interface to send in a position reference directly to the position controller.  Then the position controller would send out the torque reference to try and pull the motor back to the reference.

    SpinTAC uses a windowed position reference signal in order to avoid overflow at very large positions.  I've attached a document that shows what the position reference signal looks like.  The keys are that it is a sawtooth signal that varies between -10 and 10 mechanical revolutions while counting the number of rollovers.

    6371.SpinTAC_Position_Move_Rollover.pdf

  • Hi Adam,

    I launched lab 13a,

    "to send in a position reference directly to the position controller" in the code
    how can I do this?

    I noted more one oscillations, how can I eliminate this? I 'd like just a force feedback once.

    Best regard
  • In another words, I d'like to generate it in one direction
  • Sanet,

    Take a look at the code in the ST_runPosCtl function in proj_lab13a.c.

    Specifically the following line (651):

    // provide the updated references to the SpinTAC Position Control
    STPOSCTL_setPositionReference_mrev(stObj->posCtlHandle, 0);

    This is where you pass the reference into SpinTAC.  Instead of 0, you should update this with your position reference signal, however you decide to generate it.  The document that I provided before describes how the position signal should be generated so that it will work with SpinTAC.

    The oscillation comes from position rollover.  So as the motor moves beyond 10 mechanical revolutions in the positive or negative direction away from the start position the signal needs to rollover so that is prevents overflow of the fixed point variables.  So if your system doesn't need to rotate more than 10 revolutions away from the start position you don't need to worry about it.

  • Hi Adam, 

    My system doesn't need to rotate more than 10 revolutions (it needs one rev max).

    I tried to change the    "#define ST_MREV_ROLLOVER (1.0)" at which the Mechanical Revolution will rollover,

    also    "STPOSCTL_setPositionReference_mrev(stObj->posCtlHandle, 0.5 );"

    but "gMotorVars.SpinTAC.PosCtlErrorID = 15" and the motor begin to spin when moving the shaft.How can avoid this error ?

    Best regard

  • Sanet,

    InstaSPIN-MOTION is written in fixed point.  So when you set:

    STPOSCTL_setPositionReference_mrev(stObj->posCtlHandle, 0.5 );

    This won't work because you are passing a floating point value into that function.

    Instead you need to do:

    STPOSCTL_setPositionReference_mrev(stObj->posCtlHandle, _IQ(0.5) );

    This will convert your floating point number into fixed point.