Grade control

It’s there and it compiles :ok_hand: Tested briefly with the simulator, and creates the files into the field folder with the boundary/interior points. I’ll continue testing later today and hopefully this week in the field.

1 Like

How is github code compiled?

1 Like

Github is just holding the code. You need a compiler (for C# you can use MS Visual Studio free edition).

You can alternatively manually download the code from github and compile with a suitable compiler, or then use an IDE (like Visual Studio) that supports github integration and does the downloading for you.

1 Like

The link below is the compiled code. Download the zip. Right click on the zipped folder and click unblock at the bottom of the popup. Unzip the whole folder to into my documents. You can created a shortcut to AgOpenGPS.exe. That should work, maybe.

https://github.com/KentStuff/AOGSurvey/blob/master/ProgramV4.zip

1 Like

Thanks. The program works. I couldn’t do it myself.
I installed visual studio and tried to compile, but it kept getting errors: unable to parse files because they are in internet zone or contain tags.

2 Likes

Working a bit more on seeing the profile in AOG. I’m using the ABDraw form and added a very basic and crude profiler that simply shows all the points in the profile. This is what opengrade does for all the points. The top view shows where I drove in from the right and changed the elevation as I drove and color coded it accordingly. The bottom view are these elevations but from left to right.

image

Managed to add the profile picker to the screen. If you want to know the profile you just click boundary to boundary or anywhere to anywhere and it will draw the profile.

image

This is another view.

image

4 Likes

Some practical considerations for a change. My blade is arriving this week and was thinking about the hardware setup. For the control, I think I’ll put a manual-auto rocker switch to the solenoid valve wires and a simple on-off-on rocker switch for manual control, maybe in a separate box so it’s easy to mount somewhere accessible.

Where have you installed the GPS receiver and the control board? In the cab or on the blade? I wouldn’t want to run the antenna cable to the cab, would it be feasible to put everything (simpleRTK2 + PCB for valve control in a box sitting on the blade and just run power + USB to that box, and put a USB hub to split to arduino and GPS. Or even bluetooth/wifi?

1 Like

I am thinking of putting a manual up down switch to the arduino, something like if you lift it goes manual and if you lower it return to automatic.
Right now I have a switch to enable/disable the auto mode and use a second scv for manual control. It works right at high rpm but oil flow is not high on my old Valtra so I have to cut the flow to the prop valve at low rpm to move it manually.

For the electronics, I have all in the cab. I have a 3m extension on the antenna cable. A little 3D printed box the the SimpleRTK2B an a box for the valve control.
The antenna is on a little step i made a few year ago for a laser pole.

Picture on post 50

My Opengrade3D is in progress the last changes on Github, Now have the elevation view with the last 10m drove and the 20 m ahead.
I will change change the folder name is the next days to make a complete separate install for OpenGrade. I am planning using both, the 3D for optisurface map and the original for the little correction is autonomous mode.

For the survey I think it can work well without inclinometer. If my calculation are right on a 9% slope(5deg), for each meter of antenna height, the survey height error is 4mm. the horizontal error is 9cm, but this not matter much.

1 Like

I googled around a bit and a joystick on the analog input could be a neat option, would giva also manual propo control.

That’s true, wouldnt worry too much unless really heavy slopes.

2 Likes

Here’s my idea for the simple manual control. Would work with the arduino completely off in the manual mode.

Another way I though of would be to add the optocouplerd to the PCB and connect man-auto and up/down switches to those. Then the manual operation box could be a separate small enclosure with low current lines and then maybe put the pcb and gps receiver in a separate enclosure.

image

Here’s about the cheapest (quality) 1-axis joystick I could find, 60 eur:
https://www.distrelec.biz/en/paddle-joystick-apem-bh140a01bkbl0000/p/30100598?q=*&pos=5&origPos=7&origPageSize=10&track=true

Come to think of it, it probably needs some extra diodes and maybe a relay in the sketch, so might be easier just to connect the valve to arduino and add the manual controls through arduino code.

1 Like

This is a nice joystick, digikey also have some.
ip67 lever
ip65 lever

While the blade is cutting you will often have to lift the blade manually for the tractor not stalling.
So a switch or prop lever connected to arduino would be nice.

I have now some ideas to improve my opengrade3D accuracy and calculating performance, i will work on the next raining day, harvesting first!
I will also add more visual options.

1 Like

I’ll try to make that work with the PCB, soldering in all three optocouplers I’ll make one input the auto-man mode switch and then hook a rocker switch to the remaining two. First version in the code just so that with up/down command it gives a PWM value ± so on/off control for the valve.

Later on one could add a joystick for the analog input and then one could utilize the rocker switch in auto mode so that pressing up nudges the blade up by say +5 cm per press and then it resets to zero when you press the down button.

Here most people like myself are still waiting for the crop to be ready, lots of aftergrowth due to dry spring followed by good amount of rain, will be September before the harvesting can start for real :frowning: At least two weeks behind from normal schedule…

1 Like

Worked a bit more on the profile picker. Click here, click there, and click profile. It draws a profile of the elevations along that path based on a weighted average of 2 points. I found 4 would drag it down or up unnecessarily. It only will pick up points within a few tool widths away from an elevation. It is set to profile the points a meter apart. That could be set to whatever. Now, should be able to draw a window in the top view and set all of the cut elevations in that window to a laser (flat.) This field is just a simulated fake field bumping up and down on the elevation as it drove the ABLine with U-turns.

image

image

This is it in the main screen. Right now it is drawing the points at elevation. That may not be the best. Maybe a toggle from flat to elevated.

image

It’s here compiled if you want to give it a try. The little number picker below the survey button is the elevation simulator. Right now it does not reload the survey points in the field.

https://github.com/KentStuff/AOGSurvey/blob/master/ProgramV4.zip

Added another small step. Can select a group of them and adjust the altitude.

image

Below, I selected the whole field and set it to the same elevation, then selected the center
area and basically cut a pond in it.
image

3 Likes

Started working a bit on the .ino for manual blade control. I use the PCB buttons (imp/steer/switch) to control the man/auto mode and the up and down movement.

When you have the rocker switch in manual mode, it just bypasses the opengrade commands and drives the blade up or down with the specified min/max PWM value.

Now, for the auto mode, easiest is just to leave it as is, i.e. in auto mode it overrides the opengrade commands while up/down buttons are pressed. But would it be better to have a nudge function, something like for each up press, it adds +25 to the cutValue and then on down it resets back to zero? Is the 10 centimeters maximum upwards movement enough, because the cutValue is capped at 0-200?

The blade arrived last week, need to get the hydraulics stuff working to move it from there in the first place :grin:
image

3 Likes

nice blade what size tractor you pulling this with. are the folding wings just to reduce transport width.

In my OpenGrade3D I added a value called bladeOffset with a window on the main window. Maybe I should also add this to my OpenGrade.
After we could send a value from the arduino to OpenGrade. or make two big buttons on the screen +3cm -3cm?
For my final setup I will integrate a prop lever with the auto manual activation on it. Something like if you lift it goes manual, if you push down a little it stays manual and you push full down to reactivate auto. But that’s for the next winter.

There is maybe a little problem with my visual map generating code. When openning the .agd (36000 points, a 22ha field) OpenGrade3D was not responding 20 minutes until the conversion was complete.
it’s " public void CalculateMinMaxEastNort() " causing the hang if someone want to take a look.
After it work good but the program round time was 40 to 60 ms, maybe a bit long? AOG takes about 8-12 ms on the same computer.
The last version on Github is not ready for field work. I am working on openning the .agd file and the sim coord are changed.

2 Likes

Pulling with 180 hp ang 8 tons weight. It’s 4 meters working width so should be pretty OK match. The blades fold hydraulically for transport and then there’s tilt in the bogie wheels. Was looking for a second hand but they are really rare around here and the new one was roughly 1/3 pricier so went for that.

@Pat I think the ± buttons on OG would be the best. I’m kinda favoring a separate physical auto-man switch for safety so you don’t find your toes under a movibg blade in case you need to check something etc.

1 Like

In a 22 ha field processing every 1 meter each way, 36000 points each time through, that’s about 8 billion checks. I don’t have any idea if the processor can do that, but I had a problem breaking a line into very small points and then delete the points that were wrong, and do it again and again a couple hundred times. Not 20 minutes, but 4 or 5. Should be fairly easy to check, set your step value to 10 instead of 1 and see how much difference it makes. I didn’t see anything in the code that would hang it, but that doesn’t mean anything either.

I never was able to get the simulator to work for my lat and lon. I could get nothing east of 100. 99 was 990, 85 was 850. That is when I went back to importing opengrade back into AOG. I think I may have busted my opengrade, and don’t know where. So the direction that I went was AOG to survey the field, then edit the cutting from inside AOG. May try to work some of the blade information back into AOG later. Not much difference between hydraulic lift at the end of the row and hydraulic lift on the blade on the fly.

2020-09-02 15.04.09

This is a picture of the abDraw screen since Internet is down. You can select a group of points and edit the cuts, or individual points and edit survey or cut. Then draw the profile of it all. It now saves and reads the last survey including cuts. If the cut elevation does not exist or is less than 1, it sets the cut to the survey point and saves it until you decide to edit the cut.

1 Like

I made some tests with a .agd 25Ha field (36000 pts). To make a 10 meter resolution (2500 pts) it take 30 seconds. For a 2 meters resolution ( 66000 pts) 18 minutes. It only have to be built once.

Here is a video with this field with the 2 meter resolution map.
Note that the map resolution does not affect the grading precision.
The little red and orange dots are the points used for elevation calculation.

I made a little hack to read the longitude less than 100. there is a leading zero missing in the GGA when less than 100.
I simply added an " .Append(0)"

private void BuildGGA()
        {
            sbGGA.Clear();
            sbGGA.Append("$GPGGA,");
            sbGGA.Append(DateTime.Now.ToString("HHmmss.00,", CultureInfo.InvariantCulture));
            sbGGA.Append(latNMEA.ToString(CultureInfo.InvariantCulture)).Append(',').Append(NS).Append(',').Append(0);
            sbGGA.Append(Math.Abs(longNMEA).ToString(CultureInfo.InvariantCulture)).Append(',').Append(EW).Append(',');
            sbGGA.Append(fixQuality.ToString(CultureInfo.InvariantCulture)).Append(',').Append(sats.ToString(CultureInfo.InvariantCulture)).Append(',').Append(HDOP.ToString(CultureInfo.InvariantCulture)).Append(',').Append(altitude.ToString(CultureInfo.InvariantCulture));
            sbGGA.Append(",M,46.9,M,,,*");

            CalculateChecksum(sbGGA.ToString());
            sbGGA.Append(sumStr);
            sbGGA.Append("\r\n");

            /*
        $GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M ,  ,*47
           0     1      2      3    4      5 6  7  8   9    10 11  12 13  14
                Time      Lat       Lon     FixSatsOP Alt */
        }

A physical man/auto switch will always be necessary because it’s always sending data to the arduino. Are you planning to tee the hoses in two scv like I did in post 41?

2 Likes

So that’s only for the visuals, right? I think the best way would be to use a library like ANN ANN - Approximate Nearest Neighbor Library That builds a specific structure that can be used to query for the closest point(s) to a specific point. If that structure is stored, it could be used later on for finding the nearest points as well, should speed up finding the nearest points. Will try it out after tomorrow when it starts raining. You can also query the N closest points. Should be a lot faster than brute force anyhow.

I’m thinking of using the same valve for manual control as well, so the arduino is always driving the system, either from opengrade inputs or then from the manual switches. Built the 5 volt power parts to the PCB so that the arduino can run even without the USB cable plugged in.

2 Likes