My Z-turn mower project "Noodle Brain" 54" Gravely, pixhawk 6c, Here4 w/base antenna

Hey guys, my name is Scott and I’ve been lurking around for a while learning a TON of stuff from this forum so I want to say thanks to everyone especially the developers of software for being so active and helping/sharing info!

Here is my little project I’ve been tinkering around with for a few months now, its an old Gravely Prostance 54 Z turn “grandstand” mower. I dabble in a little of everything from racing full size cars/boats, to RC cars, construction equip, subs, heli’s, etc but I havent spent much time in this complicated world of autonomous stuff so Im learning this all the hard way. So please bear with me if I say or do something wrong or dumb! My kids came up with the name Noodle Brain since the “driver” is my kids old clothes stuffed with pool noodles held together with duct tape.

So I started off with a pixhawk6c, here4, and base station antenna. Currently only 1 gps antenna and using the here4 as the compass “I hope its configured that way anyway lol” The conversion and hardware is the easy part for me, I installed big 1/4 scale hitec ultra torque servo’s, removed the centering springs from the hydraulic valves, and rigged up a servo to run throttle and turn the key off as a failsafe. So it is a pretty simple setup, and pretty easy to switch back to manual mowing if this turns out to be a flop. I put 3 big 12v lead acid batteries on board to power electronics and a stand alone battery for the cooling fan. Has a FPV system in hopes that someday in the future I can sit in my shop and watch it mow.

I have about 2.5 acres to mow, around 35 trees to go around, and being amateur at best with programming way points its taken quite some time to get a mission created that doesnt run into something. I wait for RTK fixed, wait a bit longer to gather a bunch of satelittes, and drive around saving way points, then create a polygon around the perimeter and get a bit creative trying to avoid trees and stuff with the polygon. Then I create auto waypoints 1m apart, lately I have been using spiral pattern but I would like to get it working well enough to do a back and forth pattern for nice looking lines.

Only recently have I started using Lua script for autotune, and this seems to have made things much easier and a HUGE time saver. Although I am still fighting this mower never driving in a straight line. It really takes the term S-curves seriously. I have used different diameter circle radius for tuning, and used my own “probably poor” PID values and am still seeing the same issue. I have done the position controller tuning steps as well and I have seen some good success with that, but something still seems a little off. Anyways! on to the pics and stuff.

Share a .bin log for tuning help.

I suspect your use of a magnetometer rather than GPS heading (GPS for yaw) is compounding the issues. I recommend NOT buying a second Here4 to try and rectify that. Moving baseline on the Here4 is a nightmare.

Those extra batteries are probably just taxing your charging system (if they are tied into it). Most of us just run the electronics off the stock electrical system. A good step down converter handles the irregular spikes in the crappy mower charge output. I upgraded the stator and wired a DIY voltage regulator on mine, since a set of bigger servos started overloading the stock (awful) voltage regulator. The stock battery has plenty of capacity.

A servo actuated key is a novel concept. An ignition relay might be a bit more reliable.

Im going to do a little bit of midnight testing here and post a fresh file later or in the AM. The batteries were simply left over from a lithium conversion I did on a ryobi electric mower and figured they would be great ballast and last dam near forever “60ah each” so I run those totally independent of charging system. Given I am still using the hydraulic drive motors the biggest draw is the big servos, and the cooling fan is hooked up to its own separate battery “I might not even need it”. I have only charged them twice in a few months with heavy testing so it might end up being a annual or biannual type thing once this thing is working good.

I might be searching for something that’s not possible with my setup and I need 2 antennas for GPS yaw… but I am certain I can improve what I have.

I am curious, since I do alot of testing at night “when kids are finally asleep” I dont spin the mower blades since the grass is soaking wet from condensation and it stinks up the garage from wet grass and mold. so I have a switch that runs compass calibrate and I calibrate the compass before mowing or testing each time, “blades on or off”, since I read a post you mentioned the blades can change the calibration. Is this a good idea, not worth doing, overkill, maybe throwing calibration off if Im in a hurry or calibrate in a bad spot?? It calibrates so fast its not that big of a deal, but if it leads to inconsistencies I dont like that.

The real answer to compass calibration is here:

https://ardupilot.org/rover/docs/common-magfit.html

Use the web tool. Try it with a few logs and compare results (blades on/off, various conditions). If you get somewhat consistent results, then you might get away with using a compass alone. If you can at least get consistent results with the PTO engaged, use those results and know that spinning blades is a requisite for good navigation.

After reviewing the log, it did not record the missions that I wanted to share. I was under the impression every time I armed it, it would start a new log, and when I dis-arm it would end that log. Apparently that is not the case so I need to look into that. I will attach the log anyway, apologies its so large of file, wasnt intended. Hopefully there is something in the log that will throw a redflag to a more knowledgeable person.

So here is what I did last night from 10pm till 1am

Decided to “start fresh” with the steering and throttle gains and let quicktune do its thing did a few different circle radii and reversing the direction so I could record the values and see if they change. Again there is no indication that quicktune was working, no messages, and PID values unchanged. Quicktune worked previously and cleaned up my somewhat botched attempts at tuning in the past so I tried to keep faith, seemed weird but ok…

Now focused on PSC tuning, after beating all those values to death, again, with no real improvement I decided to make a last ditch effort at steering gains. Running low on beer at 1am I took a swing at it, moved P gain way up, I think I added 50% to whatever it was. “left I and D at quicktune values” which generally resulted in crazy oscillations, but to my amazement it responded very well. I ended up with almost triple the P value compared to quicktune’s #. Still needs work, but big improvement. Keep in mind this was all done without the blades on, hopefully in the next day or two I will be able to actually mow with good results. Then, hopefully, I can share that log.

oops sorry, that was my half asleep, half buzzed, explanation video lol Here is the log.

Also keep in mind that since you are tuning the whole drive “system”, engine rpms change the hydro drive characteristics just a bit. I have mine well tuned at full rpm but when I drop the rpm at its last WP for its cool down period, it does have a slight oscillation as it slowly trundles home that is not there when cutting. Nice job!

PS - Like Yuri, I’m just using the small original mower battery and the stock charging system (15 amps)keeps everything topped off easily. Good luck!

1 Like

I am curious how you guys go about programming the mowing path? Currently I am driving the mower around saving waypoints to create the perimeter and locate the obstacles. Then import to Mission planner, create a polygon overlaying the waypoints I saved for the perimeter, auto way point that polygon, then I manually move waypoints and add waypoints to avoid the obstacles. but there is ALOT of trees and obstacles, and its proving to be a time consuming task with the amount of revisions I’m making and waypoints to move. Then heaven forbid I park a trailer or vehicle where its supposed to mow and have to modify it again.

Just trying to find more efficient ways to do this. I was hoping there was a way I could just drive the mower and it would record my entire path that I could import into mission planner, rather than driving, and stopping at every place I want a way point.

Thank!

oh and 1 more question, after a tuning session I have noticed sometimes it behaves differently. I think due to acceleration settings, so Im curious which accel settings effect the way it drives in manual mode? I was under the impression that manual mode should be bypassing the FC, and when switched to acro it would apply the PID gains and acceleration limiting settings. Thanks!

I use Mission Planner similarly to the way you suggest for path planning. I’m working on a standalone path planner that takes fixed obstacles into account for the reasons you are concerned.

If you are worried about pop-up obstacles, you should look at obstacle avoidance with radar or LIDAR. I don’t really like the way BendyRuler behaves for mowing, so I abandoned most of that. But it does technically work, and I should probably make better use of avoidance features for safety’s sake.

Even with fully active obstacle avoidance, I would never park something expensive in a place I routinely mow and then send the mower out on a path that intersects the expensive thing. I’d change the plan or move the thing!

Tuning has no bearing on manual mode.

When adjusting ATC_accel parameters it shouldnt change the way it behaves in manual mode?

On the topic of obstacle avoidance, I was hoping I could tighten up my waypoints to bring the mower closer to the perimeter and tree’s, thinking 1-2ft, and using bendy ruler as a safety to hopefully not run into them. I’ve already ran into instances where RTK was lost, accuracy goes to crap and it starts hitting things. It would be super cool to auto way point the whole yard and use some sort of proximity sensor and bendy ruler to avoid trees and obstacles! but at this point I have a fairly decent mowing pattern figured out as long as GPS and RTK fixed are good.

What would the ideal thing to use in this case, I see there are lidar units, sonar, depth cameras?? Im sure most of you are rolling your eyes at a simple question like that on this forum but like I said Im learning the hard way here and Im not well versed in this sort of thing. Ideally something that is supported and has been used with pixhawk/mission planner.

No. They are not used at all in manual mode. The only tuning parameters I can think of that should affect manual mode’s operation are MOT_SLEW_RATE, MANUAL_STR_EXPO, and the SERVOx parameters for the motor outputs.

I think the best answer to obstacle detection is millimeter wave radar. There is no “right” answer. Every LIDAR I’ve tested gets wonky in bright sunlight. Maybe a super expensive one would work, but I have no faith that the dollars spent would be actual value added.

You might be interested in this Lua script to keep your mower reined in whenever the fix type decreases below RTK Fixed.

I have some updates with promising results, I haven’t found time to wire in the lidar and mess with that yet. But I found the remedy to my particular issue of waypoints consistently being overshot. Out of desperation I was trying large changes in gps and ins offset from origin. I assumed origin should be the center of rotation on a zturn mower and maybe that was my mistake but when I set gps position to -.35 “I believe that was the best performance” it worked great and improved pivot turns accuracy and s turn accuracy big time! In reality the gps and pix hawk are about 7" in front of the drive motors and centered in the chassis, which means gps and ins offset positions should have been set to +.9ish. So either the offsets are backwards or I am masking another issue, but cheating these numbers works! I just had a random thought while typing, you think steering or throttle feed forward settings affect this at all?

Also I was fooling around with GPS vs magnetometer settings, I set compass calibration and ekf learning on, as opposed to disabled “I’ll have to check my parameters for the exact parameters I changed” and I changed yaw source from magnetometer to GPS even tho I’m only running a single here4, not moving baseline with 2 antennas, and this REALLY helped it exit pivot turns at the correct angle leading to a much straighter line. Very happy with the results, finally! Lol after spending 10’s maybe 100+ hours changing stuff and tuning with little to no improvements.

Oh and I also observed the fact that changing ATC accel, decel, turn rate, max turn GC’s, etc does indeed change the way the mower drives in manual mode. I know I’ve been told these parameters won’t affect it in manual mode, but it does, I lowered ATC decel to a very low number trying to stop overshooting waypoints, and switched to manual mode to drive into the shop and the mower took forever to stop and ran into my couch. Also steering response is affected as well although I’m not sure exactly which parameter affect that, max turning G’s maybe? But anyway, I did verify it was indeed in manual mode both in mission planner and on my RC transmitter. File that into the “whatever is worth” category. Not trying to disagree with anyone, just stating how my mower acts.

Are you sure you’re in manual mode?

Acro or steering modes might behave as you describe when changing the ATC params, but manual should not!

Hard to argue with results, but setting the yaw source to GPS when there is no GPS yaw source is a bit of a strange thing to do. Might consider setting it to GSF, instead, as that’s almost certainly the fallback in use.

Yep, I actually took the mower back outside after double checking settings in mission planner, I only have 3 modes possible, manual, auto, and circle, and when in manual mode it is apparent on the OSD and it speaks to me saying “switched to manual mode”

Also I was totally expecting weird behavior when switching yaw source to gps but to my surprise it worked great! Gps heading and actual heading “red and black lines in MP” almost never agree and point in the same direction, and now they do! And it’s no longer starting off every mowing line crooked. I’m definitely being stubborn by sticking with the here4 GPS and base station but I don’t want to invest my money into 2 GPS antennas and new base station for moving baseline yet. I also have that new magnetometer sitting in a box that you recommended to try.

AND I noticed there is an option for using dead reconning during maneuvering, And I feel like wheel encoders and dead reckoning during pivot turns should be reliable and accurate, assuming equal diameter and no tire spin. Even with tire deformation, the total distance traveled by each tire should be much more accurate than single GPS or magnetometer in my case I would think.

You are not using GPS yaw, so set GSF.

Your manual mode observations are not reproducible for me. Share a log (preferably two, where you change the parameters you observe to have significant effect between runs).

You can be stubborn, but much of your approach here is shooting in the dark and seeing what might hit. We do have documentation for tuning and config…

I did order up a RM3100 compass and got that installed, re-ordered the compass’s and re-calibrated them. I did a few short mowing patterns and brushed up some of the PSC values and I have to say I am very impressed compared to the compass in the Here4 GPS module, so far! Hoping to take a video soon and show how it runs now. I would also like to switch back to GPS for yaw and show you what I am seeing. because it did work great! I will need to make sure I am logging my missions so you guys can check my parameters, maybe there is something feeding yaw info other than just GPS or compass.

Please keep in mind I have been learning this entire process the hard way as I go, and I have to say it is not easy! and I even impressed myself that I havent thrown in the towel and swapped it back to manual controls yet LOL

But call me crazy, wouldnt it make sense to feed all the things into EKF, and then use EKF to guesstimate position and orientation?

Hey guys, I was hoping to get a little bit of help from someone more familiar with parameter settings than myself. A few days ago I mowed “Zone 1” of my backyard with great results, the best I have seen so far in fact. Then today I fired up the mower and with intentions to mow “Zone 2” and make a video to share. But it is not cooperating with me, getting EKF and AHRS errors, horizontal and vertical pos errors, artificial horizon is going crazy spinning all over the place when it is armed but not when it is dis-armed.

I tried doing a compass learn and driving figure 8’s, while doing that I noticed the heading “red line” was of course not agreeing with the GPS heading “black line”. I remedied this in the past by removing the whole pixhawk/RM3100/Here4 module from the mower and re calibrating the accelerometers and compass’s. but that is a pain in the butt to do. I assume that I have a parameter set incorrectly somewhere where it is recalibrating things automatically but at the wrong time such as when it is in my faraday cage of a shop with no GPS singal and/or with the engine running “lots of vibration” throwing off the calibration.

Also worth mentioning is the fact I changed EKF yaw source from compass to GPS while it was mowing “in the first log” to see how it would react. and it responded well. but maybe that is throwing a wrench in the works?

the 160 log is when the mower was working well, 163 is from today when I am having issues.

Thanks again!

On another note, while messing with endless tuning and fiddling while mowing I noticed I could greatly improve the pivot turning by tuning in the skid steer asymetry parameter, where motors move slower in reverse than they do in forward. I can get the mower to stay in place during skid steer turns vs it moving slightly forward or backward during a pivot turn. Just thought I would share that little tid bit.