2018-09-24, 01:18 PM
(2018-09-24, 08:38 AM)KolonelP Wrote: I send the following two scenteces to signal K
sendMessageFloat("Windvane","environment.wind.angleApparent",heading);
sendMessageFloat("Windvane","environment.wind.directionMagnetic",heading);
I let SignalK convert it to NMEA scenteces.
For now I do not have an anemometer so I simulated that with SignalK. Now it is shown in OpenCPN. But my heading calculation is from North not from the bow. Still have to fix the code, and enhance it with anemometer.
I use the following code to send the sentences to SignalK using python
Code:
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
SignalK = '{"updates":[{"$source":"OPserial.wind","values":['
SignalK += '{"path":"environment.wind.speedApparent","value":'+str(aws)+'}'
SignalK += ',{"path":"environment.wind.angleApparent","value":'+str(awa)+'}'
SignalK += ']}]}\n'
#print (SignalK)
sock.sendto(SignalK, ('127.0.0.1', 55559))
sock.close()
I built my sensors but i am going to change next season as mine are to clunky and heavy, I added a Var to hold the offset to the bow so it reads correctly regardless of how my sensor is orientated to the bow. true wind is a calculation.
I had some issues when i updated to stretch due to the fact that the SPI bus speed changed. So i added a line to lib_nrf24.py to explicitly set spi bus speed.. I use a NRF240l+ to transmit data to and from the masthead .
The masthead controls my anchor light and transmits wind data to the Pi, I used it because it was cheap and has very low power requirements. the down side is that it is a bit a pain to code and hard to debug. It is a work in-progress.
Code:
self.spidev.open(0, csn_pin)
# debug
self.spidev.max_speed_hz = 400000 # change for stretch
self.ce_pin = ce_pin
How did you set up the conversion in SignalK??