Zigzag line entrance small tools

Tricky says the expert, just left of impossible for the rest of us. Nice work @BrianTee_Admin , as usual you have stepped it up with the nice arrows for right and left.

2 Likes

Don’t tell nobody, Brian wears this hat

715i5t1d7IL.AC_UY445

5 Likes

Playing around with your code:

When coming from the curve to the ABLine it does not update the ABLine to the current position. You will need to at least add something like the following in the controls.Designer about line 138

if (isLineLockOn)
                {
                    isLineLockOn = false;
                    secondsSinceStart++;
                    ABLine.GetCurrentABLine(pivotAxlePos, steerAxlePos);
                    isLineLockOn = true;
                }

and in the FormABDraw about line 902

 if (mf.isLineLockOn)
                    {
                       mf. isLineLockOn = false;
                        mf.secondsSinceStart++;
                        mf.ABLine.GetCurrentABLine(mf.pivotAxlePos, mf.steerAxlePos);
                        mf.isLineLockOn = true;
                    }

these reset the current abline if it is locked.

I do like the lateral shift!!!

The below will lock the curve as well.

KentStuff / AgOpenGPS-1

Ya curve is next - its only half baked lol. I need to make them look very much the same. Funny thing is, v5 was just supposed to be a stop gap till v6 comes out lol.

There is invalidate the guidance line which triggers a new seek as well. The hard part is always to make it work in every circumstance and not get lost or crash despite the 3000 combinations of key pushes to do something and end up somewhere in the program

The way it has been going V6 will be a stop gap before V7.

2 Likes

@BrianTee_Admin, The default right or left turn also has some great potential. Below is the code that I used to force the dubins draw point to the right or left. Basically, it looks along a line a set distance either side of the current abline. It looks for an intersection of this “offset” line and the next ABLine in the mix. Not the next lateral shift, but the next reference line. Once cycle is clicked, it builds a dubins from the current position to the intersection. It locks and drives this line. Below is the stolen code of yours that I modified to do this. It is a hack for sure, you can clean it up much better, but is really a nice feature to be able to click the default turn direction regardless of the angle. However, you have to limit the angles or it just becomes a nasty U-turn.
By the way, taking sneak peaks at the new sticky. I really like what you did with the U-turn. Snap the ABLine early rather than latter. NICE!!

Edit:
My son, who does much of the spraying for my dad, his grandfather, asked about the sticky line, so I can leave the field and come back and it keep the same line? He asked with an excitement. With the raven system and with the current flags, we can mark and return, but keep the ABLine stationary while, filling the tank, or other needs, that might be something to consider.

public void GetNextABLine(vec3 pivot, vec3 steer, int numb)
        {
            double dx, dy;
            isValidTurn = false;


            //if ((mf.secondsSinceStart - lastSecond) > .01)
            //{
            //    lastSecond = mf.secondsSinceStart;

            //move the ABLine over based on the overlap amount set in vehicle
            double widthMinusOverlap = mf.tool.toolWidth - mf.tool.toolOverlap;
            double diffDelta = (Math.Abs(lineArr[numb].heading - abHeading));
            if (diffDelta >= Math.PI) abFixHeadingDelta = Math.Abs(abFixHeadingDelta - glm.twoPI);
            isValidTurn = Math.Abs(diffDelta) >= .42;

            

            //x2-x1
            dx = lineArr[numb].ref2.easting - lineArr[numb].ref1.easting;
            //z2-z1
            dy = lineArr[numb].ref2.northing - lineArr[numb].ref1.northing;

            //how far are we away from the reference line at 90 degrees
            //distanceFromRefLine = ((dy * pivot.easting) - (dx * pivot.northing) + (refABLineP2.easting
            //* refABLineP1.northing) - (refABLineP2.northing * refABLineP1.easting))
            /// Math.Sqrt((dy * dy) + (dx * dx));
            double lookdist = (Math.Max(mf.vehicle.minTurningRadius * 1.5, mf.pn.speed * 0.277777 * 2));
            vec3 ABLOOK = new vec3(pivot.easting + (Math.Sin(mf.fixHeading) * (lookdist)), pivot.northing + (Math.Cos(mf.fixHeading) * (lookdist)), 0);

            double distanceFromRefLine2 = ((dy * ABLOOK.easting) - (dx * ABLOOK.northing) + (lineArr[numb].ref2.easting
                                     * lineArr[numb].ref1.northing) - (lineArr[numb].ref2.northing * lineArr[numb].ref1.easting))
                                         / Math.Sqrt((dy * dy) + (dx * dx));


            
                double dishowManyPathsAway = Math.Round(distanceFromRefLine2 / widthMinusOverlap, 0, MidpointRounding.AwayFromZero);
            


            //depending which way you are going, the offset can be either side
            vec2 point1 = new vec2((Math.Cos(-lineArr[numb].heading) * (widthMinusOverlap * dishowManyPathsAway + (isABSameAsVehicleHeading ? -mf.tool.toolOffset : mf.tool.toolOffset))) + lineArr[numb].ref1.easting,
                (Math.Sin(-lineArr[numb].heading) * ((widthMinusOverlap * dishowManyPathsAway) + (isABSameAsVehicleHeading ? -mf.tool.toolOffset : mf.tool.toolOffset))) + lineArr[numb].ref1.northing);

            //create the new line extent points for current ABLine based on original heading of AB line
            nextABLineP1.easting = point1.easting - (Math.Sin(lineArr[numb].heading) * abLength);
            nextABLineP1.northing = point1.northing - (Math.Cos(lineArr[numb].heading) * abLength);

            nextABLineP2.easting = point1.easting + (Math.Sin(lineArr[numb].heading) * abLength);
            nextABLineP2.northing = point1.northing + (Math.Cos(lineArr[numb].heading) * abLength);

            nextABLineP1.heading = lineArr[numb].heading;
            nextABLineP2.heading = lineArr[numb].heading;

            isNextCurrentSameHeading = Math.PI - Math.Abs(Math.Abs(pivot.heading - abHeading) - Math.PI) < glm.PIBy2;
            vec3 A = currentABLineP1;
            vec3 B = currentABLineP2;
            if (!isNextCurrentSameHeading)
            {
                A = currentABLineP2;
                B = currentABLineP1;
            }
            
            vec3 P = nextABLineP1;
            B -= A;
            P -= A;
            int cross = Convert.ToInt32((B.easting * P.northing) -( B.northing * P.easting));
           
            double cosHeading = Math.Cos(-abHeading);
            double sinHeading = Math.Sin(-abHeading);
                       
            if (isNextCurrentSameHeading)
            {
                cosHeading = cosHeading * -1;
                sinHeading = sinHeading * -1;
            }

            double stag = lookdist;

            if (isRight) stag = -1 * stag;


            double A1 = (currentABLineP2.northing + (sinHeading* (stag))) - (currentABLineP1.northing + (sinHeading * (stag)));
            double B1 = (currentABLineP1.easting+(cosHeading*stag)) - (currentABLineP2.easting + (cosHeading*stag));
            double C1 = (A1 * (currentABLineP1.easting + (cosHeading*stag))) + (B1 * (currentABLineP1.northing + (sinHeading * (stag))));
            double A2 = nextABLineP2.northing - nextABLineP1.northing;
            double B2 = nextABLineP1.easting - nextABLineP2.easting;
            double C2 = (A2 * nextABLineP1.easting) + (B2 * nextABLineP1.northing);


            double delta = A1 * B2 - A2 * B1;

            if (delta == 0)
            {
                isValidTurn = false;
                return;
            }

            double x = (B2 * C1 - B1 * C2) / delta;
            double y = (A1 * C2 - A2 * C1) / delta;
            //isNextCurrentSameHeading = (nextABLineP1.heading - abHeading) < 0;
            if (isRight)
            {
                if (cross > 0) nextPointAB = new vec3(x, y, nextABLineP1.heading);
                else
                {
                    double temphead = nextABLineP1.heading + Math.PI;
                    if (temphead > glm.twoPI) temphead = temphead - glm.twoPI;
                    nextPointAB = new vec3(x, y, temphead);

                }
            }
            else
            {
                if (cross < 0) nextPointAB = new vec3(x, y, nextABLineP1.heading);
                else
                {
                    double temphead = nextABLineP1.heading + Math.PI;
                    if (temphead > glm.twoPI) temphead = temphead - glm.twoPI;
                    nextPointAB = new vec3(x, y, temphead);

                }

            }
           

        }
2 Likes

What was 4.6 :rofl: :rofl: :rofl: :rofl:

on the past with the flag menu there is switch to go direcly on the line ( Brian remove it because no time for this) but it can also an idea to link to your request …

This is what we currently use. But holding the ABLine there, that was what he suggested. With sticky, it may do this without additional programming. In the simulator it is not possible to drive somewhere else with autosteer on, but it is in the field.

Still on the TODO list!!

But you can set a flag, or turn on record Path and it will drive you back. Just having the ABLine on doesn’t take you to the right spot

1 Like

Brian, all the team ,

need to repeat again wonderfull all progress that you can do to improve and listen each other

thanks a lot ! Farmer helping farmer !

1 Like

Brian

i do test this afternoon with 5.1.7 Sticky version not so far 5.2 i guess …

the job is to rake hay around 8km/h

the input on the line are now very smooth with sticky version !

I have two kind of field
-A big and quite square that opportunity to activate all to have 90 automatic job with Uturn, head land / hydraulic lift engaged evry thing works pretty good !

  • Few small field : that i use adaptative line,
    it is not easy to set or i do a mistake
    is there any information to activate correctly with normal step?

also it will be dificult to generate new line to appears and select
if you have any advise that you can tell us

Please explain what you mean by adaptative line?

sorry
on help page we call it “contour”

image

1 Like

In the attached image, the only available contours to follow are purple. This may seem strange, but AOG does not build contour list if running an ABLine or a Curve. It is only built when recording path or in free drive. This is important when trying to select a line or get close to a line to select it. You know there is a line there to follow, but why will it not pick up. Question to as is how was that strip created.

image

ok for AB line or curve
but in this contour mode

or the procedure
-first activate contour mode
-second activate section
-drive a nd try to approch the activate area and normally it work
but it is very slow and not easy to understand when and how…,

Exactly! Sometimes it works great, Sometimes you can drive along a line for several seconds before it will pick it up. If you cycle the section off and on, it will reset, then Sometimes it will pick up.

1 Like

a link for a video of screen in reality that i take this sunday when raking with contour mode

In CContour about line 296 we have the following:

 //if making a new strip ignore it or it will win always
            if (mf.sectionCounter > 0) stripCount--;
            if (stripCount < 1) return;

It keeps building contours but will not pick the latest one. If the complete section has not cycled off, then it is the latest contour and will skip it. When you cycled the tool off, it started a new contour and then was able to pick the last one. I’m not sure how to fix it, but I do know why it did what it did in the video.

1 Like