Small movement pipeline issue

Post Reply
sgraves
Posts: 30
Joined: Mon Jul 04, 2016 2:48 am
Location: Tampa, FL USA

Small movement pipeline issue

Post by sgraves »

Several times we have gone into a mode where the machine is creeping across the bed. I have looked at the log and it looks like a pipeline issue. Somehow a G0 command gets executed ahead of the small movement G1 command. Then the machine is moved far away from the original location and small movement (the code treats any movement less than 1 mm as a small movement) becomes a large movement. Unfortunately that large movement happens at small movement speed.

Anyone else see this happening? Any opinions? I think it is a bug and I am tracking it down.

Here is the pertinent part of the log.

Code: Select all

CNC_XY_m, x: 139.10367, y: 94.633
{"r":{},"f":[1,0,13,72]}
==> {"gc":"G1 F150 X140.05 Y94.633"}
{"r":{},"f":[1,0,33,134]}
{"sr":{"posx":140.555,"vel":2.41,"stat":5}}
{"qr":31,"qi":1,"qo":0}
{"sr":{"posx":140.241,"posy":94.822,"vel":150.00}}
{"sr":{"posx":140.050,"posy":94.633,"vel":0.00,"stat":3}}
ReadyEvent stat
{"qr":32,"qi":0,"qo":1}
CNC_XY_m ok
CNC_XY_m, x: 139.60367, y: 95.133
==> {"gc":"G1 F150 X140.555 Y95.133"}
{"r":{},"f":[1,0,34,135]}
{"sr":{"posx":140.050,"posy":94.633,"vel":2.41,"stat":5}}
{"qr":31,"qi":1,"qo":0}
{"sr":{"posx":140.364,"posy":94.944,"vel":150.00}}
{"sr":{"posx":140.555,"posy":95.133,"vel":0.00,"stat":3}}
ReadyEvent stat
{"qr":32,"qi":0,"qo":1}
CNC_XY_m ok
 -- zero Z movement command --
ReadyEvent: zero movement command
CNC_XY_m, x: 14, y: 78
==> {"gc":"G0 X14.376 Y77.6"}
{"r":{},"f":[1,0,26,106]}
{"sr":{"posx":140.555,"posy":95.133,"vel":0.26,"stat":5}}
Place
{"qr":31,"qi":1,"qo":0}
==> {"gc":"M03"}
CNC_XY_m, x: 139.10367, y: 94.633
{"sr":{"posx":137.987,"posy":94.776,"vel":2626.02}}
==> {"gc":"G1 F150 X140.05 Y94.633"}
{"r":{},"f":[1,0,13,72]}
{"sr":{"posx":132.261,"posy":93.981,"vel":5485.61}}
{"qr":30,"qi":1,"qo":0}
{"sr":{"posx":106.560,"posy":90.409,"vel":9934.01}}
{"sr":{"posx":73.792,"posy":85.856,"vel":10096.08}}
{"sr":{"posx":41.175,"posy":81.324,"vel":9518.47}}
{"r":{},"f":[1,0,33,134]}
{"sr":{"posx":35.901,"posy":80.591,"vel":8897.64}}
{"qr":29,"qi":1,"qo":0}
{"sr":{"posx":16.728,"posy":77.927,"vel":2626.02}}
{"qr":30,"qi":0,"qo":1}
{"sr":{"posx":14.376,"posy":77.600,"vel":0.02}}
{"qr":31,"qi":0,"qo":1}
{"sr":{"posx":14.779,"posy":77.655,"vel":150.00}}
{"sr":{"posx":15.262,"posy":77.720}}
sgraves
Posts: 30
Joined: Mon Jul 04, 2016 2:48 am
Location: Tampa, FL USA

Re: Small movement pipeline issue

Post by sgraves »

Ok, I am seeing the problem. The CurrentX and CurrentY values are set from the Tiny G status message (sr), as shown below (the setCurrX function sets CurrentX). So the G0 command is issued and before it actually moves another CNC move is made. That move sees that it is very close to the "current" location and issues the G1 small move. In the meantime the Tiny G executes the G0 command. Then when it executes the G1, it has a long way to go at a very sloooowww speed.

Not sure exactly what the solution is at this point, but now I know the problem. I know this, the decisions for the small movement commands probably should be based on where the machine will be when the command is executed. That said, the machine shouldn't be told to move all the way across the bed and back to get to a nearby location. There seems to be some logical problem there. So, I will research that one.

Code: Select all

        public class Sr
        {
            // mpox, posy, ...: Position
            // NOTE: Some firmware versions use mpox, mpoy,... some use posx, posy, ... 
            // This should be reflected in the public variable names
            private double _posx = 0;
            public double posx // <======================== here
            {
                get { return _posx; }
                set
                {
                    _posx = value;
                    CNC.setCurrX(_posx);
                    CNC.MainForm.ValueUpdater("posx", _posx.ToString("0.000", CultureInfo.InvariantCulture));
                }
            }

            private double _posy = 0;
            public double posy // <======================== and here
            {
                get { return _posy; }
                set
                {
                    _posy = value;
                    CNC.setCurrY(_posy);
                    CNC.MainForm.ValueUpdater("posy", _posy.ToString("0.000", CultureInfo.InvariantCulture));
                }
            }

            private double _posz = 0;
            public double posz // <======================== and here
            {
                get { return _posz; }
                set
                {
                    _posz = value;
                    CNC.setCurrZ(_posz);
                    CNC.MainForm.ValueUpdater("posz", _posz.ToString("0.000", CultureInfo.InvariantCulture));
                }
            }

            private double _posa = 0;
            public double posa // <======================== and here
            {
                get { return _posa; }
                set
                {
                    _posa = value;
                    CNC.setCurrA(_posa);
                    CNC.MainForm.ValueUpdater("posa", _posa.ToString("0.000", CultureInfo.InvariantCulture));
                }
            }

            /*
            public double ofsx { get; set; }
            public double ofsy { get; set; }
            public double ofsz { get; set; }
            public double ofsa { get; set; }
            public int unit { get; set; }
            public int stat { get; set; }
            public int coor { get; set; }
            public int momo { get; set; }
            public int dist { get; set; }
            public int home { get; set; }
            public int hold { get; set; }
            public int macs { get; set; }
            public int cycs { get; set; }
            public int mots { get; set; }
            public int plan { get; set; }
             * */
        }
Post Reply