Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attitude sensor #27

Open
macjl opened this issue Sep 28, 2023 · 1 comment
Open

Attitude sensor #27

macjl opened this issue Sep 28, 2023 · 1 comment

Comments

@macjl
Copy link

macjl commented Sep 28, 2023

Hello,

Do you think the Ruuvi acceleration sensors could be used to provide attitude (yaw, pitch, roll) informations to signalk ?

@macjl
Copy link
Author

macjl commented Sep 29, 2023

I created a "signalk-derived-data" calculation that may work. maybe this could be integrated directly in this plugin ?

module.exports = function (app, plugin) {
  return {
    group: 'heading',
    optionKey: 'attitude',
    title:
      'Attitude Yall, Pitch (based on environment.inside.mainCabin.acceleration[X,Y,Z])',
    properties: {
      correctRoll: {
        type: 'number',
        title: 'Correction of roll',
        default: 0
      },
      correctPitch: {
        type: 'number',
        title: 'Correction of Pitch',
        default: 0
      }
    },
    derivedFrom: [
      'environment.inside.mainCabin.accelerationX',
      'environment.inside.mainCabin.accelerationY',
      'environment.inside.mainCabin.accelerationZ'
    ],
    calculator: function (accelerationX, accelerationY, accelerationZ) {
        var correctPitch = plugin.properties.heading.correctPitch
        var correctRoll  = plugin.properties.heading.correctRoll
        var pitch = correctPitch / 57.29578 + Math.asin( accelerationX / Math.sqrt( accelerationX^2 + accelerationY^2 + accelerationZ^2 ))
        var roll  = correctRoll  / 57.29578 + Math.asin( accelerationY / Math.sqrt( accelerationX^2 + accelerationY^2 + accelerationZ^2 ))
      return [
        {
          path: 'navigation.attitude',
          value: {
                pitch: pitch,
                roll: roll
                }
        }
      ]
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant