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
PyPilot works for me!
#1
I've been slowly working on building a PyPilot autopilot for a few months.  I wanted it for a sailing tour I'm on at present of locations within Melbourne Australia's Port Phillip Bay.  My approach has been to test each part of the system in turn, but like @McNugget says in his Hackaday project, I also found it hard to get the info about how to wire things. Last Sunday I finally got all the parts hooked up:

   

This autopilot is to replace an old Autohelm 3000, and I'm using the connectors and motor from that unit.  I'm also using an adjustable CV/CC module I bought on AliExpress to convert and filter the 12V down to 5V, and a TVS across the motor terminals.  The motor driver is a VNH5019 I bought online, which hasn't had any of the problems I found in the VNH20SP30s I've bought.  I didn't need to change motor.ino.  For minimal protection (I'll improve this) I'm using a 5A circuit breaker with a blade fuse form factor.  The keypad is one I found online, and I'm connecting the RPi and nano via a USB cable (will use an opto for my next version).

My approach is to make something as simple and "ghetto" as possible, and leave making something rugged or protected until the next version.  That way I can test and learn things earlier.

After some electrical testing to make sure the RPi and nano were working properly, I set about putting all the electronics into a sealed lunchbox (I held it under water and there are no bubbles, and no water gets in).  Everything is held vaguely in place with hot glue and some cable ties.  For better or worse, hot glue bonds to new plastic are not hard to break, but they only have to last long enough to show the unit works.

]    

After powering up the unit and confirming that the RPi works, that I can connect to it with my phone, and that the left and right buttons work (motor gets driven ok, drive current around 800mA), I mounted the unit on my boat and did the compass calibration.  This went fine, and heading has been stable and reliable over the past week.  However once I started sailing and enabled, I found to my surprise that the motor commands are reversed when in autopilot mode, which is also what @McNugget found:

Quote:I had the suspicion that my rudder command might go into the wrong direction. And sure enough, even though the buttons for "go a little port" or "go a little starboard" were functioning at the dock, the moment I started using the automatic course keeper, the boat always steered in the wrong direction!

At this moment I had started my journey, so I wasn't able to return to the dock (this has been a just-in-time project!), and so I wasn't able to try out the autopilot on the first day.  However at the end of the first day I swapped the motor output wires on the driver board, and the next day the autopilot worked fine in calm seas while motoring.  This reversal between standby and engaged is definitely a bug!

   

On the second day we sailed on a beam reach, and the autopilot did a good job of holding course with minimal input.  It had the tendency to stop a few degrees short of the desired heading, so I raised the P and D values, which seems to have helped.

On the third day we had a following sea, and the autopilot did very nicely, with it working the helm noticeably less than I was in the circumstances.  So that's good results in three different sea states.

On this third day, I used the LCD interface to set the autopilot type to "learning".  The result of this is that while the autopilot can be engaged, no motor commands get sent - the boat just gets further and further off course.  What's worse is that even switching the autopilot type back to "simple" or "basic" doesn't improve things: The autopilot never moves the motor.  I also tried a power cycle.  It's not a hardware problem though, as the left and right buttons still move the motor when in standby mode.  Not sure what's going on here, but this also seems like a bug, and one that leaves you without a working autopilot.  My guess is that choosing "learning" mode puts something in the config that upsets all modes.  I'll diff the SD card against the original files on my computer and see what I find.  Suggestions welcome!

All in all, I'm simply delighted that the project exists, that it's open source, and that in practice it works as well as it does.  A huge shout out to @seanepagnier (and other contributors) for all the hard work!
Reply


Messages In This Thread
PyPilot works for me! - by CapnKernel - 2020-01-11, 08:58 AM
RE: PyPilot works for me! - by jim321 - 2020-01-11, 12:34 PM
RE: PyPilot works for me! - by seandepagnier - 2020-01-11, 04:18 PM
RE: PyPilot works for me! - by CapnKernel - 2020-01-11, 11:57 PM
RE: PyPilot works for me! - by Nee-Wom - 2020-01-25, 06:11 PM
RE: PyPilot works for me! - by CapnKernel - 2020-01-23, 11:51 AM
RE: PyPilot works for me! - by McNugget - 2020-01-23, 11:06 PM
RE: PyPilot works for me! - by seandepagnier - 2020-01-24, 12:48 AM
RE: PyPilot works for me! - by seandepagnier - 2020-01-25, 07:35 PM
RE: PyPilot works for me! - by Nee-Wom - 2020-01-25, 08:41 PM
RE: PyPilot works for me! - by marinopi - 2020-02-14, 08:28 AM
RE: PyPilot works for me! - by Opie91 - 2020-02-18, 02:12 AM
RE: PyPilot works for me! - by CapnKernel - 2020-02-21, 01:43 AM
RE: PyPilot works for me! - by Opie91 - 2020-02-21, 02:49 AM
RE: PyPilot works for me! - by CapnKernel - 2020-02-22, 11:26 PM
RE: PyPilot works for me! - by seandepagnier - 2020-02-18, 02:14 AM
RE: PyPilot works for me! - by Opie91 - 2020-02-18, 02:19 AM
RE: PyPilot works for me! - by seandepagnier - 2020-02-18, 03:48 AM
RE: PyPilot works for me! - by Opie91 - 2020-02-18, 03:54 AM
RE: PyPilot works for me! - by HugoG - 2020-04-03, 02:45 PM
RE: PyPilot works for me! - by HugoG - 2020-04-03, 07:14 PM
RE: PyPilot works for me! - by topodom - 2020-12-14, 08:34 AM
RE: PyPilot works for me! - by seandepagnier - 2020-12-14, 05:07 PM
RE: PyPilot works for me! - by topodom - 2020-12-15, 08:53 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)