This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
automatically selecting autopilot gains
#1
Currently building my first pypilot, I understand I would still need to adjust PID-gains based on circumstances. While I welcome the possibility to do so, I'd hate having to do this. At the risk of re-inventing the wheel I made a little concept for some automation of this process. It would automatically choose between predefined, coherent sets of gains, based on signal-k parameters. Curious to hear if that would make sense and also fit in the flexible architecture, particularly in conjunction with autogain.py. For now I'm thinking about running it in openplotter, connecting to the signal-k server of tinypilot though wifi. See also https://www.youtube.com/watch?v=jHjVqeqYePg

Thx,

-
  Reply
#2
This would be a good alternate pilot to implement. Which parameters are you basing the changing gains on?
  Reply
#3
(07-08-2019, 10:12 PM)seandepagnier Wrote: This would be a good alternate pilot to implement.   Which parameters are you basing the changing gains on?

For now, it's nothing more than an idea, and the choice of parameters has been somewhat intuitive. The little video elaborates on this.

I would guess the first parameter, the point of sail, is a determining factor for the set of gains to use, as it determines where those (wind and water flow) force vectors apply to your boat. 

But especially the water pressure along the rudder (roughly equivalent to the boat speed, the second parameter) seems to me very important in choosing those gains, because it determines the effectiveness of the rudder. The rudder reacts differently at 1 knot boat speed that it does at 5 knots.

I have actually been amused by the thought of making some pitot tube at the leading edge of the rudder, to be able to dynamically react to the effect of a following sea. When a wave lifts the stern, flow along the rudder drops, and you need, but for a brief moment, big tiller input (big P, big D?) to keep the boat straight. Quickly switching to a different gainset would do this. But this is very far down the line though.

More for now, the concept does allow another process (autogain.py) to optimise the current gainset and read the optimised parameters back. I don't understand the autogain.py code yet, but I guess it throws in some random changes in the parameters to assess their effect (like in simulated annealing).

In any event, this concept would facilitate boaters themselves to experiment with the settings without having to remember what setting was good for which circumstance.

Cheers,

[Image: attachment.php?aid=477]
   
  Reply
#4
I think you are right. The obvious parameters in order:

1) apparent wind angle
2) boat water speed
3) apparent wind speed
4) seastate

Each parameter adds a dimension, so likely the gains would have to be interpolated often since new states would be found often.

The autogain.py is nothing more than a hack. It tries certain gains and a search space and logs the course error and power consumption for each setting.

Surprisingly the gains can vary over a relatively large range and still give good performance in light conditions. This works but it's a very slow way to find the best gains. By the time it does (up to an hour) usually conditions already changed.

I intend to use neural networks to provide the smartest autopilot. This means that it doesn't just steer well but learns fast. It can also use many types of input sensors together including cameras looking at waves.
  Reply
#5
We have the IMU already - I can imagine vertical acceleration + pitch forward would indicate a wave coming in from behind. What's the frequency of imu.pitch? Imu.heave could be useful then as well. Outboard sensors are more prone to failure than the IMU.
  Reply
#6
Measuring yawing and heading and applying rudder action already makes a usable autopilot in most cases.

How the autopilot can also react to pitch or accelerations to improve it's actions greatly depends on the sea state, the point of sail and many more factors. It is not just a simple factor to apply. If we can discuss the details, it would be interesting to develop.
  Reply
#7
(07-09-2019, 04:50 AM)ironman Wrote:
(07-08-2019, 10:12 PM)seandepagnier Wrote: This would be a good alternate pilot to implement.   Which parameters are you basing the changing gains on?

For now, it's nothing more than an idea, and the choice of parameters has been somewhat intuitive. The little video elaborates on this.

I would guess the first parameter, the point of sail, is a determining factor for the set of gains to use, as it determines where those (wind and water flow) force vectors apply to your boat. 

But especially the water pressure along the rudder (roughly equivalent to the boat speed, the second parameter) seems to me very important in choosing those gains, because it determines the effectiveness of the rudder. The rudder reacts differently at 1 knot boat speed that it does at 5 knots.

I have actually been amused by the thought of making some pitot tube at the leading edge of the rudder, to be able to dynamically react to the effect of a following sea. When a wave lifts the stern, flow along the rudder drops, and you need, but for a brief moment, big tiller input (big P, big D?) to keep the boat straight. Quickly switching to a different gainset would do this. But this is very far down the line though.

More for now, the concept does allow another process (autogain.py) to optimise the current gainset and read the optimised parameters back. I don't understand the autogain.py code yet, but I guess it throws in some random changes in the parameters to assess their effect (like in simulated annealing).

In any event, this concept would facilitate boaters themselves to experiment with the settings without having to remember what setting was good for which circumstance.

Cheers,

[Image: attachment.php?aid=477]

Sounds like a great idea; similar to auto ECU EFInjection fuel-map in attachment!

[attachment=482]

Is this on github?


Attached Files Thumbnail(s)
   
  Reply
#8
(07-11-2019, 08:06 PM)wdee Wrote: Is this on github?

Not yet - never done that.

 @Sean: where would you suggest I'd put it, given that, at this point, it's still a bit of ugly code underneath?
  Reply
#9
What do you have so far? It could be a separate pilot to choose from in pypilot/pilots
  Reply
#10
A bit of code says more than 1000 forum postings Smile

https://github.com/marcobergman/gainsets
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)