karla

  • *****
  • 629
Advice on TPS (Thrust PID Scaling) for Yaw on boat
« on: November 17, 2018, 09:54:47 am »
Hello,

I would appreciate some advice regarding how to configure the GCS, Configuration, Stabilization, Thrust PID Scaling.

It's about a speed boat, not a quad or fixed wing or heli, so its rather an exotic question :)
From stock default settings for YAW, i put PIDs down some 30%
from 1. to 2.

1. PID = 0.0062 | 0.01 | 0.00005,
2. PID = 0.0045 | 0.007 | 0.000035
But I do not want to bring them down further.
Rather research the option to use the TPS function of LibrePilot to mitigate this problem.

There are several options to specify:


1. Source:
 a. ManualControlThrottle
 b. StabilizationDesiredThrust
 c. ActuatorDesiredThrust

What I want is the TPS to be in affect in Stabilization for AxisLock, RTB and Path follower waypoints.
What to select?
b????? its not really intuitive

2. Targets:
There are several options: P or I or D or several combinations of them, I what all PIDs to be changed,
So I chose PID - right?

3: Axis:
I just want YAW to be adjusted, so that's what i specify?

This is how it runs in Yaw Manual mode - smooth :)



This is how it runs with Yaw in AxisLock mode - oscillations :(



My goal is to have a smooth run even when apply AxisLock stabilization to Yaw at full throttle.

Thanks a lot :)
K

B t w The return to base is ll working fine now after some setting changes :)
The complete boat build is described here : https://forum.librepilot.org/index.php?topic=4483.msg30560#msg30560
« Last Edit: November 20, 2018, 06:46:57 am by karla »

Re: Advice on TPS (Thrust PID Scaling) for Yaw on boat
« Reply #1 on: November 17, 2018, 06:40:51 pm »
I think that what you have (ActuatorDesiredThrust, PID, Yaw) is what you want.

Two things to understand.

1 - If you did your PID tuning at 50% throttle and that is where PID runs well, then the sloped line should cross the center, horizontal line in the middle of the center horizontal line.  If you did your PID tuning at 25% throttle, then it should cross at 25%, closer to the left side.  This makes sense because it says that at that throttle (say 25% when going from left to right) the PIDs will not be changed (not above or below the horizontal center line).

2 - Then if you have oscillations at high throttle, you need less PID at high throttle.  That means your line needs to be steeper so that it reduces PID more at high end (and increases it more at low end).  The curve doesn't have to be a straight line, but I always start out that way and only make it un-straight if there is a reason.

One more thing is that for your case, which hasn't been tried before, you may not be able to make the line steep enough with the limits built into the GUI.  In that case, you can go into the System page (like Settings->StabilizatonSettingsBank1->ThrustPIDScaleCurve) and put in larger numbers.  I would guess that -100 would completely disable the PID, so you should not have to go that far.

Let me know whether this makes sense and if you get it fixed.

Those videos are really interesting.  :)  I hope you do a waypoint course and post a video with description of turns or side by side with GCS map telemetry display.  I hope that isn't too much video editing work.
« Last Edit: November 17, 2018, 06:46:14 pm by TheOtherCliff »

karla

  • *****
  • 629
Re: Advice on TPS (Thrust PID Scaling) for Yaw on boat
« Reply #2 on: November 18, 2018, 01:18:53 am »
Thanks Clif,
Yes, it all makes sense.
I will go ahead and try the settings shown in the picture first, then see if further changes needed.

Yes, a waypoint video is on the agenda, but the speed will be a lot lower to begin with so maybe not so interesting to watch.

Meanwhile, another question.
At first with the default settings for the boat vehicle the RTB and Position hold did not wrok (nothing happened except speed slow down)
I did some changes and now they work fine. But in retrospect I am curious what change made them work.

1. The RTB offset was set to 10 meters.
Now this is of course not relevant for a ground vehicle.
So I set it to 0.
Could the FC first have tried to increase altitude 10 meters and until that happened did not change course?
And since it never could increase altitude at all it just moved forward at slowest speed?
I have now set the Next command to Land, and hope it will shut motor off when it reaches home, don't know if it will.

2. Also changed the GroundPathFollower ThurstLimits Min, Slow and Max from -0.15, 0.15 and 0.25 to 0.15, 0.25 and 0.35.

After this, both RTB and Position hold works fine. (Pos hold makes the boat drive in a circle)

Re: Advice on TPS (Thrust PID Scaling) for Yaw on boat
« Reply #3 on: November 18, 2018, 05:02:14 am »
I haven't looked at the ground path follower code, but it could be different than other path followers and it certainly should not do anything with altitude.

I can imagine those ThrustLimits might have fixed it.  It looks like the default is slow reverse / stopped / slow forward.  I would guess that neither of the first two would work, but whether the negative would work depends on the code.

Of course you could put them back and see if the problem returns.  :)  It would be good to know for anyone wanting to do this in the future.  I vaguely recall someone trying to get this to work on a model car and it not working.

karla

  • *****
  • 629
Re: Advice on TPS (Thrust PID Scaling) for Yaw on boat
« Reply #4 on: November 20, 2018, 04:47:26 am »
Finding some answers here :)

1. Its the ThrustLimit settings that fixed the RTB and PosHold.
The In FlightModeSettings, setting the ReturnToBaseAltitudeOffset to 10meter did not change any behavior.
It seems code ignores this setting. That seems correct.
With ThrustLimits set to Min=0.1 Slow=0.25 Max=0.5 the RTB and PosHold works fine.

2. With the TPS thrust pid scaling set just as the picture in previous post, there are no yaw oscillations at full throttle and it feels nice and firm in AxisLock at all speeds.

I did one Waypoint run, some 1.5km in total length.
Some interesting findings.
Forgot to turn camera on  ::) so no onboard video coverage this time.



. The radio link disconnects at WP4 (also later around WP6 I think). It's cool how it just continues Autonomously.
. It looks like it never find WP5, 6 or 7, but that could be an effect from the disconnect so the GCS is out of sync?
. It takes a disproportionally long time to find WP8 after been at WP7. Seems confused some how.

More experiments to follow :)

karla

  • *****
  • 629
Re: Advice on TPS (Thrust PID Scaling) for Yaw on boat
« Reply #5 on: November 20, 2018, 06:05:23 am »
Quote
. It takes a disproportionally long time to find WP8 after been at WP7. Seems confused some how.



I reviewed the log file and enhanced it a bit and its more clear now why it takes long time :)
Boat is doing some 5 complete 360 turns on the way from wp7 to wp8.

p.s.
if anyone wonder why i did not see this, its becasue it was getting pitch black and I could just hear the boat :)
d.s

« Last Edit: November 20, 2018, 06:17:42 am by karla »

Re: Advice on TPS (Thrust PID Scaling) for Yaw on boat
« Reply #6 on: November 20, 2018, 12:55:27 pm »
I've seen it circle a waypoint before, but never just make 5 nice circles when travelling in a straight line from one wp to the next one.  ...and all in the same direction.

Something needs to be fixed there...  How is your mag health, especially at high throttle?  Does it need mag calibration?

Very interesting use of the FC.  :)

karla

  • *****
  • 629
Re: Advice on TPS (Thrust PID Scaling) for Yaw on boat
« Reply #7 on: November 21, 2018, 06:26:02 am »
Mag health is really good.
Calibration done fine in same area and okay.



But, how about this.
I checked my pathplanner waypoint file and the only difference with wp8 from the other 7 is that its located 15meters up.



« Last Edit: November 21, 2018, 10:29:11 am by karla »

Re: Advice on TPS (Thrust PID Scaling) for Yaw on boat
« Reply #8 on: November 21, 2018, 07:14:41 am »
ALtitude shouldn't affect it, but that is not saying much considering how little the ground path follower is probably used.

I do see at least one other loop in another leg, and it is a loop in the other direction.

Another thing that would cause it is vibration.  Have you checked your accel scope for high G vibrations?  When there is a problem, you can sometimes also see the gyro scopes reporting large motions that do not exist.  Of course when vibration is a problem, it is usually the gyros affected, and that fits the problem.

Ideally you would have no vibration G's.  When balancing quad props, I recall that it could still fly at 5 G's vibration, but it would not fly at 10 G's.  I don't recall if that was a Revo or a Sparky2, but probably a Sparky2.

I don't think that the boat smacking the water at high speed would be enough G's to cause a problem.

This is a lake without significant current in the water, right?  Wind could do the same thing.  Waves from big boat wakes.  That shouldn't cause a loop, but just throwing the idea out there.

Does the boat do anything funny when driving it manually at that speed?  Like an uncommanded turn when it hits a wave at high speed?  Regular waves ... regular loops.

I notice it does not seem to maintain a very tight course.  It is not as straight and on the exact path as it should be.  I would guess that running 5 laps of a small course would show that it varies randomly.

karla

  • *****
  • 629
Re: Advice on TPS (Thrust PID Scaling) for Yaw on boat
« Reply #9 on: November 21, 2018, 10:32:39 am »
Thanks a lot for all these ideas Cliff
This is soo much fun :)
I think I will do some changes to settings, upgrade to latest version of LP next and then re-run the exact waipoints to compare.
Anyway, it will take a little while, but thanks a lot!
best
K

karla

  • *****
  • 629
Re: Advice on TPS (Thrust PID Scaling) for Yaw on boat
« Reply #10 on: November 23, 2018, 05:59:20 am »
Yes! This works much better now!

There is nothing wrong with the GroundPathFollower. It's doing a good job.
Now pretty straight smack on to all the waypoints, no extra circles :)



I saved the settings to UAV file, upgraded to latest Next r735, imported the UAV file again without any warnings.
Only did a magnetometer calibration, but this time more careful to do it  after all LiPos, servo and ESC wires was fixed in place and the FPV cam and VTX turned on. Mag stayed solid green the whole time.
Also upgraded my 1/4 dipole to a full 1/2 wave length dipole, so this time stayed connected all the way.



I will update the post over at the show room to reflect the new situation.
https://forum.librepilot.org/index.php?topic=4483.0

Thanks a lot!


Re: Advice on TPS (Thrust PID Scaling) for Yaw on boat
« Reply #11 on: November 23, 2018, 07:06:22 am »
Not a big deal, but it looks like there is still a small horizontal oscillation on straight lines between waypoints.  Period looks like about 10+ seconds.

I would try reducing GroundPathFollowerSettings.HorizontalPosP

How far how long can it go on one battery?

karla

  • *****
  • 629
Re: Advice on TPS (Thrust PID Scaling) for Yaw on boat
« Reply #12 on: November 23, 2018, 08:09:49 am »
Haha cool  :D
I don't even know what that HorizontalPosP does?
At the moment its set at 0.2 (m/s)/m  :P


For your question: It needs two batteries to work at all.
I have 2 LiPo's 3s 5500 mAh each, connected in series so its 6S actually.
The Amp meter is not good at all, it shows far too much AMPs are used than in reality. The Volts meter is accurate though.
I think it can run some 5-10 runs (around the 8 wp's track), at least on one charge.

Re: Advice on TPS (Thrust PID Scaling) for Yaw on boat
« Reply #13 on: November 23, 2018, 09:05:20 am »
The P term of horizontal position PID.  No I or D term is coded.

karla

  • *****
  • 629
Re: Advice on TPS (Thrust PID Scaling) for Yaw on boat
« Reply #14 on: November 24, 2018, 02:26:51 am »
Aha, got it. Okay will try cut it in half and use 0.1 next time.