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.

starting a new move while moving

Genius 5910 points

I like to do the following:

 I start a move: In the running move I decide I want to continue the move  X further.  So How do I update the move comment while the motor is still running.

 My current Move comment  require that the motor is at full stop before I can set a new comment.  

for example: I have a conveyor-belt with containers. The conveyor-belt move one container and checks if the container is correct. If so, the conveyor-belt is moved exactly one container. If I start-stop the conveyor-belt I have a really lot of jerk and it is really slow. So In the move, I check if the container is correct. and continue to  move to the next container.  How do I do that?

  • Is this a position move?  If so, once you being a move in order to start a new move you must stop the motion before starting again.

    Velocity moves can have a new setpoint provided to them before the reach the existing setpoint.  When that happens the acceleration will be reduced to 0, and it will start accelerating to the new goal speed.

    You could look at lab 13e which is velocity moves in position control.  This might be a way to realize your application goals.

  • Hi Adam,

    If I understand correctly. There is no position information in a velocity move. So any suggestion how to stop at a specific position? Do I have to make my own motion profile generator to do that?
  • You are correct in that in a velocity mode you won't be able to stop at a specific position. If you need this more advanced functionality you will need to make your own profile generator.
  • Adam,

    I'm trying to find out what Is the best way to attach my profile generator with the Spintac velocity controller. That is a lot  more difficult then I thought and I hope you have some suggestions.

    My motion profile generator updates every 1 ms the target velocity.

     My initial plan was to update STPOSMOVE_setVelocityEnd every time. But STPOSMOVE_run is also updated every ms.So  I expect that doesn't work. And I don't think I have enough control over the STPOSMOVE to use it as part of my Motion profile because I'm don't have any control of the motion per time.

     The other alternative I found is to insert the speed direct in EST_RUN. But then I completely bypass the Intraspin-motion part. And made my custom motion controller a real lot more complex.

    So do you have any suggestions?

    Thanks!

     

     

  • You should be able to set the velocity reference generated by your profile generator as the velocity reference to SpinTAC Velocity Control.  Since you already have your own profile generator I would bypass the one provided by InstaSPIN-MOTION.  The only thing to keep in mind is that you will need to make sure that the velocity reference is in the correct pu units.  

    Take a look at lab 05d, that uses the SpinTAC Velocity Control and uses the ramp generator instead of the SpinTAC profile generator.

  • Adam,

    Hope you van give me another hint. I try to combine LAB5F(for the active disturbance control)  and LAB13B that is the base of my program.

    I did the following:

     I changes all the structs/variables names  of spintac_velocity.h so  I can combine it with spintac_position.h

    I added the init to my program:

      // initialize the SpinTAC Components
      stHandle = ST_init(&st_obj, sizeof(st_obj));
        // setup the SpinTAC Components
      ST_setupVelCtl(stHandle);

    I made a swtich between the controles in MainISR

      // Run the SpinTAC Components
      if(stCnt++ >= ISR_TICKS_PER_SPINTAC_TICK) {
          ST_runVelCtl(stHandle, ctrlHandle);
          stCnt = 1;
      }

     and

      if(stCnt++ >= ISR_TICKS_PER_SPINTAC_TICK) {
          ST_runPosConv(stHandle, encHandle, ctrlHandle);
          ST_runPosMove(stHandle);
          ST_runPosCtl(stHandle, ctrlHandle);
          stCnt = 1;
      }

    I made a function to start the velocity mode:

    void Contrl_VELSetSpeed(INTR_Handle intr,_iq SpeedRef_krpm,_iq MaxAccel_krpmps)
    {     CTRL_Obj *obj = (CTRL_Obj *)intr->ctrlHandle;
          STVEL_Obj *stObj = (STVEL_Obj *)intr->stvelHandle;
          unsigned long MAX_ACCEL_KRPMPS_SF =  _IQ(intr->UserParams.motor_numPolePairs * 1000.0 / USER_TRAJ_FREQ_Hz / USER_IQ_FULL_SCALE_FREQ_Hz / 60.0);

           // set the speed reference
        CTRL_setSpd_ref_krpm(obj,SpeedRef_krpm);
        // set the speed acceleration
        CTRL_setMaxAccel_pu(obj,_IQmpy(MAX_ACCEL_KRPMPS_SF,MaxAccel_krpmps));

        STVELCTL_setOutputMaximums(stObj->velCtlHandle,_IQmpy(intr->SpinTAC.PosCtlOutputMax_A,_IQ(1.0/USER_IQ_FULL_SCALE_CURRENT_A)),
                _IQmpy(intr->SpinTAC.PosCtlOutputMin_A,_IQ(1.0/USER_IQ_FULL_SCALE_CURRENT_A)));
        CTRL_setMaxAccel_pu(obj,_IQmpy(MAX_ACCEL_KRPMPS_SF,6));
        CTRL_setFlag_enableSpeedCtrl(obj, false);
        STVELCTL_setBandwidthScale(stObj->velCtlHandle,intr->SpinTAC.PosCtlBwScale);
        intr->Flag_enableVEL=true;
        STVELCTL_setEnable(stObj->velCtlHandle, true);
    }

    When I do run the program nothing happens. Only when I rotate the rotor(By hand)  the motor spins uncontrolled at the max speed ( I think). So or the torque feedback is incorrect of the rotor position information. (I think)

     In function: CTRL_run is the correct rotor angle  calculated. I also use it for motion profile

    In function ST_runVelCtl (in Lab5F) : the speed is read out with:

     speedFeedback = EST_getFm_pu(ctrlObj->estHandle);

     Only there is no information how and where EST_getFm_pu gets this information.

    So I really hope you have any hint what I can do to solve this.

     Thanks!

  • I think the issue is the feedback speed. Take a look at lab 12b where the speed controller is used with an encoder.
  • Thanks Adam, for the great help.

    If I set the speed in STVELCTL_setVelocityReference the motor starts spinning.

    That was a big puzzle to solve.