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.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
retrieving settings of pypilot
#1
Hi,
Desiring to save the gains of 'Autopilot Control', I want to know when these gains are updated in .pypilot / pypilot.conf from where I could extract them with a SED command.
Seems to me that just shutting down interfaces and reopening them isn't always enough to force this update
The only way I have found is to log out and reopen it, but this is not really usable !!
Has anyone found a way to retrieve these settings other than through pypilot.conf
Thanks for you anwers
Reply
#2
When pypilot is running, you can read and write the settings via pypilot_client. When pypilot is not running, the settings should be stored in the config file.


Why are you trying to do this? Is this for banks of gains for various sea conditions?
Reply
#3
Hi Sean,

Thank you for your quick reply,
Indeed, I made a python program that I must feed with the parameters of pypilot to store them as 'presets'. Each preset has a button that can be clicked to adjust pypilot according to the speed and state of the sea.
So far, it's been working fine, apart from recovering settings.
But with your instructions, I think I can bring this project to fruition.
I have it at your disposal if you are interested.
Reply
#4
if you are writing a python script like this, it is also possible to directly use the pypilotClient class and get/set values directly.

It could be better to implement a new pilot which performs this task. That way it would be internal to pypilot and not require an external script.
Reply
#5
Totally agree with you, but unfortunately I don't have the necessary python skills to modify your code, the subtleties of which I still have a lot of trouble understanding !! (I'm working on it).
This is why I am content to retrieve the outputs by linux commands (grep, cut, sed) to incorporate them into my little python storage script.
Reply
#6
(2021-03-12, 09:04 AM)kinefou Wrote: Totally agree with you, but unfortunately I don't have the necessary python skills to modify your code, the subtleties of which I still have a lot of trouble understanding !! (I'm working on it).
This is why I am content to retrieve the outputs by linux commands (grep, cut, sed) to incorporate them into my little python storage script.

I am very interested in your project. Great idea! Maybe you will share it once you see some working results? Lots of great programmers here (I am not one of them) maybe they would lend a hand.
Reply
#7
If it works out I can adapt it to be internal to pypilot

You intend to manually set the state, and all gains updated from that? Or you are tracking wind speed/direction and adjust the gains based on this as well as possibly accelerometer or other data like gyro frequency??
Reply
#8
(2021-03-11, 12:14 PM)kinefou Wrote: Hi,
Desiring to save the gains of 'Autopilot Control', I want to know when these gains are updated in .pypilot / pypilot.conf from where I could extract them with a SED command.
Seems to me that just shutting down interfaces and reopening them isn't always enough to force this update
The only way I have found is to log out and reopen it, but this is not really usable !!
Has anyone found a way to retrieve these settings other than through pypilot.conf
Thanks for you anwers

I made a concept for this once, but never made it operational https://forum.openmarine.net/showthread....24#pid9424. It was my first python project. The code worked against an old version of pypilot, but needs to be updated. The drawback was that it needed to run in a graphical environment, like openplotter. For a solution that would fit the pypilot vision, I'd say it would need to be a python process that runs in the background, and reads the current values from the pypilot data layer, the pypilotServer. Tricky thing for a newbie, but if I was able to pick it up, then you can do it as well. It would be nice of you make it such, that you can save the current gains under a name, and when retrieving them, select the name to write them back to pypilot.

I think you will be helped with attached skeleton code, that connects to pypilot and reports on the P, I and D gains. I've distilled it for you out of a piece of code of myself, which you might find helpful. Good luck!


Attached Files
.txt   test.py.txt (Size: 3.27 KB / Downloads: 152)
.txt   test.out.txt (Size: 1.24 KB / Downloads: 146)
Reply
#9

.zip   presets.zip (Size: 1.92 KB / Downloads: 158)
Hi Sean,

In fact, I just retrieve the values of P, I, D, DD, FR, FF and R from the lines devoted to 'basic' in the return of pypilot_client to sort them so that they correspond to the order established in pypilot and store them in an executable text file corresponding to the name given to the 'preset'. In this file, I add the commands to reintegrate them into pypilot. I do this in bash and import them by double click in a python interface which allows me to have a visual aspect.
I think this could all be done in python and be integrated into pypilot, but don't have the skills to do it yet.
I attach you the 3 necessary files (simple.py for the interface, news.sh to add a preset and del.sh to delete it) if ever that can give you a start of a track
Reply
#10

.zip   Scripts.zip (Size: 1.24 KB / Downloads: 146)
I forgot to specify that it was necessary to create a directory '/ home / pi / Scripts /' where the presets will be stored !! I am enclosing mine with 3 presets which correspond to the three 3 settings already implemented in 'simple.py '
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)