Rover S-Curves alpha testing

@rmackay9, I finally got to the bottom of my waypoint disappearance! I had a complex OpenTX mix that put SaveWP as one of 3 potential functions on a single momentary switch. It was defaulted to HIGH, meaning that, with the the default disarmed behavior of SaveWP (RCxOPTION=7) clearing the mission, as soon as I booted, SaveWP went HIGH, and the mission was wiped out.

Fixed up the mix, and no more waypoint vanishing!

Back to SCurve testing, or more like tuning at this point!

I finally figured out what was causing my rover to have compass issues. Missionplanners compass screen always overwrites the “compass learn” parameter with 0 or 1. My rover drives well with EKF learning (2) active, but everytime I opened the compass screen it got overwritten and the rover drove of to the horizon. I must say, scurves is a great improvement over the L1 controller. My testing parking lot has a lot of obstacles and with L1, a solid GPS fix and careful planing, it was still hit and miss (pun intended) to get a waypoint mission finished. Today, I did a simple 4 waypoint mission with speeds up to 4m/s. I increased PSC_P up to 4 and the rover drove along the mission several times without hitting anything or deviating of the course. Really great!
It still hesitates a bit after pivot turns, but I did not have time to figure that out today.

So I was using a branch of this for obstacle avoidance with OAK-D-IOT-75: ardupilot_depthai_scripts/IOT/obstacle_avoidance at master · rishabsingh3003/ardupilot_depthai_scripts · GitHub
I changed if for rover changed the areas of interest and some other bits in the ESP code.

And behaviour is also not great in stable version so maybe it is not the S-Curves. I am pretty sure the problems are because of the OBSTACLE_DISTANCE_3D messages, so I want to change the code to use just OBSTACLE_DISTANCE instead. I will report back after the tests with S-Curves + OA.

P.S.: 4.3.0 works great both on Skid-steer and acerman steer, getting really good results after tuning. Video: http://autodiscovery.co.uk:8088/index.php/s/fgCjcsMTT2mHHTm

1 Like

@rmackay9, I think I’ve discovered the root cause for the oscillation that is exacerbated by increased PSC_VEL_D values on my machine.

During a long mowing/tuning session today, I noticed that I did get very nice straight line results by increasing the D term. However, there was always a pronounced oscillation exiting pivot turns that of course worsened with increased PID gains.

My mower has free-spinning caster wheels on the front, which are always mis-aligned with the direction of travel after a pivot turn. The slight “kick” to one side caused by those casters re-aligning with the direction of travel seems to be enough to set up that oscillation.

There is a happy ending though - after REALLY dialing in every tuning parameter under the sun, I was able set PSC_VEL_I and PSC_VEL_D to VERY low values (0.05 and 0.01, respectively), and still maintain 10cm or better crosstrack error.

It took a lot of work, and a lot of playing with the steering rate gains and ATC_STR_ANG_P vs pivot turn rate and acceleration, but I think I’m pretty happy with the overall tune now.

Additionally, a lot of the perceived delay after pivot turn completion was resolved by re-examining the acceleration tuning values and setting them to a compromise between aggressive maneuvering and smooth handling.

Parameters of note:
ATC_SPEED_P,0.4
ATC_SPEED_I,0.2
ATC_SPEED_D,0
ATC_SPEED_IMAX,1

ATC_ACCEL_MAX,1.25
ATC_DECEL_MAX,1.5

ATC_STR_RAT_MAX,75
ATC_STR_ACC_MAX,90
ATC_STR_ANG_P,2.3

ATC_STR_RAT_FF,0.225
ATC_STR_RAT_P,0.125
ATC_STR_RAT_D,0
ATC_STR_RAT_I,0.125
ATC_STR_RAT_IMAX,1

ATC_TURN_MAX_G,0.2 – While the Rover is technically capable of much greater than this, I found that decreasing it made for nicer “cut” corners.

CRUISE_SPEED,1.4
CRUISE_THROTTLE,45

WP_ACCEL,1.25
WP_JERK,0
WP_PIVOT_ANGLE,45
WP_PIVOT_DELAY,0
WP_PIVOT_RATE,50
WP_RADIUS,0.2
WP_SPEED,1.6

PSC_POS_P,0.5
PSC_VEL_P,2.25
PSC_VEL_I,0.05
PSC_VEL_D,0.01
PSC_VEL_IMAX,1

1 Like

Excellent Yuri! Congrats! Once I get my new guidance system assembled, I’m going to start with your parameters. Sincere Thanks for sharing. Onward!

@kisdia,

Really great stuff. Thanks for giving the OAK-D a try and confirming that the object avoidance issues appear not to be directly SCurve related.

I’m keen to try the OAK-D on my boat later this year and although I tried following Rishabh’s blog I didn’t get very far before getting distracted by other things.

Very nice looking rovers. It’s interesting to see that the lead vehicle at least uses the Mars Rover style steering.

I have been dying to try this S-Curves feature as it is going to make a world of difference to what we do as shallow inland water cartographers (FishTec HD Fishing Charts).
Unfortunately all our boats (AIMy) have been busy on projects so I had to build a new boat, then the horrific KZN floods hit us and as a result today was the first day to get the new boat on the water.
AIMy is a 3.2m delta design with a 2.5hp four stoke outboard motor capable of 20kph.

My first test was not great at all, but then Randy was kind enough to spare me some of his very precious time and in a video call helped get some ‘baseline’ parameters.
All I can say is “WOW!”
Thank you Randy.
I’m sure there are a lot of tweaks to fine tune it, but for now I am absolutely blown away.

Here is the log - Dropbox - 00000163.BIN - Simplify your life

5 Likes

Wow, that track looks awesome!

1 Like

@John_Easton,

Wow! fantastic track. Well done!

1 Like

Managed to get down to the dam today to test an actual mapping mission - DISASTER!!!

How is this even possible?

LOG - Dropbox - 00000020.BIN - Simplify your life

1 Like

I feel with you. I am not doing anything important with my rover, so it does not really matter, but it behaves differently everytime I take it out…

1 Like

My early days of aerial mapping with dji drones and DroneDeploy App used to be the same - I lost 4 drones from just “losing the plot”. Thank goodness they sorted that out.
It is still early days for Rover 4.3 but I’m sure dev will get there.

I’ll venture a guess that weather/surf conditions were significantly different between your previous, very clean results, and the more recent, uglier nav tracking.

It’s very possible that under calmer conditions, you were able to aggressively increase the position controller gains without penalty. I’m guessing you had a northeasterly or southwesterly wind on the subsequent run, which caused enough disturbance to set up the observed oscillation.

If the wind/weather conditions were near identical, are there other factors that changed between the two sessions? Physical changes to the vehicle, other parameters changed?

Before we simply blame the firmware, we have to look at factors that may have contributed to the observed difference in behavior.

Hey Yuri,

  • From the photo of the first test you will notice a light 5knt breeze blowing while yesterday it was dead calm so we can scratch that off the list.
  • Physically nothing was changed on the craft.
  • The only thing that was changed was an issue where the script wouldn’t run so we changed the SCR_HEAP_SIZE from 102,400 to 44,032

Another difference - your first test was nearly all sharp corners, and I’m assuming they were pivot turns, whereas the second included many shallower turns. Perhaps the pivot turn parameters are well defined but the acceleration values for shallower turn angles need some attention.

1 Like

Hi @John_Easton,

Sorry I haven’t looked at your log yet (it is “golden week” here in Japan so I’m not around as much). I’m pretty sure this is just going to be “disturbance rejection” issue. So we may need a big more P, I and maybe some D in either the turn rate controller or the position controller parameters.

I’m sure we can make it better.

1 Like

Thank you Randy, I will give it a try in the morning.

Hi @John_Easton,

Sorry again about the delay.

So I had a look and here are few suggestions:

  • reduce PSC_VEL_I and PSC_VEL_D to 0
  • reduce ATC_TURN_MAX_G from 0.6 to 0.2
  • enable vectored thrust by setting MOT_VEC_ANGLEMAX = 35 or whatever the angle between steering’s middle position and maximum position is.

This last step though could require that we re-tune the ATC_STR_RAT_FF, P and I so I’m happy to do another voice call to re-do that.

BTW, if FRAME_CLASS is set to 2 (Boat) the vehicle will switch to Loiter when it is done a mission.

1 Like

Thank you Randy, I will certainly give it another go this coming week.

1 Like

Which parameter controls the ‘path wobble’ as seen in image?