V4 Lives on

Remember i said I won’t be working on v4? Once again, I have no idea what the future holds, and the best laid plans are just that, plans. I think the timelines are short vs how much work needs to be done on v5. Time to test and modify, work on the GUI, do some things better, all require massive amounts of time.

So, today i dusted off the source code of version 4.3 - its a great program. Works nice. So here is what i did:


  1. All the sequence stuff - it was really bad code that takes huge resources with little benefit. If you used it in the past, you’ll have to use the original version.
  2. The maze path and grid stuff that generated the “drive around” inner boundaries. Was mostly for the original agriBot work, so now you’ll have to drive around inners - doubt many used it anyway.
  3. Removed the recorded path.
  4. Removed the GeoFence and all associated code for that.

Added: the stepFix code from Drive that has been worked on - but not the reverse at this time. v4 needs to be reliable, not have everything the new version will offer. The new fix code is solid, does roll and antenna offset properly.

Changed from UTM and convergence angle correction to local tangent plane geometry. 1,000,000 times faster code execution then utm. Just as accurate. 4 years ago debated between LTPG and UTM, maybe chose wrong.

Further reading: https://en.wikipedia.org/wiki/Local_tangent_plane_coordinates

So with all that removed - it runs pretty sweet. 1 to 2 ms per frame even with headland, uturn, implement lift on.

Next steps is to add the new steer algorithm - remove pure pursuit completely from it.

I know some are using Pure Pursuit - but am not sure why considering Stanley works so very well and requires almost nothing for setting. So that is the question, how upset will you be if i remove PP?

The PP is less sensitive to bumps and the associated left / right sideways swing. When the roll is slow, the inaccurate bno55 on a small tractor with a small wheelbase, the PP somehow filters out these imperfections. With CMPS mounted, stanley is OK.

1 Like

I find pp better for low speed and stanley better for higher speed. Once tuned right, and running less than about 10k, it’s absolutely bang on. Which I could never say about Stanley.
I will no doubt try the new code and re-evaluate my stance after playing with your improvements

1 Like

the disappearance of PP will undoubtedly be able to strongly upset me because I have been using it for 2 successful campaigns for sowing in 3m at 7-8 km / h I never really succeeded in having a perfectly straight line with stanley maybe I I’m not good at my settings I will review my position with your new version and trust you completely for the improvements you make

I agree. A lot of the issues were actually MMA related too. Certainly noise on rough ground issues anyway.

I think it will be best to release it without PP
The people that will keep pp has probably not tried the new steer algorithm😀

Ive had quite a few fights with straight lines but I’m absolutely sure the issue has been heading related and not any issue with Stanley. Sometimes compounded by roll noise. The much maligned bno055 was either brilliant or a disaster. Re calibration is definitely it’s issue. I’ve seen posts in telegram suggesting the ‘new’ sensors can’t be trusted because they are basically the same hardware but this view demonstrates a misunderstanding of what was happening. Apart from the much better firmware the key to us is the ability to turn off auto recalibration.

With the magnetometer on and recalibration on the new sensors can be persuaded to produce the exact same drift that the bno055 showed.

To me, Stanley is like pushing a shopping trolley. If you add noise to your direction it moves significantly. PP is like dragging something on a rope. Look ahead being the rope. The longer the rope the less difference any noise in the pulling direction makes.

BUT, pushing you can be very accurate with quick response. Pulling on a long rope, response to any input is much slower and less responsive.

I had to use PP when I had a serious heading issue maize drilling. On flat ground it was extremely good but when I encountered varying cross slopes not so good.


I use the brick v2 for heading.
I have tried to get PP to work but inevitably keep coming back to Stanley because it seems more reliable. However, I still struggle with straight lines without kinks sometimes. Antenna is on the front of the bonnet.

When I remove the MMA and replace with either an 085 or cmps to try and improve the straight line on rough going where do I connect, how to turn the recalibration and magnetometer off ( as Alan suggests ), and will the new hardware work ok with the brick?
( I.e would someone mind giving a detailed description of how to go about it please ! )
Thank you


I don t use bno or mma at the moment. Initially I preferred PP, but after playing with all PP and Stanley settings all season long, I can’t say which one is best for me. We cannot just go from one to the other and touch nothing else. But by adjusting everything (like the gains, the counts per degree …) we get something very similar between the two, but which can be better with stanley with a correct heading. I will do my first tests with the bno08x when the work in the fields is restarted in a month and a half.

For the BNO085 working on the sparkfun library, simply put this line of code in setup. (myIMU being your BNO085)


The mode can be changed with for instance…

myIMU.enableGameRotationVector(40); //Send data every 40ms

If you are using the BNO085 in whatever guise, use roll from that, it is really stable.

I use a trimble bd 982 dual antenna receiver an i use stanly so from my point of view pp can be removed. I will stay on the drive version because of Integral. Integral is for me the best feature from 2020.

What is the new steer algorithm? That one from drive with integral or that really brand new announced on discourse some weeks ago? Guess almost nobody has tested the new new steer algorithm. - If the new steer algorithm isn’t able to refer to pivot axle, I would miss pp.

Ok, thanks Alan

I have never gotten Stanley to work well in the past, but making it drive off of the rear axle should make it run very similar to PP. If it works I’d love it if everyone used it. Make for good settings information.

Thank you all for the answers. PP is forgiving, but is also absolutely terrible on any sort of curve due to the look ahead point being far ahead to allow for stability. The downfall in all the literature, and proven of course in the tractor, is its cutting corners. It just wants to steer to the lookahead so it will drive “as the crow files”.

Stanley is forgiving and easy, but i think what happens is the heading is absolutely critical to be accurate because the distance off the line and the heading both use heading to be calculated. Whereas PP just uses the position of the antenna which is often fairly close to the pivot.

I think if you use dual antenna, Stanley is perfect. but if you don’t have a steady heading, PP with the antenna out front is “easier”.

v4 is a pile of code progression from the start. It is like an archaeological dig of new features added. So there is a function for getting the steer angle for ABLines, then contour came along, then curve, then uturn, then recorded path and each one worked a little different so there are 5 yes 5 different steer functions - and each one has both stanley and PP in them for a magical 10 autosteer routines - all different.

Maybe i can keep both, if i can go from 10 spots to 2.

Since we have gotten the code working for Danfoss on 4310, I have tested both. Stanley will still move 5 to 6 cm off the line where PP is 1 to 2 on the same path. However I’ve noticed since ive switched to 4310 I had to move my antenna position from 60 cm to 30 cm virtual from rear axle to get it to hold the line. Kinda like PP. I didn’t move the antenna forward position around in Stanley to see if it would improve. I still believe that having the pivot in Stanley at the rear axle is going to make a world of difference. When you get it uploaded, let us know, and I will test it(weather permitting) same day.

Maybe i can figure out how to do the same reference point move tricky dicky thing i do with Stanley - I can do with PP?

That will be a tough one. On curves the segment length looks like it will have to change from sharper turn to larger, and from inside to outside. I’d rather test Stanley and see if it will work, then depending on results choose next option. But it’s your noggin.

Lol, Me thinks i will try to keep both - at least have PP for ABLine at the very least. To me, if it doesn’t autosteer well, the rest is meaningless

1 Like