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
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
#2
https://github.com/pypilot/pypilot/issues

tensorflow error this is the learning mode.
i have developed an interest in the machine learning but i have a lot of human learning to do to be able to understand it .lol
mare liberum
  Reply
#3
(01-11-2020, 03:58 AM)CapnKernel Wrote: ...

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!
...
while motoring.  This reversal between standby and engaged is definitely a bug!

So the direction is reversed for manual mode. The current source code supports assigning the keys on the web interface.
Quote: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.
It depends on your style also and comfort. Sometimes making the autopilot steer straighter uses less power, at least on unstable courses. You can decrease the gains on naturally stable courses like upwind to save power. Many wind vane steer + or - 10 degrees when running in following seas and this is acceptable as long as the sails can stay full. The autopilot usually does better but doesn't have to.
[quote]
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
[quote]
This pilot is not at all functional yet and I don't think it produces output commands or anything. I haven't even had a chance to make trials. It should not be in the list unless you installed tensorflow so I'm surprised it was available.

Sean
  Reply
#4
(01-11-2020, 11:18 AM)seandepagnier Wrote:
(01-11-2020, 03:58 AM)CapnKernel Wrote: while motoring.  This reversal between standby and engaged is definitely a bug!

So the direction is reversed for manual mode. 

Is this intentional?  (Mind boggles)

(01-11-2020, 11:18 AM)seandepagnier Wrote:
(01-11-2020, 03:58 AM)CapnKernel Wrote: 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.

It depends on your style also and comfort.   Sometimes making the autopilot steer straighter uses less power, at least on unstable courses.

The course was nice and straight, autopilot was doing a good job.  Just that the heading was 3-4 degrees downwind of what was dialed in.

(01-11-2020, 11:18 AM)seandepagnier Wrote:
(01-11-2020, 03:58 AM)CapnKernel Wrote: On this third day, I used the LCD interface to set the autopilot type to "learning".  The result of this is that

This pilot is not at all functional yet and I don't think it produces output commands or anything.   I haven't even had a chance to make trials.   It should not be in the list unless you installed tensorflow so I'm surprised it was available.
I'm using tinypilot_30092019.img.xz, haven't done anything special.  Pressing Menu gave me a menu where the second option was "gains" and the first option was (I think) "pilots", and from that first option I chose "learning".  Sadly, this option has now gone away, but I was able to change the pilot from the web interface.  (What is basic mode, and what is simple mode?  What should I be using?)

Do you know how I can get the autopilot working again?
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)