Hi, I’m working on a new boat. It’s a catamaran with skid steer mode. It use two T-100 thruster from bluerobotics, a pixhawk 1 with M8N GPS.
I have some problem tuning turn rate controller in acro mode and pivot turn in auto mode.
I attached a log file: https://drive.google.com/file/d/1rHVQJcsi0MPFwJpbYLavwi0fH8OHi5cr/view?usp=sharing
Is a long file because I spend a couple of hour trying to tune the controllers. Maybe the last minutes will be useful for analysis.
The first question is in this other post: How DESIRED TURN RATE works? - #2 by rmackay9
I open this other post in order to get some help with the tuning process.
The turn rate tune looks pretty OK but I think the feedforward is too high. The reason I think so is at the end of the log when it is in Auto mode the actual turn rate seems to be overshooting
Also if we look at the individual contributions of FF, P and I we can see that P and I are moving in the opposite direction of FF. So they’re fighting back against the overshoot.
It’s not bad but it’ll probably work a little better if ATC_STR_RAT_FF is reduced by about 20%. I think the final value you chose was maybe 0.5? So perhaps try 0.4.
Often it is good to reduce these parameters from their defaults:
ATC_ACCEL_MAX : reduce from 2 to 1 or 1.5 (this is the maximum forward back acceleration)
ATC_TURN_MAX_G: reduce from 1 to 0.6 or even 0.3 (this is the maximum lateral acceleration).
ATC_STR_ANG_P: reduce from 2.5 to 1.5 (this affects the pivot turn controller)
Ah, ATC_STR_ACC_MAX is set really low at 5 (deg/sec). This should be at least as high as the ATC_STR_RAT_MAX (which is 30)
ACRO_TURN_RATE should always be no higher than ATC_STR_RAT_MAX. It’s currently 90 but might as well reduce it to 30.
I set:
ACRO_TURN_RATE: 90
ATC_STR_RAT_MAX: 90
because the boat is capable of 150 deg/sec in manual mode.
ATC_STR_ACC_MAX: 90 and now I can make tight turns in ACRO mode. I mean, desired turn rate is more responsive to RC commands.
ATC_STR_ANG_P: 1.5 → in order to reduce de desired turn rate in Auto mode when reach a WP and need to correct heading to the next WP.
ATC_TURN_MAX_G: 0.6 I’m not sure what “lateral acceleration” is, but this low values reduce overshoot on pivot turn.
All my WP are around 90º one of each other so it always turn using pivot turn. So I adjust:
WP_PIVOT_ANGLE: 30
WP_PIVOT_RATE: 15 → I don’t want overshoot on pivot turns so I make them at low turn rate
Then:
WP_OVERSHOOT: 0.5
WP_RADIUS: 1
WP_SPEED: 0.5
I think I need to lower TURN_RATE_FF a little more:
Looking pretty good. Yes, I agree that ATC_STR_RAT_FF should go even lower. I think maybe as low as 0.33.
Re ATC_TURN_MAX_G (aka “lateral acceleration”) this limits the output from the high level navigation controller (aka “L1 controller”). The L1 controller outputs an acceleration back towards the line between the waypoints. lateral acceleration is then converter to a desired turn rate (using the vehicle’s current speed).
I wouldn’t reduce WP_OVERSHOOT too much. It maybe seems like it would help improve accuracy (and it might) but setting it too low tells the autopilot to reduce forward speed if the vehicle strays more than this distance from the line. So if WP_OVERSHOOT is set too low then the vehicle will end up slowing down all the time.
By the way, after you get your vehicle driving well, if you’re interested we have an S-Curve enhancement that I need help testing (I can provide a binary for your autopilot). No pressure though of course.