In the Codesys CNC settings, I have these instances activated:
SMC_SmoothMerge
SMC_SmoothPath
SMC_LimitDynamics
SMC_CheckVelocities
And with those settings (and the path-preprocessing button actived), the G-Code viewer shows the square with nicely blended corners (see attached picture).
However, when running it on the PLC, it doesn't blend the corners at all.
Below the relevant part of my code. The process is started with bDecode.
// stage 1: decoding G-codefbNCDecoder(ncprog:=square,bExecute:=bDecode,bAbort:=NOTbDecode,nSizeOutQueue:=SIZEOF(aNCDecoderBuffer),pbyBufferOutQueue:=ADR(aNCDecoderBuffer));// stage 2: merge short linear segmentsfbSmoothMerge(bExecute:=bDecode,poqDataIn:=fbNCDecoder.poqDataOut,nSizeOutQueue:=SIZEOF(aSmoothMergeBuffer),pbyBufferOutQueue:=ADR(aSmoothMergeBuffer),piMaxDifference:=PI_MAX_DIFFERENCE,usiMaxDegree:=5,wFeatureFlag:=1,wAdditionalParamNumber:=0,dMinimumCurvatureRadius:=D_MIN_CURVATURE_RADIUS);// stage 3: smooth cornersfbSmoothPath(bExecute:=bDecode,bAbort:=NOTbDecode,poqDataIn:=fbSmoothMerge.poqDataOut,eMode:=SMC_SMOOTHPATHMODE.SP_SPLINE5_MIN_CURVATURE,eAddAxMode:=SMC_SMOOTHPATHADDAXMODE.SPAA_NONE,nSizeOutQueue:=SIZEOF(aSmoothPathBuffer),pbyBufferOutQueue:=ADR(aSmoothPathBuffer),dAngleTol:=D_ANGLE_TOL,bSymmetricalDistances:=TRUE,bImprovedSymmetricCuts:=TRUE);// stage 4: keep acc/dec and velocity within limitsfbLimitDynamics(bExecute:=bDecode,bAbort:=NOTbDecode,poqDataIn:=fbSmoothPath.poqDataOut,wAxis:=16#07,nSizeOutQueue:=SIZEOF(aLimitDynamicsBuffer),pbyBufferOutQueue:=ADR(aLimitDynamicsBuffer),bIncludePathSettings:=TRUE,dMaxVel:=2500,dMaxAccDec:=10000);// stage 5: check the path speedfbCheckVelocities(bExecute:=bDecode,bAbort:=NOTbDecode,poqDataIn:=fbLimitDynamics.poqDataOut,dAngleTol:=D_ANGLE_TOL);pathQueue:=fbCheckVelocities.poqDataOut;// repeat until MaxDuration ...
Any idea what I'm doing wrong? Is smooth path supposed to work at all when using a demo license?
I cannot see any problem in the code you posted. Just some ideas:
What is the value of D_ANGLE_TOL?
-
Do you need the assignment bAbort := NOT bDecoder? Does it help to leave it out?
Any errors (e.g. SMC_SmoothPath.Error/ErrorID) or PLC log messages?
What if you comment out SMC_SmoothMerge and SMC_LimtiDynamics, is corner smoothing still not working?
Is bDecode written from a different task (e.g. visu)? Then I would recommend to assign to a local variable (bDecodeLocal := bDecode) and use that for all FBs. Otherwise, FBs might see different values of bDecode in a single cycle, which will cause problems.
Regards,
Georg
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello all,
I am trying to run a
XYtrajectory from a static G-Code file.Everything works except the smoothing/blending of the corners.
My setup:
v3.5sp18The order of processing for my decoding is:
I created following instances and buffers:
My original G-Code file has a lot of short
G1elements but this example, I reduced it to a simple square:In the Codesys CNC settings, I have these instances activated:
And with those settings (and the path-preprocessing button actived), the G-Code viewer shows the square with nicely blended corners (see attached picture).
However, when running it on the PLC, it doesn't blend the corners at all.
Below the relevant part of my code. The process is started with
bDecode.Any idea what I'm doing wrong? Is smooth path supposed to work at all when using a demo license?
Thanks.
Hi bertus,
I cannot see any problem in the code you posted. Just some ideas:
-
Do you need the assignment bAbort := NOT bDecoder? Does it help to leave it out?
Any errors (e.g. SMC_SmoothPath.Error/ErrorID) or PLC log messages?
What if you comment out SMC_SmoothMerge and SMC_LimtiDynamics, is corner smoothing still not working?
Is bDecode written from a different task (e.g. visu)? Then I would recommend to assign to a local variable (bDecodeLocal := bDecode) and use that for all FBs. Otherwise, FBs might see different values of bDecode in a single cycle, which will cause problems.
Regards,
Georg