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
Resetting pypilot to previous settings
On tinypilot, I'm trying to revert the pypilot settings to a previous state, by reverting the file pypilot.conf while the pypilot service is down. I'm surprised to see that this does not seem to work. What am I doing wrong?

In short:
sudo sv stop pypilot
cp -f pypilot.conf.bak pypilot.conf
sudo sv start pypilot

I'm testing with servo.gain, resetting it from 1.8 back to 1.0, but pypilot seems to remember the setting from somewhere else. More detailed:

tc@box:/mnt/mmcblk0p2/.pypilot$ cat pypilot_client.conf
tc@box:/mnt/mmcblk0p2/.pypilot$ pypilot_client servo.gain
servo.gain = 1.8
tc@box:/mnt/mmcblk0p2/.pypilot$ grep servo.gain *
tc@box:/mnt/mmcblk0p2/.pypilot$ sudo sv stop pypilot
ok: down: pypilot: 0s
tc@box:/mnt/mmcblk0p2/.pypilot$ cp -f pypilot.conf.bak pypilot.conf
cp: overwrite 'pypilot.conf'? y
tc@box:/mnt/mmcblk0p2/.pypilot$ grep servo.gain *
tc@box:/mnt/mmcblk0p2/.pypilot$ sudo sv start pypilot
ok: run: pypilot: (pid 5469) 0s, normally down
tc@box:/mnt/mmcblk0p2/.pypilot$ pypilot_client servo.gain
servo.gain = 1.8
tc@box:/mnt/mmcblk0p2/.pypilot$ grep servo.gain *
I tried to reproduce this, but I get a different result. If you stop pypilot and edit pypilot.conf, then start again, it uses the new settings.

How did you change the gain to 1.8? Is another process running? I would like to reproduce this.
(2021-07-15, 05:23 PM)seandepagnier Wrote: How did you change the gain to 1.8?

I did not - that's why I'm confused.

(2021-07-15, 05:23 PM)seandepagnier Wrote: Is another process running?

When I stop pypilot with sv, and run ps -ef|grep pypilot, I can see that the python processes stop - the services are still visible but I guess that's a tinycore quirk. BTW I have also tried explicitly shutting down pypilot_web and pypilot_web services along. I can see that when the last process is closed, the timestamp on pypilot.conf if updated.

Isn't there some settings stored in eeprom, or is it possible that it reads it back from the running arduino?
yes, for servo settings such as gain it reads it back from the arduino on the servo, so this must be what is happening. This allows you to switch motor controllers and retain some of those settings.

You can disable this feature by setting
servo.use_eeprom to False
Aha. So I just chose the wrong parameter to test with. Good to know. I found it in the code now and although I have only one motor controller, I'll leave that use_eeprom as it is. The reason I want to revert to previous settings is the compass calibration, that sometimes gets messed up when I leave it autocalibrating while it is swung away (compass integrated in tiller pilot). Thx!

While I'm at it, any reason why pypilot_client would be slow in initiating a connection? I've removed pypilot_client.conf. Continuous use (-c) is ok, but still this type of lead time:

tc@box:~$ time pypilot_client imu.heading
imu.heading = 187.541
real    0m 9.96s
user    0m 7.07s
sys    0m 0.13s
There is a setting to lock the compass calibration you should use if the compass is mounted on something that moves (or if you sail around lots of metal like in bridges)

pypilot_client is slow on the tinycore itself. I have not gotten around to fixing this, but it has to do with the invocation script. If you did instead:

cd pypilot/pypilot

it should work faster. On another machine not a pi zero, it is much faster. It could be even faster probably.. I did not optimize it.
Yes I already automatically set imu.compass.calibration.locked to true when I put the pypilot in standby, but sometimes there are situations where you have to yank off the pilot from the helm for some sort of evading action, and when you then forget to put the pypilot in standby it continues autocalibrating in the wrong position, thereby messing up the calibration.

Indeed all the console scripts on tinycore seem to have the same issue, but that's not a big issue really.


For future reference, I updated the workbook with the information about the EEPROM parameters

Forum Jump:

Users browsing this thread: 1 Guest(s)