Very cool service you offer on your website.
Hi Randy,
I managed to get the new boat in the water.
The flight plan v.s. actual path can be seen in this mission below and is as good as I can get it using the ArduPilot documentation on setup for speed, throttle and navigation.
Here is the link to the LOG - Dropbox - File Deleted
Great to see the logs, thanks.
First some issues with the speed control:
- ATC_ACCEL is at the default of 2 (m/s) which is too high and should be reduced to 0.5 (m/s). From looking at the logs in general the maximum forward/back acceleration is 0.5m/s/s but it sometimes peaks to 1m/s/s. In future tests if you find the vehicle’s acceleration is too sluggish you could increase this value back to between 0.75 and 1.0. BTW, this parameter specifies the vehicle’s max forward/backwards acceleration (or the max acceleration that you’re comfortable with). If set too high the vehicle will attempt to accelerate impossibly quickly with throttle going to 100%. If set too low the vehicle will be sluggish accelerating or decelerating.
- CRUISE_SPEED and CRUISE_THROTTLE are set to zero which means that “feed forward” is not being used for speed control and will mean the P and I terms need to do all the work. The speed tuning page here talks about how to setup an auxiliary switch to capture these values but I can guess that CRUISE_SPEED = 3.5, CRUISE_THROTTLE=25 will work.
- MOT_THR_MAX has been set to 30 (%) meaning the speed controller can never use more than 30% throttle and it bumps into this limit quite a lot which reduces the speed controller’s accuracy. It would be nice to raise this to at least 50% to give the speed controller more freedom. I suspect this was set low because of ATC_ACCEL was set too high.
- There is quite a lot of overshoot in the speed which is mostly caused by I-term build-up. I hope this will get better after the above changes are made.
Next some issues with the steering control:
- ATC_TURN_MAX_G is at the default value of “0.6” G but should probably be reduced to “0.15” G. The log shows a maximum lateral acceleration of about 1.2 m/s/s (about 0.12G). This parameter specifies the lateral acceleration limit of the vehicle… or the limit that you’re comfortable with it doing. If set too high the vehicle may attempt impossibly tight turns that it is not physically capable of. If set too low the vehicle’s turns will be too conservative and may stray off the path.
- ATC_STR_RAT_MAX is 360 deg/sec (the default) but should probably be reduced to 50 (or less). In the log of this mission we see the maximum turn rate is about 25deg/sec. So a limit of 50 is closer to reality.
- ATC_STR_ACC_MAX is 180 (deg/s/s) but should probably be reduced to 100 (twice the ATC_STR_RAT_MAX value).
- Vectored thrust isn’t being used. This boat has a gas motor that is rotated to turn the vehicle right? To enable this set MOT_VEC_ANGLEMAX to the motor’s maximum deflection from the middle position (in degrees) when the steering servo is at its maximum. So you could perhaps switch the vehicle into Manual mode, then give full rudder and measure the angle. It doesn’t actually need to be perfect but in any case I suspect this will significantly improve steering accuracy.
- ATC_STR_RAT_FF is too low at 0.1. I suspect it should be more like 0.8 but the change to using vectored thrust means we probably need to do another test before we can see what works. The turn-rate-tuning wiki page has advice on how to tune this parameter in real time. Below is a screen shot of the desired vs actual turn rate and we can see that the actual turn rate is massively underperforming.
I hope this helps, I’m very very happy to look at another log if you do another test because I’m sure we can greatly improve this vehicle’s tuning.
Wow, I can’t wait to test the boat. Thank you so much for this Randy.
Rather than making all the changes at once, I’m going to start with step 1 and test same mission:
Step 1
ATC_ACCEL_MAX changed from 2 to 0,5
CRUISE_SPEED changed from 0 to 3,5
CRUISE_THROTTLE changed from 0 to 25
MOT_THR_MAX changed from 30 to 50
Step 2
ATC_TURN_MAX_G change from 0,6 to 0,15
Step 3
ATC_STR_RAT_MAX change from 360 to 50
Step 4
ATC_STR_ACC_MAX change from 180 to 100
Step 5
MOT_VEC_ANGLEMAX change from 0 to 21
Step 6
ATC_STR_RAT_FF change from 0,1 to 0,8
Massive improvement, but still needs some tweaks.
Link to LOG - Dropbox - 00000059.BIN - Simplify your life
Step 1 and 5 made a big difference.
ATC_ACCEL_MAX changed from 2 to 0,5 [EDIT] I just noticed that this was still on 2, must have forgotten to write when I made the change.
CRUISE_SPEED changed from 0 to 3,5
CRUISE_THROTTLE changed from 0 to 25
MOT_THR_MAX changed from 30 to 50
MOT_VEC_ANGLEMAX change from 0 to 21
Step 2 of 0,6 to 0,15 did not work at all so I changed it to 1,6 and that made a further improvement
ATC_TURN_MAX_G changed from 0,6 to 1,6
Step 3 & 4 was really bad so I went back to 360 and 180 and restarted the mission.
Step 6 also made a difference and think some more tweaking here as well as waypoint radius could make a difference.
ATC_STR_RAT_FF change from 0,1 to 0,8
WP_RADIUS = 15
WPT_RADIUS of 15m
WPT A:-
Rating 5/10 - Fair
It is turning about 5m early then taking up to 45m to get back on track and is pretty consistent in all 4 passes
WPT B:
Rating 5/10 - Fair
Same issue as A but passes 2-4 there seems to be quite a bit of drifting off the path prior to the turn.
WPT C:
Rating 3/10 - Poor
Similar issue as A and B but never seems to get back on track before the next wtp.
I believe reducing the WPT_RADIUS to 10 or less will improve the turns on these obtuse angles, but worries me as to what will happen on an acute angle.
WPT D:
Rating 3/10 - Poor
This waypoint never stood a chance as the craft hadn’t recovered from wpt C
WPT E:
Rating 6/10 - Good
This is the first acute angle wpt
Passes 1 and 4 have a slight glitch but passes 2 & 3 are GOOD
WPT F:
Rating 6/10 - Good
Another acute angle wpt
Pass 1 I would rate at 9/10 Very Good, but passes 2-4 drop the ball slightly
WPT G:
Rating 6/10 - Good
Almost a right angle wpt
A slightly lower WPT_RADIUS of 10 I believe will sort this out but the sacrifice will be a tight acute angle wpt.
I think your boat is probably coasting quite a bit into the turns, so let’s try telling the autopilot to expect that.
Have a play with ATC_DECEL_MAX vs WP_RADIUS.
If you decrease the ATC_DECEL_MAX value below ATC_ACCEL_MAX, maybe you could use a tighter WP_RADIUS.
Hi Yuri,
These are my current settings -
ATC_DECEL_MAX = 0
ATC_ACCEL_MAX = 0,5
WP_RADIUS = 15
I also noticed I have my TURN_RADIUS at 10m but the craft can’t achieve that as it only gets 16m to starboard and 17m to port.
EDIT - my mistake - I thought you had a pivot capable boat.
Anyway, try ATC_DECEL_MAX of 0.5 to 1.5 and see if you can get more consistent results.
I will give it a try thank you
See my edit above. WP_RADIUS of 2m with a turn radius that large probably won’t help.
Your turn diameter is 16-17m, so your target WP_RADIUS should be 8.5m. 10 is close!