Giter VIP home page Giter VIP logo

Comments (13)

honigwald avatar honigwald commented on May 30, 2024 1

Hi @amotl
I see you had some time today to dive into the code. Thanks a lot for your awesome work.
The fix I did in my environment was more or less a bit hacky, so I'm happy and looking forward for the new release :)

Cheers,
Simon.

from calypso-anemometer.

amotl avatar amotl commented on May 30, 2024 1

Hi Simon,

excellent - thank you for reporting back. Let's close this issue then, and discuss the other malfunctions at GH-27?

Cheers,
Andreas.

from calypso-anemometer.

amotl avatar amotl commented on May 30, 2024

Dear Simon,

thank you for writing in.

I was able to use this project to connect my Calypso to my Signalk-Server / Openplotter-project.

Excellent!

The problem was [...]. I changed in model.py and now everything is working fine.

Can you tell me what exactly has been changed?

I suggest to change that in the repo for other people who want to use that.

I will be happy to consider it on the next iteration. Thank you already!

With kind regards,
Andreas.

from calypso-anemometer.

honigwald avatar honigwald commented on May 30, 2024

If you like, I can try to create a PR that you can see my changes. I still was tinkering around, but the current result is sufficient enough

from calypso-anemometer.

amotl avatar amotl commented on May 30, 2024

Sure, patches are always welcome! Thank you for your efforts already.

from calypso-anemometer.

amotl avatar amotl commented on May 30, 2024

Hi again,

@UserMacUseface just reported a similar observation over at #12 (comment) when using the SignalK telemetry adapter. It looks like SignalK actually expects all angle values to be in Radians. Is that an universal truth we may well have missed in our original implementation?

With kind regards,
Andreas.

from calypso-anemometer.

amotl avatar amotl commented on May 30, 2024

If my assumption is correct, the patch would need to go to the SignalK telemetry adapter file.

self.items = [
SignalKDeltaItem(path="environment.outside.temperature", value=reading.temperature),
SignalKDeltaItem(path="environment.wind.angleApparent", value=reading.wind_direction),
SignalKDeltaItem(path="environment.wind.speedApparent", value=reading.wind_speed),
SignalKDeltaItem(path="navigation.attitude.roll", value=reading.roll),
SignalKDeltaItem(path="navigation.attitude.pitch", value=reading.pitch),
SignalKDeltaItem(path="navigation.attitude.yaw", value=reading.compass),
SignalKDeltaItem(path="navigation.headingMagnetic", value=reading.compass),
# TODO: Improve `path` naming.
SignalKDeltaItem(path="electrical.batteries.99.name", value=self.source),
SignalKDeltaItem(path="electrical.batteries.99.location", value=self.location),
SignalKDeltaItem(path="electrical.batteries.99.capacity.stateOfCharge", value=reading.battery_level),
]

While we discovered at #12 (comment) that the compass heading angle also got tripped by this conversion flaw, I am also wondering about the other angle values pitch and roll?

from calypso-anemometer.

amotl avatar amotl commented on May 30, 2024

It looks like SignalK actually expects all angle values to be in Radians. Is that an universal truth we may well have missed in our original implementation?

The documentation at 1 clearly states all relevant angle values use rad (Radian) as unit. Apologies that we missed this. We will submit a corresponding fix and release a new version.

Footnotes

  1. https://signalk.org/specification/1.7.0/doc/vesselsBranch.html

from calypso-anemometer.

amotl avatar amotl commented on May 30, 2024

The code at 1 clearly shows it is using the degreesToRadians() method to provide the correct unit to SignalK. We missed to follow this implementation correctly. Apologies.

const model = {
  windAngleApparent: this.degreesToRadians(windAngleApparent),
  windSpeedApparent: buf.readUInt16LE(0) / 100,
  batteryLevel: parseFloat(((buf.readUInt8(4) * 10) / 100).toFixed(2)),
  temperature: this.celciusToKelvin(buf.readUInt8(5) - 100),
  roll: this.compass === 0 ? null : this.degreesToRadians(buf.readUInt8(6) - 90),
  pitch: this.compass === 0 ? null : this.degreesToRadians(buf.readUInt8(7) - 90),
  compass: this.compass === 0 ? null : this.degreesToRadians(360 - buf.readUInt16LE(8)),
  timestamp: new Date().toISOString()
}

# Apply adjustments.
reading = cls(
wind_speed=wind_speed / 100.0,
wind_direction=wind_direction,
battery_level=battery_level * 10,
temperature=temperature - 100,
roll=roll - 90,
pitch=pitch - 90,
compass=360 - compass,
)

Footnotes

  1. https://github.com/decipherindustries/signalk-calypso-ultrasonic/blob/e49b9181e8c524f306d447d7cab3706bfb0f7bdf/lib/calypso-ultrasonic.js#L417-L426

from calypso-anemometer.

amotl avatar amotl commented on May 30, 2024

Observations

Other than the missed degreesToRadians() conversion, there is also:

  • windSpeedApparent = raw / 100
  • batteryLevel = parseFloat(((raw * 10) / 100).toFixed(2))
  • temperature = celciusToKelvin(raw - 100)

Analysis

  • windSpeedApparent is already converted correctly.
  • batteryLevel needs to be divided by 100, probably to get a percentage value, and then rounded to two decimal digits.
  • temperature needs to be converted to Kelvin, also reflected by 1.

Footnotes

  1. https://signalk.org/specification/1.7.0/doc/vesselsBranch.html

from calypso-anemometer.

amotl avatar amotl commented on May 30, 2024

GH-20 will bring in corresponding fixes for the SignalK telemetry adapter. Thank you again for reporting this! We will add a few other improvements before running a new release.

from calypso-anemometer.

amotl avatar amotl commented on May 30, 2024

Dear Simon,

we just released calypso-anemometer 0.6.0, including the corresponding improvements, and will be happy to hear back from you about its outcome on this matter.

When using the SignalK telemetry variant, other than correcting the angle values to be emitted in Radian (rad), the program will now also emit the temperature in Kelvin, and the battery level as a ratio/percentage, like signalk-calypso-ultrasonic.

With kind regards,
Andreas.

from calypso-anemometer.

honigwald avatar honigwald commented on May 30, 2024

Thanks a lot Andreas for your great work!
I did a quick test with the new vesion 0.6.0 and can confirm, that the values for AWA are provided in the correct format (RAD) now.
Nevertheless the eCompass (Yaw/Heading, Pitch, Roll) and the Temperature don't provide any readings.
image

from calypso-anemometer.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.