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
Seatalk AutoPilot Wired Remote Control
#1
I just installed a MacArthur hat on my Raspberry Pi 4B.  For software I am running OpenPlotter.  For an autohelm I have PyPilot.  I would like to get my Raymarine wired remote control to "steer" PyPilot in compass mode.

I can see the SeaTalk LED blinking on the MacArthur hat and I can find the following data in the SignalK log file:

port -1 = $STALK,1e,f7,fd,41
port -10 = $STALK,1e,f7,7e,83
stbd +1 = $STALK,1e,f7,fc,10
stbd +10 = $STALK,1e,f7,5f,08

This suggests to me that the remote control is getting data to SignalK; however, SignalK appears to just be ignoring or dropping the data.  I never see a yellow line on the summary screen like I do for any of my other inputs.

One additional observation, the log file would sometimes split the data (for example):
$STALK,1e
$STALK,f7,fd,41

If anyone can point me in the direction of where I go from here to "wire" the pieces together that would be appreciated.
Reply
#2
I am also very interested on this.

I am afraid that datagram is not included in nmea0183-signalk plugin: https://github.com/SignalK/nmea0183-sign...ks/seatalk

But I can not find it in the known datagrams either.: http://www.thomasknauf.de/rap/seatalk2.htm

There is something similar: 86 X1 YY yy Keystroke

What is your remote control model?

If we can add this datagram to nmea0183-signalk plugin, what would be the corresponding signal k key? https://signalk.org/specification/1.7.0/...ranch.html
Reply
#3
I will have to obtain the remote control model number the next time I am at the boat.

In terms of the Signal K Key, I lack the experience to provide a definitive answer but I would think that pressing the + and - autohelm keys would change the values associated with /vessels/<RegExp>/Steering/autopilot/target/headingTrue and /vessels/<RegExp>/Steering/autopilot/target/headingMagnetic. For example if the current value of the keys was 272 and 280 respectively and I pressed +10 then the new key values would be 282 and 290 respectively.
Reply
#4
The model number of the Raymarine wired autohelm remote is A15002.

I upgraded SignalK because the system offered me the opportunity to do that. Since I wanted to capture the codes for tacking port and starboard, I reran the log file for the seatalk-pigipio and much to my surprise got different values as follows:

port -1 = $STALK,86,11,05,fa
port -10 = $STALK,86,11,06,f9
stbd +1 = $STALK,86,11,07,f8
stbd +10 = $STALK,86,11,08,f7

tack port = $STALK,86,11,21,de
tack stbd = $STALK,86,11,22,dd

The good news is that this information does connect to the known datagrams at http://www.thomasknauf.de/rap/seatalk2.htm so they should be the correct ones.

The bad news is that even though I can see them in the seatalk-pigpio log file, they are not generating any data that is visible in the data browser and there is still no yellow line associated with the seatalk port. I'm guessing that is because it is not defined in https://github.com/SignalK/nmea0183-sign...ks/seatalk?
Reply
#5
Finally got this to work (mostly).

I edited the signalk seatalk java script index.js file to add a 0x86.js feature.  I then created a 0x86.js program in the same directory as the other seatalk java script code as shown below.  This code will not work with openplotter version 4 because the pypilot_client is not installed in the /usr/local/bin directory in version 4.  Using pypilot turned out to be the easiest way for me to get the current command heading value so I could add or subtract according to the function button I push.

I said this works mostly because I believe there is some basic bug in the seatalk code.  When I press the -1 button the first time nothing comes through.  On the second push of the button, the command comes through.  If I then press -10, the prior -1 command comes through.  If I press -10 a second time, then the -10 comes through.  In other words, the basic seatalk code seems to be buffering the command and it takes a second push for the first push to be sent through to my code.  I can see this when I look at the Signalk server log file for the pigpio so I don't think it is my code.  I am using the MacArthur HAT for the interface so I guess it is possible that the HAT is doing the buffering.  Unfortunately I do not have any other seatlk devices so I cannot trouble shoot the issue beyond the SignalK log file.

Here is the program code (and I'm sure those with deep java script experience could be somewhat more efficient).

/**
* Copyright 2024 Signal K <info@signalk.org> and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict'

const utils = require('@signalk/nmea0183-utilities')

/*
86  11  XX  YY        Raymarine Autohelm Wired Remote Control
                      -1  = 86 11 05 fa
                      -10 = 86 11 06 f9
                      +1  = 86 11 07 f8
                      +10 = 86 11 08 f7

                      tack port = 86 11 21 de
                      tack stbd = 86 11 22 dd
*/

module.exports = function (input) {
  const { id, sentence, parts, tags } = input

  if (parts.length != 4) {
    return null
  }

  var auto = parseInt(parts[1], 16)
  var a1 = parseInt(parts[2], 16)
  var a2 = parseInt(parts[3], 16)
  var pathValues = []

  if (auto != 0x11) {
    return null
  }

  var exec = require('child_process').exec
  const execSync = require('child_process').execSync
  var apheading = execSync('/usr/local/bin/pypilot_client ap.heading_command')
  const ahresult = '' + apheading
  var end = ahresult.length
  end--
  var start = -1
  start = ahresult.indexOf('=')
  if (start > 0) {
    start = start + 2
    var oldheading = ahresult.substring(start,end)
    var newheading = Number(oldheading)
    if (a1 == 0x05 && a2 == 0xfa) {
      newheading--
    }
    if (a1 == 0x06 && a2 == 0xf9) {
      newheading = newheading -10
    }
    if (a1 == 0x07 && a2 == 0xf8) {
      newheading++
    }
    if (a1 == 0x08 && a2 == 0xf7) {
      newheading = newheading + 10
    }
    if (a1 == 0x21 && a2 == 0xde) {
      newheading = newheading - 110
    }
    if (a1 == 0x22 && a2 == 0xdd) {
      newheading = newheading + 110
    }
    if (newheading > 359) {
      newheading = newheading - 360
    }
    if (newheading < 0) {
      newheading = newheading + 360
    }
    var nhstring = '/usr/local/bin/pypilot_client ap.heading_command='
    nhstring = nhstring + newheading
    execSync(nhstring)
  }

  pathValues.push({
    path: 'steering/autopilot/target/headingTrue',
    value: utils.transform(utils.float(newheading),'deg', 'rad'),
  })

  return {
    updates: [
    {
      source: tags.source,
      timestamp: tags.timestamp,
      values: pathValues,
    },
    ],
  }
}
Reply
#6
The MacArthur HAT has no buffer, pigpio does, but I do not think that is the cause of this effect.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)