I would appreciate your help on a persistent issue I am facing.
I have a heavy rubber-tracked, skid-steered mower vehicle weighing 800 kg. It operates at very slow speeds, typically under 0.5 m/sec. The required movement is to follow a grid-based path consisting of straight lines and pivot turns—no complex curved movements are needed.
I am using a Pixhawk as the main controller, along with a dual RTK GNSS system instead of a compass for heading determination - replaced the compass as I found it to be unreliable.
I have completed all basic tuning up to the S-Curves and Position Controller settings.
However, I am facing a persistent issue: no matter what parameter values I try, my rover consistently fails to follow a precise straight path. It tends to meander around the desired path. While I can adjust the parameters to make this meandering more aggressive or smoother, I cannot eliminate it altogether. On the other hand, the pivot turns are executed almost flawlessly. Typically, after the pivot turn it will move along the straight line for a few meters (roughly 5-10) sometimes with a slight offset and then start the meandering. I am attaching a quick sketch for you to get a better idea.
At one point, I suspected that my Pixhawk was malfunctioning, so I replaced it with a new unit. After reinstalling and starting the tuning process from scratch, I ended up with the same results.
I am trying to resolve this for over two weeks now so any insights would be greatly appreciated!
agree - please post the log file.
what accuracy are you seeking, and what are you achieving ?
my RTK mower is mostly within +/- 5cm
My biggest cause for xtrack error is the torque of the single mower blade when the grass gets longer throwing the mwer off course. Hill slide slopes also, Hardware ? more info needed.
The log file will confirm you are getting RTK_FIX on your GPS’s with corrections.
I have one more question regarding the logic behind the PID algorithm.
My understanding is that the cause of the meandering issue is due to the position controller attempting to correct the error between the target position/heading of the next waypoint (WP) and the actual position/heading.
In simple terms, the PID controller detects this error and sends instructions to the steering controllers. The result is, the rover overshoots significantly to the left creating a new error, then the controller causes the rover to overshoot significantly to the right, and this oscillation continues.
If my understanding is correct, what I struggle to grasp is why this meandering occurs at such low speeds. I mean, given that the rover operates at less than 0.5m/sec, I would expect there’s sufficient time for the controller to detect and correct any overshoot errors before they become significant. Am I missing something?
But why do you think the pivot angle affects the result? As I said, I managed my rover to execute pivot angles almost flawlessly. It’s the straight lines that I need to fix.
Did you make sure that your left/right motors run at the exact same RPM on the whole PWM curve ? If not tune that
And I would add that any chassis geometry imprecision (not square, left and right wheels not perfectly parallel, etc) will impact your straight line (do a laser chassis alignment).
I understand if there were any RPM or geometry imprecisions, these would also appear in Acro mode or when I control my rover with the RC. However, I’ve observed that my rover follows a straight line perfectly when using the RC.
This leads me to believe that the meandering issue may be specific to the autonomous navigation system rather than a fundamental problem with the hardware or geometry.
Please let us know a bit more about your ground conditions. If there is any slip between the ground and your tracks, that would appear as “lost motion”. The rover may be unable to respond to the motor drives even though the controller is operating perfectly. I have found that my rover operates with high accuracy on pavement, but less so in the field. This effect is consistent with perfect pivot turns because the slip is always one-sided. If your rover meanders while operating on pavement, we can rule out slip as the cause.
Today, I continued experimenting with the tuning and made some progress! My rover now tracks a straight line with good precision. However, there is still a persistent ‘one-off’ meandering right after the pivot turn. I am not sure if I can call it meandering at this point as it resembles more of a semi-circle bulb kind of shape as you can see in the sketch diagram I attached.
This is the last issue remaining, so I’d appreciate your input.
@Dr-Bob I am running the experiments on the pavement for now and plan to move to the field next week.
Also I’d like to share my experience regarding how different parameter values affect the behavior of my rover other members may find it useful:
PSC_VEL_I: Increasing this value caused the rover to oscillate around the path, which is pretty much expected.
PSC_VEL_D: Increasing this value also resulted in oscillations. This was surprising, as I would expect the exact opposite according to basic PID control theory - higher D values to dampen oscillations
PSC_POS_P: When I increased this value to 0.3, it also caused oscillations. I have no explanation for this behavior
And the strangest thing of all was when I increased WP_PIVOT_DELAY from 0 to 2 seconds; this significantly affected the width of the meandering, increasing it from roughly 10 cm originally to 20 cm or more.
Why would the pivot delay even affect the meandering width? It doesn’t make sense. Could it be a bug?
Following this, because I also am building a very large and slow tracked rover. I am sure I am also experiencing something similar though I need to get my GPS dialed in before I can tune again.
My question (and I don’t think this is necessarily your problem): What is the GPS setup like?
I see in your parameters you have: GPS_TYPE = 1 and GPS_TYPE2 = 13.
I’m assuming you are using dual GPS antenna and with no compass using moving baseline? I would expect GPS_TYPE to be 25 and for there to be some offsets defined for the GPS antenna to relate to the center of rotation of the rover.
GPS_MB1_TYPE = 1
GPS_MB1_OFS_X
GPS_MB1_OFS_Y
GPS_MB1_OFS_Z
No idea if what you have is configured properly for your hardware however. I think the fact that you say pivot turns are working correctly probably still points to a tuning issue… and I’m having problems getting my PIDs tuned as well.
Thanks for keeping us posted. Since you have already reduced the variations that slip could cause, let me suggest a 3-level full factorial DoE, if you are not already doing so. I found it useful to set my P and D gains that way, since control theory won’t help much with a non-linear system like a skid-steered rover. Since your system doesn’t appear to be drifting, the I gain is likely not too low, or not a factor.
Update. Today I made great progress through an unexpected tweak.
After having tried every parameter and value under the sun, I decided to experiment with the PSC_VEL_FF parameter, despite the tuning navigation guidelines explicitly saying not to (“PSC_VEL_FF should always be 0” as per the navigation guide). I increased its value to 2, and voila—the meandering literally disappeared! I found that the best value was
PSC_VEL_FF = 4.
Higher values introduce a jerking movement.
Why does this work? My theory is that increasing this parameter allows the rover to quickly/aggressively correct its position and helps it go back on track.
So now I quite happy with the result.
However, there is a new weird behavior right now which I wanted to share and discuss with you.
First of I have set a 4 second delay right after the pivot to suit my intended needs. Now here is what the rover does: Right after the rover completes a pivot and the delay is over, I notice a quick aggressive ‘kick’ in the direction of the pivot turn. For example if the pivot turn was clockwise, the kick will be to the right. The rover moves for about one meter in that direction before returning to the straight line (due to the non-zero PSC_VEL_FF).
@ rmackay9 I understand that you are the author of the Tuning Navigation — Rover documentation and I would appreciate your insights on the reasoning behind the guideline “PSC_VEL_FF should always be 0.”
As noted in my previous posts, setting this parameter to a non-zero value has resolved my meandering issue, and I want to understand if there is something fundamentally wrong in using non-zero values for this parameter.