Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

CNC and axis control

  • ken0508

    ken0508 - 2020-09-24

    Hi everyone
    I need to use tweening(interpolation) for CNC .
    Then I made the CNC FB & used variables of G_CODE to control the motor.
    Call CNC FB to transfer variable function, but it is found that CNC only works when the motor position is 0 (origin).
    Otherwise, It will return to the origin alone and move again.
    And I don’t want to use the SET POSITION let motor position=0 every time.
    This method doesn't not good.
    When I need a tweening(interpolation) I call CNC FB .
    But before that I used the SOFTMOTION method to control the movement of the motor.
    Therefore, the position will not be at the origin,
    As a result, it can’t continue tweening smoothly,
    I checked and found that bStopIpo of SMC_ControlAxisByPos will be true.
    But I check the velocity of motor(or virtual) has been increased,
    I want to use SOFTMOTION & cnc tweening(interpolation) to control motor.
    But there will be problems at the moment.
    Do your predecessors have any solutions?

    Thank you

  • dwpessoa

    dwpessoa - 2020-11-05

    Hi ken0508.

    I'm working on a similar problem.

    In my case, I have an axis that only performs relative movements, so it will never be in the same position when starting the CNC, every time it started the system, the CNC would take it to zero before starting the path.

    I found a workaround adding to the position passed by SMC_Interpolator (or block of the Kinematics) to SMC_ControlAxisByPos an "Offset" that I register before starting the interpolator, based on the current position of the axis (AxisX.fActPosition). The timing of registering itself will depend on how your system works, for me it worked by taking the finalization of the interpolator (ipo.iStatus == SMC_INT_STATUS.IPO_FINISHED).

    At the moment I'm still studying an application in simulation mode that uses dedicated kinematics, so I haven't tested it with the physical axes yet, I hope this workaround will help you...



Log in to post a comment.