Tree Planning

@KentStuff, Any chance of sharing the source code? I find that I learn best on projects that interest me. I’m really interested in seeing how you did this.

Absolutely. I’ll try to get it up on github. Did I mention I don’t understand github.

Code is not clean by any means, but this is how I did it:

I started in ABdraw and added a new tree panel same color as the rest. I added the various buttons and number pickers. Copy paste edit is my friend.

I used what we were working on in the open grade as a separate class called CTree.cs. In this class is where most of the graphics and calculations take place. There is a list built called ptlist. This holds all the tree information including a bool for isclose.

ABdraw picker was edited to add a check for is the tree panel displayed. If displayed then take over with the tree picker A. The tree picker A simply takes a point and saves it back to the Ctree. Now if autoplant, reset A to the center of the field. Once you click the build, it reads all the data in the tree panel and builds the array of points. This takes place in CTree. Rotate is applied to each point during the build. The array of points is much larger than the field, but it checks if inside the geofence. Only if it’s in the fence, then build the point.

The drawing is done in CTree also. It is just called in ABDraw and the main GUI. Find the location and draw the cross based on heading. Check each point and find the closest. Tag that to isClose and change the color. Keep up with the distance.

The screen graphics for the arrows on the right are a modification of Brian’s older left and right arrow. It is done with the rest of the graphics.

Open and save is just a hack of the flags. The kml writer does the same with a different icon picked.

All credit to @BrianTee_Admin. There’s nothing new here. Just a lot of copy paste edit.

I’ll get the code uploaded in the next few days. Maybe with it and this explanation you can walk through the mess of code.

2 Likes

I built Brian a Christmas tree farm. 300 cm x 150 cm. I had to set the name to “_” or it bogged down GE.

image

Fixed the problem with the correct forward or backward arrow based on heading. What I realized, your either getting closer or farther from any tree. So I saved the last distance and compared it to the current distance. That gave me a check for positive or negative. Now it seems to be right regardless of heading. By setting the ABLine to the tree line it follows it. I have the scale set to the minimum tree spacing, so if there is a large difference, then it may draw off the page or very small.

Here is the updated Program and I added a zip of the source code. Found it easier to zip and upload than to build all the links and such. Also uploaded the field below for anyone wanting to run that field or see the tree file or the kml file.

Edit:
All of this has been done on a random driven field. So wondered if it would actually import a kml file from GE, layout the trees, drive the trees, and export back to kml and fit. Yes it will.

1000cm square spacing. 2432 trees. Set the tool width to 1000 cm pick two trees in a line and it will drive it.

image

So will it layout fence post with an XX by 1 grid? I think so. Would need more accurate heading and end points. Also, would need a stretch, shrink or fixed spacing. But I think so!!

image
image

2 Likes

Looks REAL good! I hadn’t thought of laying out a fence line, but why not? It could also be used for soil sampling and ultimately for variable fertilizer and seeding with AOG precision farming modules!

Hard to see in this picture, but this is activating the center tool when over the tree.

image
image

Hacked the field top view to zoom into the tree to run a fine tune. It still stays north and south. But can really see the movement.

image

2 Likes

Kent, when you have time can you upload the code on the last changes?

I have it set up for three sections. I set the center section 2 to a decent width. The left and right sections, one and three adds up to be the total tool width (tree spacing).

Turn the manual tool on and click one and three off on the screen. As it drives over a tree, within 25 cm it turns the tool on and paints the screen just under 2. Works best with 1000 cm x 1000 cm spacing. At least that is what the graphics are set up for. The top view is in the upper (windows menu under what looks like a screen. It is dragable and if you click the lower left corner it shrinks and grows. I like to expand my screen and put it to the right of the distance arrows (as shown below.) The little green circle is 1 meter.

Uploaded.

image

2 Likes

Thanks Kent, I can’t wait to get in this :grinning:

Thanks kent!
It’s great!

I have a question for you, can I create an Ab line and start the first row of trees on it?

It does now.

Build your ABLine before you click the tree button.

Auto Plant is to the center of the field. (watch for the green dot)

AB is from the origin of the current ABLine. (Again, watch for the green dot.) It should convert the ABLine heading to degrees and fill in the (°CCW) form. If you need the other ABLine, just return back and select it. Hit the tree button and try again.

The A button gives a place to start.

If auto button is off, then it will do columns and rows of specific value. Auto is supposed to fill the field.

image

Here is the new program and code.

1 Like

Thanks Kent!
I’m trying the program.

Hi everyone,
I’m testing Aog-tree and it works very well.
But I have two small problems.
1- if I stop near “Point X” and move the tractor a few centimeters Aog does not detect it. can i try to increase the frequency of the f9p?
2- if I exceed “point X” and try to go back Aog turns the heading of 180 degrees. Can’t you block it?
do you need dual antenna to make Aog-tree work well?

There is a minimum step distance that AOG has. I’ll see can’t we come up with a way to override or reduce that step when going slow. You must be running some form of GPS corrections to get very accurate and precise. Dual antenna is the best for reverse right now. As a work around for the time being, I’ll need to add a reverse button on the screen until the new release comes out. It is to have a single antenna reverse feature that measures angle.

dual antenna config can solve this problem? or is it a problem of Aog?

I believe that it is a default in the settings. Dual will solve the reverse problem.

I set a basic system up to survey boundaries. I had to change the same setting when I did that. It would only get so close to a point, or so far from a point, but not on the point.

This is an amazing project KentStuff!!! Looks great, and sooo unique.

@KentStuff Looking at the CTrees.cs file - I don’t understand what the line comment = “Tree”; is all about.

I find where you optimize the screen for 1000 x 1000. I will plant at 906 and it looks fine on screen so must be close enough.

Where are you turn the section on within 25 cm of the tree. I know I’ll need some time before the tree to turn things on but I don’t know if 25cm is the right #.

Thanks

Comment = “Tree” by default sets all comments to Tree. This is what shows up in the Tree.txt file. This is also what shows up as tree type in goggle earth. This portion of the code has not been uploaded yet. Working on clicking any tree and editing a list of values. Type, plant depth, current height, dia, etc. This is simply one of the place holders. I needed it in the file writer.

0029790c749855438074011d552b95c4f4d8f2db_2_1380x862

I’ll need to look to see exactly where I placed that trigger. I’m away from my computer for a little while. Look for the phrase isOK2plant or something like that. It is a bool trigger. Then something about if (distance <= 0.25)

I plan on setting the graphics to a factor of 1000, based on minimum tree spacing. But the 906 should be perfect.

@KentStuff I find;
public bool isOK2Plant = true in the Ctrees.cs file and
if (Tree.isOK2Plant) in the OpenGlDesigner.cs

for the life of me I can’t locate anything about if (distance <= 0.25).

No hurry (it’s 8 degrees F here so I’m not going out to play!) but when you have time, a hint on where the distance is would be appreciated.

Cold here also, but nowhere near 8. Downloaded the zip file from github on my phone and transfered it to my son’s computer.

Opengl.Designer about line 528

PlantTree (Tree.Plant (bla, bla, bla,0.25)  

That 0.25 is the error. It calls the routine Plant in tree.cs.
Plant send back a true or false.
PlantTree is in the Controls.Designer. If true, turn the section on, else turn it off and update the buttons.

What I should have told you to look for is if (distance <error) yes =true