Grade control

I now managed to get the data quite easily from .agd file. Just the test data I’m using is not in WGS84 but ETRS89 coordinates so having bit of offset there as I was using some laser scanning data that was publicly available for testing. Also need to figure out setting the main benchmark correctly in Optisurface so the design ends up in the right place, the benchmark is now off as well in the testing dataset.

I’m using the pyproj package to do the transformations, need to run some benchmarks to check that it works OK. I think it would be easy to have a python converter that created the text file for opengrade.

I was browsing through the variable rate stuff and that’s basically what this will end up being if we export the design from outside, maybe would make sense to combine efforts at some point. Need to take a look at @SK21 rate control app as well for inspiration, then we could have opengrade app that runs alongside AOG?

But that’s maybe next things, I think the crappiest visualization I can come up with is just using a color coding and putting big vertices on the 3D view. Next could maybe be the background image, since making the png out of the elevation data is quite straightforward…

So when using an on/off valve with cytron, the cytron is just switching on for longer or shorter periods. basically just a switch?

Hi
Yes it act like a solid state relay, like @baraki 's Mosfet. It should be no problem unless someone have an other thought about this.

The delta value form blade height vs target height is enough if there are no big steps or big change in grade. This will keep the code very simple since there is no heading to calculate. Half to the time the point is ahead, the other half behind.
I think there is no need to improve the code on the OpenGrade side, but maybe someone will make a nicer aduino code(better written).

@nut I didn’t understood the python code so far, how to use it. Do you think we may eventually write a program (,exe) converter with visual studio? Select input file, press execute, voila! This could be more user friendly, maybe python is easy once you understand it!

I will try to find an .agd file in the next days, the one I have (from an email that was not intended for me!) is a .gps.
Seeing all this progress I now hope to be able to level in September with an Optisurface map! :grin:

1 Like

You guys that are working on this full 3d leveling. How much harder would it be to run two receivers and valves through the same computer? Just something ive been thinking about.

I think dual GPS will be the next step, It should relatively easy. Maybe with same setup than AGopenGPS?
I want to mount dual antenna to one of mine tractor next winter so I will learn more about it!
To give a fixed angle to one side should be easy, to adjust to the points at each side a little more complex but douable. I think there is already some heading stuff in the code.

1 Like

@Pat for testing purposes I attach one .agd file that I created for testing here. The landform design is 100% bogus since just wanted to export something to test on.testfile_agd.agd.txt (24.0 KB) There’s also the script generated Contour.txt file part (it’s missing the header)Contour_edit.txt (53.4 KB) and the script itself used looks like this with some comments what the parts do:

Load libraries
from pyproj import Proj
import numpy as np

Read the agd file skipping the first row and taking only the 5 first colums. It creates a matrix out of those values

data = np.transpose(np.genfromtxt(‘veikko_edited3.agd’,delimiter=‘,’,skip_header=1,usecols=(0,1,2,3,4),missing_values=‘’,filling_values=-1))

Save individual columns with a new name for sake of clarity

latitude = data[0]
longitude = data[1]
altitude = data[2]
proposed = data[3]
cutfill = data[4]

Create a projection object for the correct zone (35 north) and coord system:

myProj = Proj(“+proj=utm +zone=35, +north +ellps=WGS84 +datum=WGS84 +units=m +no_defs”)

Convert lon/lat to east/north:

easting,northing = myProj(longitude,latitude)

Create correct size column to fill empty with -1 and take offsets as the minimum integer values

empty_column = -1*np.ones(easting.size);
offset_easting = int(np.min(easting))
offset_northing = int(np.min(northing))

Create a matrix with the new data as columns:

data_back = np.column_stack((easting-offset_easting,empty_column,northing-offset_northing,altitude,latitude,longitude,proposed,empty_column,empty_column))

Write header data and then write the matrix of new data at once to a new file

g = open(‘Contour_edit.txt’,‘w’)
g.write(‘$Offsets\n’)
g.write(str(offset_easting)+‘,’+str(offset_northing)+‘,35\n’)
g.write(str(len(easting))+‘\n’)
np.savetxt(g,data_back,delimiter=‘,’,fmt=‘%10.10f’)
g.close()

I think we can integrate the parsing to the main program, maybe into the load/save field dialog directly. Python is just dead easy to use for the development of parsing and editing the files, so I intended to do the prototyping with that because you don’t need to compile anything.

@kansasfarmer so you mean like dual antennas at either end of the blade? Could be tricky depending a bit on the tilt mechanism, it’s a different setup if you have individual cylinders to control or one for height and one for tilt?

2 Likes

This is what it looks like in opengrade, the coordinates are off as I transferred to the default offsets for the sim…

image

2 Likes

So the agd file is from the landform program? And you are importing that file through your python contour builder? Then this is opened in AOG (opengrade)? Is this correct?

1 Like

Yes, that’s how it works for now. I’ll try to do the same thing for shapefile as well.

1 Like

Messed around with the code to see if I could get it to draw different colors based on the elevation above and below the base 100. Yes you can. This is an extreme for just testing. All it does is compare the altitude to the 100 and adjust the color of each point based on the difference. Here is a snap shot of it.

image

This is it drawing the width of the blade. Not dots but lines.

image

I’ve given the elevation a slide bar and modified the gradiants to smooth it out.

image

4 Likes

Wondering how the elevation is calculated. This might be a question for Brian. I assume the lines are the proposed elevation so driving along the line either in autosteer or manual , how exactly is the target blade elevation calculated from the current gps position?
Most survey software that I have looked at have a cut/fill to surface feature so driving anywhere on the surface will display elevation cut/ fill. Not quite sure how the calculations work I believe the 3 closest points are used to calculate target. So even for leveling a large area, there are only three or four elevation points any 3 are used in the calculation. The elevation points could be entered in the software or collected with the machine/implement, negating the need for external software for simple leveling jobs. Larger jobs could be imported as tin files or surface files. Not to side track you just a thought.

1 Like

In opengrade, there’s always a separate target line that you originally drew by hand inthe software. Now we’re bringing that target from an external tool. As you’re driving, it’s just seatching for the nearest point to you current location and taking the delta between actual elevation and the target.

For flat surfaces there’s the laser mode that @Pat added

1 Like

Another step. Below are three images. First is just a short “survey” with the red cut and the green fill. The second, I’ve clicked the contour button once and it just shows the cut. The third, I’ve clicked the contour button again, and it shows just the fill. All based on the line drawn in the lower cut/fill profile line. Just thought it interesting to see just one or the other.

image
image
image

And this is your edited file ran through the same steps. Notice they are further apart, they all have the same heading. And I think my green is a little weak.

image

3 Likes

So that’s getting the heading from the contour file to draw the tool orientation correctly? I just filled that with zeros…

1 Like

Running cleaner now. Survey view is based on averages. I allowed OpenGrade to “clean” your contour.txt to get rid of the -1 elevations. This is all based on the cut line that I drew. Basically it just cuts the top of the hill and “levels” it.

Yes, heading sets the tool orientation. I’m not sure what that matters, but, that’s what it does.

Also added a reverse in the simulator, needed to back up and look at something, so I did. Would only work with dual GPS or an “I’m in reverse” switch.

image2

And here are the same Contour, Cut Fill, based on your original cut line, less the -1 elevations.

image3

This is what it looks like in contour with fatter lines. Can really “see” the elevations.

image

Then, I thought I’d try to draw it with the elevations. Again, this is an extreme run, but it works.

image

2 Likes

Right now the cut delta is calculated only with the closest survey point but it should be easy to calculate a weighted average from the 3 closest points with their relative distance from the blade. this will add a lot more accuracy and probably give the possibility to level with only a few survey points.

1 Like

Now this looks good already! Maybe we should merge some of these into the branch we have in github now?

The -1 elevation are coming from the exported file, since it’s missing some data for some points falling outside the boundary, need to take care of that in the conversion script. Some points just have the proposed elevation value, but not the original elevation so as a quick & dirty fix I replaced all NaN values with -1 in the script…

1 Like

So I wrote a parser to convert the contour.agd file directly into Opengrade. The file below does get it in there. Now the simulator appears not to like any longitude east of -100. I’ve reset it in the software and have come up with nothing. -85 = -850, 22 = -220. I have no idea. This is an @BrianTee_Admin question. I’m betting it has something to do with the zones, but??? So, I just had Opengrade “fix” your lat and lon to appear in the window. Actual GPS numbers may be different. Here is how I fixed it.

double lat = Convert.ToDouble(words[0])-8.86857358;
double lon = Convert.ToDouble(words[1])-133.507383;

Here is the code. I simply just replaced the contour section of the field opening in the SaveOpen.Designer.cs around line 390.

Word on caution, make sure the contour.agd file does not have any extra lines at the bottom.

load-agd.txt (3.2 KB)

And here is the contour file saved during the closing.

Contour.txt (21.6 KB)

Edit:
Doing some more code edit. The following is a picture of a little different concept. As you are driving it looks straight ahead and finds the closest points in a straight line and then creates and on the fly updated profile in the bottom window. This is showing following an ABline and the profile of both the land and the cut in that direction. I’m still working on getting the up and down blade indicator working for these points.

image

3 Likes

As for the AGD, I figured only the 3GP labeled points are the design points, there’s some boundary points etc with the other labels. Worked a bit with the shapefile but the lat/lon in that one are way off from the agd file, maybe some problem with opensurface settings.

Now this is really nice!

1 Like

Assembled a minimal PCB on one of the Kaupoimodv2 boards I had on stock. Neat setup all in all, A/D converter can be added and the +5 volt supply in the future for a draft sensor.

image

2 Likes