G54/G55/G56 with 3-axis cnc problem

omeo
2021-11-23
2021-11-24
  • omeo - 2021-11-23

    Hi
    I have try to make a cnc using codesys, We need g54 to shifting Coordinate System. But Z-Axis got unusual movement. Here is a simple g-code to show problem:

    N010 G90
    N020 G54 X10 Y10 Z50
    N030 G0 X0 Y0 Z0
    N040 G1 X10 Y0
    

    (You can see trace image and project file in Attachments.)
    But after change N020 to G54 X50 Y50 Z50 then it works fine like magic.
    agiBufDecoder seems fine but ipo.piSetPosition not ok. If enable G51(smoothpath), agiBufSmooth also got z=0 state, It's unusual.
    So I think the problem cused by NCDecoder. Its only happend on XYZ system.
    Please help me if you have any idea. Thanks.

     
  • Fless

    Fless - 2021-11-23

    Hi,

    G51 doesn't work because you don't call SMC_SmoothPath 😏

    can your axis handle the speeds?
    a move from 0,0,0 to 10,10,50 means fast z speed.
    while move to 50,50,50 divides the speed to all axes.

    what is the period of the ripples? does it change with different speed settings?
    are you doing anything weird with 'rActualSpeed'?

     
    • omeo - 2021-11-23

      Hi
      Thanks for you reply.

      Its cause by Z axis control speed too much. I had try to make AxisZ.fSWMaxVelocity=500, trace result show it got 350mm/s.
      But i had set rncf.fDefaultVelFF=100, So any axis speed should not greater than 100mm/s theoretically.

      period of the ripples about 500ms. it should cause by speed too large.
      rActualSpeed not use in this template, This code is from another large project.

      You can try simulate on your computer, Should have same result. We have test it on rpi and x86 rte, got same problem.

      Thanks

       
  • omeo - 2021-11-23

    Hi
    I have check the process, PathTask to generate a poqpath give cnc, then ipo going position calc.
    By trace ipo.poqDataIn^.nReadPos, When problem happen its 0. So i check poqPath^.pbyBuffer^[0].piStartPos and poqPath^.pbyBuffer^[0].piDestPos, Its different. but its should be same i guess cuz no any movement command before g54.
    So i add line in preparepath:

    IF ncd.bDone THEN 
        poqPath^.pbyBuffer^[0].piStartPos:=poqPath^.pbyBuffer^[0].piDestPos;
    END_IF
    

    Then it works fine.

    BUT, When i try enable smoothpath( need modify program), it got same problem like this post start. I guess there is a public function called in NCDecoder and SmoothPath, so they have the same problem.
    SmoothPath poqDataOut maybe calc in movement( not start), so i cannot force startpos to destpos.
    I cannot see code in cnc, any suggesting is very useful. For any who want test it, here is project of smoothpath enabled in attachments. if running once, you can see agiBufferSmooth[1].piStartPos.dZ is 50 and agiBufferSmooth[1].piDestPos.dZ is 0, it make speed problem i think.

    Thanks.

     

    Related

    Talk.ru: 1

  • Fless

    Fless - 2021-11-23

    try setting 3d mode with G17 or G16 before you enable smooth path preprocessing (g51).
    this should fix your issues with 0 values for dZ

     
    πŸ‘
    2
    • omeo - 2021-11-24

      Thanks you a lot! Insert G17 on gcode then it works fine.
      pbyBuffer^[0].piStartpos is cause by ncd.piStartPosition, After give it the axis actual position it also works perfect.

      Thanks!

       

Log in to post a comment.