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
Rudder calibration not working
#11
All of the settings are stored on the controller itself. This is supposed to allow switching between controllers to work better, but I'm not sure it is handled in the best way, and it maybe needs improvement.

It seems the settings on the controller are bad and being reloaded.

Once pypilot is running, you should set the correct settings. It is lazy about writing these to the controller itself, so you might need to leave it running a while to ensure the eeprom gets updated. If you unplug the controller and wait until no controller is detected, then plug it again, it should reload all the settings from the controller.


So for example, if you change the max current to 6 amps, or any other servo setting, then unplug controller data cable, or remove power from controller right away (before eeprom can update), wait 10 seconds, then connect controller and wait for it to load again, it could reset the settings to the wrong values again and then you will know the controller had these settings.

I recently changed the format stored in eeprom of the controller. I'm not 100% sure which tinypilot image you have at this point, but this image should have fixed it:

https://pypilot.org/images/tinypilot_28062019.img.xz

Let me know if the controller is the issue, and if the above image helps and we will know what to do next. I agree this is a critical bug.
Reply
#12
Thanks Sean, seems like this must be what is happening.

It seems very strange that the tinypilot would ever READ settings from the motor controller and then write those settings to pypilot.conf. Surely it should only ever read the settings from pypilot.conf and write them to the motor controller? Maybe copying all settings from pypilot.conf to the motor controller eeprom should be part of the boot process so we can be sure everything is in sync?

After editing pypilot.conf, it seems that the changes were not being sent to the motor controller. Is there a way to force the tinypilot to write the changes to the motor controller from the current pypilot.conf, without reading any settings from the motor controller? A command I can enter after saving the conf file?

I will try to update the image when I can but I guess that means removing the pilot, taking it apart, removing the sd card, flashing the new image onto the SD card, re-doing all the edits to all the files I've changed and then putting it all back together. It's also rather big to download on my mobile data. It's very unlikely I'll have time for that before we have to sail so for the moment, I really need to just be able to save the new settings successfully down to the motor controller, ensuring all old settings are overwritten.

What I could do is pull the latest changes from git and copy just the modified files over to the pypilot using sftp over wifi. Is it possible to update it like that or is it really necessary to replace the whole sd card image?

Thanks!
Chris

PS. It seems very rare that the motor controller would be changed for one with different settings (except while you are building motor controllers!) but perhaps the motor controller could have a unique ID on it and the pypilot then only ever reads settings from the motor controller if it detects during boot up that the unique ID has changed since the last boot up? If the unique ID is unset then pypilot would set one using a random value, but not read the settings? It might be an interesting question how we get a random value seed considering the pypilots all start up with the clock set to the exact same time!
Reply
#13
(2019-07-29, 11:27 PM)syohana Wrote: Thanks Sean, seems like this must be what is happening.

It seems very strange that the tinypilot would ever READ settings from the motor controller and then write those settings to pypilot.conf. Surely it should only ever read the settings from pypilot.conf and write them to the motor controller? Maybe copying all settings from pypilot.conf to the motor controller eeprom should be part of the boot process so we can be sure everything is in sync?

It is not very strange... Consider if you upgrade the sd card image. It will erase pypilot.conf settings and they go back to default. If you connect to the motor controller, it will get the old settings for the motor this way.

Another case, is you have two motor controllers each set up for different motors with different settings.

I agree it's confusing now, and doesn't always do the best thing, but I'm not sure how to handle all cases or if it's even possible.
Quote:After editing pypilot.conf, it seems that the changes were not being sent to the motor controller.  Is there a way to force the tinypilot to write the changes to the motor controller from the current pypilot.conf, without reading any settings from the motor controller? A command I can enter after saving the conf file?

If you change the settings while pypilot is running, it will send them to the controller.

Quote:I will try to update the image when I can but I guess that means removing the pilot, taking it apart, removing the sd card, flashing the new image onto the SD card, re-doing all the edits to all the files I've changed and then putting it all back together. It's also rather big to download on my mobile data. It's very unlikely I'll have time for that before we have to sail so for the moment, I really need to just be able to save the new settings successfully down to the motor controller, ensuring all old settings are overwritten.

You can upgrade pypilot using git:
Code:
ssh tc@192.168.14.1
cd pypilot

If tinypilot doesn't have internet access, you can clone or update the pypilot repository somewhere, then from tinypilot pull it and update:
Code:
git pull user@host:pypilot  
. pypilot.build
sudo reboot

Quote:What I could do is pull the latest changes from git and copy just the modified files over to the pypilot using sftp over wifi. Is it possible to update it like that or is it really necessary to replace the whole sd card image?

Not needed to replace the image in this case, but it will only get pypilot changes, not other changes to tinypilot which is fine in this case.

Quote:PS. It seems very rare that the motor controller would be changed for one with different settings (except while you are building motor controllers!) but perhaps the motor controller could have a unique ID on it and the pypilot then only ever reads settings from the motor controller if it detects during boot up that the unique ID has changed since the last boot up? If the unique ID is unset then pypilot would set one using a random value, but not read the settings? It might be an interesting question how we get a random value seed considering the pypilots all start up with the clock set to the exact same time!

Yes, it's possible, but it would also only solve the case of modifying pypilot.conf directly. I'm not sure many users do this. Another possible case it to compare timestamp of pypilot.conf to another file and if the timestamps differ, then it could ignore the values on the motor controller knowing a user edited pypilot.conf.
Reply
#14
Hi Sean, I've not had a chance to apply the updates yet but tried again with the current version. I'm still confused about the conflicting advice. Earlier in the thread you suggested using "sv -v d pypilot" to take the pilot down before changing the pypilot.conf file.

Now the advice is the opposite:
Quote:If you change the settings while pypilot is running, it will send them to the controller.

Unfortunately neither seems to be true. No matter what I do, the bad settings just keep coming back from the motor controller and there seems to be no way to send the corrected settings TO the motor controller.

I spent a couple of hours trying to get the python scripts for calibration etc. running my my macbook in case I can use those, got a lot of the denpendencies installed but got stuck on a couple of the dependencies and ran out of time. Currently the only way I have to set the slew settings is to edit the file manually because none of the available tools seem able to do that. Maybe easier to try and get qemu set up running ubuntu but I just don't have the time at the moment.

I've not had time to apply the latest updates yet, maybe they will help.
Reply
#15
The latest pypilot plugin or opencpn has a client you should be able to change any parameter.

If you can modify the source code of pypilot you could easily disable the part where it reads the eeprom and see if this helps.

Are you sure it does this after 10 minutes? it's very strange. I really think you must update the tinypilot image, I fixed this exact problem at some point about 2 months ago.
Reply
#16
Hi Sean, I upgraded to the new SD card image and also then cloned the latest git to my laptop and used SFTP to update all the files which have changed in the last couple of months onto the pypilot. I then run setup.py to install those updates. The update seems to have worked - I can see "Degrees" on the webapp now and the motor runs much slower and smoother so i think the slew settings have actually changed successfully this time. Thanks again for all your help with this.

Unfortunately since the update I can't get any rudder feedback at all! The rudder sensor seems not to be detected. You supplied the tinypilot together with the large motor controller you built for me. Did you customise some settings or code on the tinypilot for using it with the large motor controller and/or for my 3 wire 5v rudder sensor? If so then I guess those settings have been lost when I updated the SD card image. Before that it did at least detect the rudder sensor and I was once able to calibrate it OK. Please could you let me know what settings should be changed from the default tinypilot SD card image to get a signal using my rudder sensor with the large motor controller?

I did also add a plug to the rudder sensor wire meanwhile but I checked that carefully so I think it's more likely a software issue.
Reply
#17
(2019-08-10, 10:44 AM)syohana Wrote: Hi Sean, I upgraded to the new SD card image and also then cloned the latest git to my laptop and used SFTP to update all the files which have changed in the last couple of months onto the pypilot. I then run setup.py to install those updates. The update seems to have worked - I can see "Degrees" on the webapp now and the motor runs much slower and smoother so i think the slew settings have actually changed successfully this time. Thanks again for all your help with this.

Unfortunately since the update I can't get any rudder feedback at all! The rudder sensor seems not to be detected. You supplied the tinypilot together with the large motor controller you built for me. Did you customise some settings or code on the tinypilot for using it with the large motor controller and/or for my 3 wire 5v rudder sensor? If so then I guess those settings have been lost when I updated the SD card image. Before that it did at least detect the rudder sensor and I was once able to calibrate it OK. Please could you let me know what settings should be changed from the default tinypilot SD card image to get a signal using my rudder sensor with the large motor controller?

There is really not a change to the software that would make rudder feedback work differently.

You must be sure a rudder feedback sensor is attached, or even use two equal resistors (1-10k) to ensure a reading on the yellow wire. If the voltage is too high or too low, then rudder feedback becomes disabled.

Take a look at the rudder feedback settings, rudder.scale, rudder.offset, rudder.nonlinearity etc.. you might reset these to defaults (1, 0, 0) but this is not likely the issue.
Quote:I did also add a plug to the rudder sensor wire meanwhile but I checked that carefully so I think it's more likely a software issue.

Try running just the servo code on the tinypilot to see rudder feedback output:

$ ssh tc@192.168.14.1
$ sudo sv d pypilot
$ cd pypilot/pypilot
$ python servo.py
Reply
#18
Hi sean, Thanks for the ideas. I tried the rudder sensor on my old autopilot, works fine there so nothing wrong with the sensor. Connected back to pypilot but the motor controller just seems not to detect it any more after the pypilot software update.

I noticed there are two sets of rudder configuration in the pypilot.conf file, one starting with "servo.rudder" and the other set starting with just "rudder.". Is that as it should be? which set should I revert to defaults, or both? Once I have reverted them, how do I make sure that change has been saved onto the motor controller? Is there a way to read the saved settings from the motor controller so I can check whether the .conf file has been copied over to it?

I don't think there should be any need to add resistors and things because the rudder sensing was working without additional resistors before I did the software update.

I ran the script you suggested, got this (note the "using default servo calibration" warning... is that normal?):

Code:
tc@box:/mnt/mmcblk0p2/tinypilot/pypilot/pypilot$ python servo.py
Servo Server
loading servo calibration /home/tc/.pypilot/servocalibration
WARNING: using default servo calibration!!
failed to open (u'/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0', 4800) for nmea data
connected to gpsd
arduino servo found on [u'/dev/ttyAMA0', 38400]
serialprobe success: /home/tc/.pypilot/servodevice [u'/dev/ttyAMA0', 38400]
voltage: 13.42 current 0.0 ctrl temp 20.96 motor temp False rudder pos False flags SYNC
voltage: 13.41 current 0.0 ctrl temp 20.96 motor temp False rudder pos False flags SYNC
voltage: 13.41 current 0.0 ctrl temp 20.96 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.96 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
gpsd is using device /dev/ttyUSB0
found gps on gpsd /dev/ttyUSB0
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
nmea ready for connections
listening on port 20220 for nmea connections
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC
voltage: 13.42 current 0.0 ctrl temp 20.97 motor temp False rudder pos False flags SYNC

Any ideas? Thanks!

...Also, since running the opencpn android app the max slew has gone back to 98 again and still keeps reverting to that after I edit it, even with the updated software. Is there any way at all that I can force the pypilot to save the current contents of the pypilot.conf onto the motor controller after editing it manually? I still have no way to edit the slew other than editing the .conf file manually because that option is missing in macos plugin and always goes to 98 in the android plugin. I spent a lot of time trying to get the config tools working in macos and found most of the dependencies but I'm not there yet.
Reply
#19
can you somehow measure the voltage of the yellow wire going into the controller using a meter? The output from the servo script indicates that the voltage is outside of the range.

As for pushing the changes to the servo, this happens whenever you change them when the autopilot is running. Of course editing pypilot.conf manually won't work. So I see you are stuck. You could easily modify the code in pypilot to ignore what the servo stores. I will add a boolean option to enable/disable servo from storing parameters, I think it will be useful for other cases too.
Reply
#20
Hi Sean, just to say I fixed this last problem and it was because the insulation had melted when I soldered the connector on so the yellow wire was able to touch the black one. No fault at your end! It was a while before I could find time to diagnose and fix that, but since then I have used the pypilot for a 30 hour passage across the bay of biscay with 2m quartering seas and a bit of surfing up to 12 knots (the point of sail the old autopilot really struggled with) and a couple of shorter passages too. It has performed incredibly well and I'm very impressed that without any adjustment of the gains it already outperforms the old Cetrek 619 autopilot by a huge margin. With the Cetrek I had to tweak the settings when conditos changed. The pypilot has handled a range of conditions without any change to settings (which is lucky because I have no idea how to use the gain settings!). The Cetrek was the best autopilot money could buy 20 years ago and was used on commercial vessels not just yachts. The pypilot steers a straighter course and uses a lot less power and less rudder movement to achieve it. The hydraulic pump is running quieter and smoother too.

Initially the pypilot was moving the rudders way too much - the minimum movement was a quarter of the total rudder travel. Amazingly it still steered pretty well! I was able to use the web interface to reduce the min_rudder setting from 1.0 to 0.1 and that fixed it - since then it has moved very smoothly in small steps but still responds quickly. I would suggest that a much smaller default value for that setting would be a good idea.

I'm really impressed with how well the pypilot steers.

I have been controlling it with the IR remote because none of the other interfaces are really functional for me. The web interface is sort of working but the plugin doesn't work properly on mac or android and neither do the python tools. I think the best option for now would be to focus on getting all the features of those other apps included in the web interface. The web interface will work on any device, whereas apps and plugins require multiple versions to be maintained. A fully featured web interface would ensure that all users of the pypilot have at least one working configuration and control interface, regardless of what hardware they use. The opencpn app could potentially even just put the web interface in a frame to reduce duplication of effort developing all these different UI versions?

We are planning an atlantic crossing in November so we'll be giving the pypilot a really good testing then and maybe I'll have time to do some development on the web interface along the way (though boat maintenance always comes first of course). Let me know if there's something in particular I could be of help with.

Thanks again for all your help getting me up and running.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)