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 with ST4000 autohelm
#21
Ok, let me ask in another way.. since I already have an rs422 and rs232 in inventory - would it be possible to just buy this instead for isolation:
https://a.aliexpress.com/_mr245FF

I guess that could also be used in the case of connecting tx gpio directly

Kind Regards,
Peter
Reply
#22
(2020-11-28, 12:08 AM)Peter— Wrote: Ironman, don’t go an burn your st2000. I can plug an 422 adapter into my raspberry or esp32 so I don’t need to use the tx gpios

Why do I need an isolated 422 when the raymarine nmea is isolated?

To satisfy my curiosity I'd burn anything ;-) curiosity leads to knowledge.

Your enthousiasm is a dangerous thing though, at this stage ;-). You are right the ST4000 nmea-in is isolated; if you stick to outputting to it, you'll be fine. That module, though, also caters for reading from a nmea-out from some other instrument. If you venture into that in the future, you might be at risk of creating a ground loop. Spending a few bucks extra now might keep you from harm then. Hence the conservative advice.
Reply
#23
(2020-11-28, 12:10 PM)ironman Wrote:
(2020-11-28, 12:08 AM)Peter— Wrote: Ironman, don’t go an burn your st2000. I can plug an 422 adapter into my raspberry or esp32 so I don’t need to use the tx gpios

Why do I need an isolated 422 when the raymarine nmea is isolated?

To satisfy my curiosity I'd burn anything ;-) curiosity leads to knowledge.

Haha - that is true and priceless advice.

I’ll run an ordinary rs422 to my raymarine for now and test how that works out. Will try to install it before new year.

As for the NMEA sentences, are they provided by OpenCPN in the correct format or do I have to reformat it for the raymarine using node-red? Just asking to try to save some time on this and avoiding reinventing the wheel by doing my own PID controller which I could see myself ending up doing if this is too tedious.. so help is much appreciated..

Br, Peter
Reply
#24
(2020-11-28, 04:22 PM)Peter— Wrote:
(2020-11-28, 12:10 PM)ironman Wrote:
(2020-11-28, 12:08 AM)Peter— Wrote: Ironman, don’t go an burn your st2000. I can plug an 422 adapter into my raspberry or esp32 so I don’t need to use the tx gpios

Why do I need an isolated 422 when the raymarine nmea is isolated?

To satisfy my curiosity I'd burn anything ;-) curiosity leads to knowledge.

Haha - that is true and priceless advice.

I’ll run an ordinary rs422 to my raymarine for now and test how that works out. Will try to install it before new year.

As for the NMEA sentences, are they provided by OpenCPN in the correct format or do I have to reformat it for the raymarine using node-red? Just asking to try to save some time on this and avoiding reinventing the wheel by doing my own PID controller which I could see myself ending up doing if this is too tedious.. so help is much appreciated..

Br, Peter


Just dumping this data for a future reminder when I'm going to set it up:

Code:
NMEA data formats
TheST4000+ can decode the following NMEA 0183 navigation and
wind data:

Information NMEA 0183 data
Course Over Ground VTG, RMC, RMA
Speed Over Ground VTG, RMC, RMA
Cross Track Error APB, APA, RMB, XTE
Bearing to Waypoint APB, BWR, BWC, RMB
Distance to Waypoint BWR, BWC, RMB
Waypoint Number APB, APA, BWR, BWC, RMB
Apparent Wind Speed VWR, MWV
Apparent Wind Angle VWR, MWV
Speed Through Water VHW
Depth DBT
Water Temperature MTW

Note: The autopilot only decodes the last four characters of waypoint names.
This means that the last four characters of long waypoint names must be
unique for the waypoint advance function to work.

Transmitting NMEA data on SeaTalk
If the ST4000+ receives any of the NMEA data shown above, and the
equivalent data is not present on SeaTalk, it will transmit the data onto
SeaTalk to make it available to other SeaTalk instruments:
• the ST4000+ transmits depth information in the units defined by
the first page in the data page rollover
• the ST4000+ always transmits water temperature in °C . . .”

Source: NMEA GPS input to ST4000+ | YBW Forum

I hope the OpenCPN will spit these NMEA statements out. Otherwise I'll have to write a script that generates cross track errors etc..
Update: They are: https://opencpn.org/wiki/dokuwiki/doku.p..._autopilot

Br, Peter
Reply
#25
opencpn can produce and output APB and can relay any others

I have proven some time ago that the "standard" route following using cross track error is sub-optimal especially for sailing. It works but it's clearly based on what they use on aircraft where this logic was first devised so it works also on powerboats without as terrible results, but in all cases it is a bad way to follow a route.

The intention is also to go from waypoint to waypoint which is not really the same as following a route, so with cross track error logic, it can often steer the wrong correction based on cross track error near a waypoint where you will then immediately turn back the other way resulting in oversteering. the route position bearing mode in the autopilot route plugin of opencpn offers a mode where the autopilot always steers a course toward a position somewhere ahead of the boat along the route so there are no discontinuities at each waypoint, and it would in this case make the correct change, or no change at all in the above case without possibly "correcting" in a way that will result in oversteering just before a waypoint.

So as far as I'm concerned cross track error is dead and exists still because of stubborn people like the same ones who use the windows operating system or many other things that just make life more difficult and less efficient
Reply
#26
(2020-11-28, 08:15 PM)seandepagnier Wrote: opencpn can produce and output APB and can relay any others

I have proven some time ago that the "standard" route following using cross track error is sub-optimal especially for sailing.   It works but it's clearly based on what they use on aircraft where this logic was first devised so it works also on powerboats without as terrible results, but in all cases it is a bad way to follow a route.

The intention is also to go from waypoint to waypoint which is not really the same as following a route, so with cross track error logic, it can often steer the wrong correction based on cross track error near a waypoint where you will then immediately turn back the other way resulting in oversteering.   the route position bearing mode in the autopilot route plugin of opencpn offers a mode where the autopilot always steers a course toward a position somewhere ahead of the boat  along the route so there are no discontinuities at each waypoint, and it would in this case make the correct change, or no change at all in the above case without possibly "correcting" in a way that will result in oversteering just before a waypoint.

So as far as I'm concerned cross track error is dead and exists still because of stubborn people like the same ones who use the windows operating system or many other things that just make life more difficult and less efficient

Hi Sean

Thanks for the information. I can understand where you are coming from, and if I had the time I would also program my own motor controller and make a much better solution. 

But as of right now, I’m planning to buy a much bigger boat in a couple of years and that will then be the one that I’ll do much more serious project on. 

Until then, I have to thank you for the Pypilot software it’s a great tool and I’m happy that I don’t need to program my own PID controller for now. That being said, maybe one day if it get the time I would try to implement an adaptive PID controller that would allow for nearly perfect control for everyone out there and no one would need to worry about their gains etc..

Thanks for the advice on the cross track error

Br, Peter
Reply
#27
(2020-11-28, 08:15 PM)seandepagnier Wrote: opencpn can produce and output APB and can relay any others

I have proven some time ago that the "standard" route following using cross track error is sub-optimal especially for sailing.   It works but it's clearly based on what they use on aircraft where this logic was first devised so it works also on powerboats without as terrible results, but in all cases it is a bad way to follow a route.

The intention is also to go from waypoint to waypoint which is not really the same as following a route, so with cross track error logic, it can often steer the wrong correction based on cross track error near a waypoint where you will then immediately turn back the other way resulting in oversteering.   the route position bearing mode in the autopilot route plugin of opencpn offers a mode where the autopilot always steers a course toward a position somewhere ahead of the boat  along the route so there are no discontinuities at each waypoint, and it would in this case make the correct change, or no change at all in the above case without possibly "correcting" in a way that will result in oversteering just before a waypoint.

So as far as I'm concerned cross track error is dead and exists still because of stubborn people like the same ones who use the windows operating system or many other things that just make life more difficult and less efficient

Hi Sean
I disagree with you cross track error (XTE) oppinion.


For me in some occassions it was verry important to know that the AP hold an cours on XTE = 0

Two examples:

Sailing in Turcs & Caicos a few years ago the big shallow area is not completly charted/surveyed. The chart i had, did have some rutes wich where surveyed to a certain depth. It was verry important to know you where on the track as due to the little elevations of the land you had no landmarks but tidal currents so that compass stearing would have been problematic.

Sailing in Norway with all the little rocks and shallows it was verry confortable to know you where exactly on track going to/from an waypoint.

I admit it you have to pay more atention to the sails, but failing the track could have had realy bad consequences. So I realy would miss a mode that keeps XTE = 0

Save sailing
Andreas
Reply
#28
opencpn will still display the calculated XTE regardless of how the autopilot is following the route, so you still have that information. No mode ever keeps xte = 0, but all logic attempts to reduce it.

Using my improved logic in the autopilot_route_pi of "route position bearing" the autopilot more closely follows the route and the XTE is closer to 0 than before near waypoints. In between waypoints far from routes, it still does better, unless you manually tune the xte correction turn (normally fixed) then the results are basically the same.

This is my frustration: they are using a sub optimal algorithm that has discontinuities near waypoints and then people assume it's a good way to do things because it's been around a long time. so XTE is always calculated, but should be for display purposes and possibly alarms but not actual autopilot corrections, because it does not look at turns coming up, it only considers the present position and right angles of it to the route.
Reply
#29
Ok, as promised, I checked my claim wrt tying the pi's output directly to a nmea input. Also a little demo of the "route position bearing".

Note that I had to run opencpn as root to get access to the uart at /dev/ttyAMA0. Interested to hear how to run it as an unprivileged user.

https://youtu.be/5TtgoWs6RhU


Attached Files Image(s)
   
Reply
#30
(2020-11-30, 05:31 PM)ironman Wrote: Ok, as promised, I checked my claim wrt tying the pi's output directly to a nmea input. Also a little demo of the "route position bearing".

Note that I had to run opencpn as root to get access to the uart at /dev/ttyAMA0. Interested to hear how to run it as an unprivileged user.

https://youtu.be/5TtgoWs6RhU

Holy smoke it worked!!!!!!!!!!!!! You are so cool Ironman! But I’m so confused what about the inverse logic signal you were talking about?

I’ll implement this using my ESP32 on 3.3v and tx like you did. I’ll set it to pick up udp packages and print them on serial - this is amazing and I already have power there that I can use. I’ll implement OTA as well so I can make so later filtering on the esp32 if I need to optimize the routing. Any idea what baud rate the raymarine reads? Probably 9600..

Any risk of blowing the Pi or esp32?

Br, Peter

PS: many thanks for showing me the autopilot route plug-in - that will be essential for making this work well.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)