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
[SOLVED] navigation.headingMagnetic issues
#1
Hi everyone,

I have installed an MPU-9255 sensor.
i am working on a red node dasboard to read the values with an internet browser.

I am able to pipe and read navigation.attitude.roll and navigation.attitude.pitch.
but impossible to do the same with navigation.headingMagnetic. When i check the values with openplotter diagnostic SignalK input windows, the sensor is sending values.

So it seems the issue is between signal K and red node.
Any idea ?

below is my code for the red node fonction :

Code:
var signalk_key="navigation.headingmagnetic";

if(msg.payload.hasOwnProperty(signalk_key)){
    msg.payload=msg.payload[signalk_key];
    return msg;
}


then i use a UI_text
with {{value}} in the value format filed

thanks !
Reply
#2
(2018-01-22, 10:00 PM)topodom Wrote: Hi everyone,

I have installed an MPU-9255 sensor.
i am working on a red node dasboard to read the values with an internet browser.

I am able to pipe and read navigation.attitude.roll and navigation.attitude.pitch.
but impossible to do the same with navigation.headingMagnetic. When i check the values with openplotter diagnostic SignalK input windows, the sensor is sending values.

So it seems the issue is between signal K and red node.
Any idea ?

below is my code for the red node fonction :

Code:
var signalk_key="navigation.headingmagnetic";

if(msg.payload.hasOwnProperty(signalk_key)){
    msg.payload=msg.payload[signalk_key];
    return msg;
}


then i use a UI_text
with {{value}} in the value format filed

thanks !


Tried a change node and jsonata? They can be handy as you can put in a temporary debug node then copy what's coming in and paste it into the test tab to make sure what is going out is what you want. Also, I'm slowly going over to putting everything into global variables as it comes in , then it's easier to get to the data anywhere else in node red. For UI text just set an inject node to send the global variable to a text node. 

Probably a neater way to do this but it might give an idea >>

Code:
[
   {
       "id": "67b79641.1fad68",
       "type": "websocket in",
       "z": "749e8283.293f4c",
       "name": "SignalK input",
       "server": "fc1b2b62.0b63a8",
       "client": "",
       "x": 90,
       "y": 80,
       "wires": [
           [
               "20af45d9.7fe30a"
           ]
       ]
   },
   {
       "id": "20af45d9.7fe30a",
       "type": "json",
       "z": "749e8283.293f4c",
       "name": "",
       "pretty": false,
       "x": 90,
       "y": 240,
       "wires": [
           [
               "8b385a5c.b0c248",
               "2c398bd9.039814",
               "10608140.97117f",
               "a828164d.3005a8"
           ]
       ]
   },
   {
       "id": "10608140.97117f",
       "type": "switch",
       "z": "749e8283.293f4c",
       "name": "",
       "property": "payload.updates.values.path",
       "propertyType": "jsonata",
       "rules": [
           {
               "t": "eq",
               "v": "propulsion.engine.temperature",
               "vt": "str"
           },
           {
               "t": "eq",
               "v": "propulsion.alt.temperature",
               "vt": "str"
           },
           {
               "t": "eq",
               "v": "propulsion.exh.temperature",
               "vt": "str"
           },
           {
               "t": "eq",
               "v": "environment.outside.pressure",
               "vt": "str"
           },
           {
               "t": "eq",
               "v": "electrical.batteries.MainBank.voltage",
               "vt": "str"
           }
       ],
       "checkall": "true",
       "outputs": 5,
       "x": 250,
       "y": 140,
       "wires": [
           [
               "f9de7f8e.d11f9"
           ],
           [
               "ac6fa817.c672c8"
           ],
           [
               "7f2db92c.1b0ad8"
           ],
           [
               "a1aa7569.769a28"
           ],
           [
               "9d158a2f.8b5da8"
           ]
       ]
   },
   {
       "id": "f9de7f8e.d11f9",
       "type": "change",
       "z": "749e8283.293f4c",
       "name": "Set Global.eng",
       "rules": [
           {
               "t": "set",
               "p": "eng",
               "pt": "global",
               "to": "$round($number(payload.updates.values.value) - 273.15,2)",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 420,
       "y": 60,
       "wires": [
           []
       ]
   },
   {
       "id": "ac6fa817.c672c8",
       "type": "change",
       "z": "749e8283.293f4c",
       "name": "Set Global.alt",
       "rules": [
           {
               "t": "set",
               "p": "alt",
               "pt": "global",
               "to": "$round($number(payload.updates.values.value) - 273.15,2)",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 420,
       "y": 80,
       "wires": [
           []
       ]
   },
   {
       "id": "7f2db92c.1b0ad8",
       "type": "change",
       "z": "749e8283.293f4c",
       "name": "Set Global.exh",
       "rules": [
           {
               "t": "set",
               "p": "exh",
               "pt": "global",
               "to": "$round($number(payload.updates.values.value) - 273.15,2)",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 420,
       "y": 100,
       "wires": [
           []
       ]
   },
   {
       "id": "a1aa7569.769a28",
       "type": "change",
       "z": "749e8283.293f4c",
       "name": "Set Global.pres",
       "rules": [
           {
               "t": "set",
               "p": "pressure",
               "pt": "global",
               "to": "\t$number(payload.updates.values.value) ? $number(payload.updates.values.value) : \"\"",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 420,
       "y": 120,
       "wires": [
           []
       ]
   },
   {
       "id": "9d158a2f.8b5da8",
       "type": "change",
       "z": "749e8283.293f4c",
       "name": "Set Global.battVolts",
       "rules": [
           {
               "t": "set",
               "p": "battVolts",
               "pt": "global",
               "to": "$number(payload.updates.values.value) ? $number(payload.updates.values.value) : \"\"",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 440,
       "y": 140,
       "wires": [
           []
       ]
   },
   {
       "id": "9bc5cb83.05d3f8",
       "type": "inject",
       "z": "749e8283.293f4c",
       "name": "",
       "topic": "",
       "payload": "eng",
       "payloadType": "global",
       "repeat": "1",
       "crontab": "",
       "once": false,
       "x": 830,
       "y": 80,
       "wires": [
           [
               "d652486c.7ed398",
               "f66f5fb8.176a1"
           ]
       ]
   },
   {
       "id": "f66f5fb8.176a1",
       "type": "ui_gauge",
       "z": "749e8283.293f4c",
       "name": "EngTempGauge",
       "group": "3bc70d31.720c02",
       "order": 1,
       "width": "3",
       "height": "4",
       "gtype": "gage",
       "title": "Engine temperature",
       "label": "Deg C",
       "format": "{{value}}",
       "min": 0,
       "max": "120",
       "colors": [
           "#00b500",
           "#e6e600",
           "#ca3838"
       ],
       "seg1": "",
       "seg2": "",
       "x": 1240,
       "y": 125,
       "wires": []
   },
   {
       "id": "fc1b2b62.0b63a8",
       "type": "websocket-listener",
       "z": "",
       "path": "ws://localhost:3000/signalk/v1/stream",
       "wholemsg": "false"
   },
   {
       "id": "3bc70d31.720c02",
       "type": "ui_group",
       "z": "",
       "name": "Gauges",
       "tab": "de6fba2.670c748",
       "order": 1,
       "disp": true,
       "width": "10"
   },
   {
       "id": "de6fba2.670c748",
       "type": "ui_tab",
       "z": "",
       "name": "Gauges",
       "icon": "dashboard",
       "order": 2
   }
]
Reply
#3
(2018-01-22, 10:32 PM)PaddyB Wrote:
(2018-01-22, 10:00 PM)topodom Wrote: Hi everyone,

I have installed an MPU-9255 sensor.
i am working on a red node dasboard to read the values with an internet browser.

I am able to pipe and read navigation.attitude.roll and navigation.attitude.pitch.
but impossible to do the same with navigation.headingMagnetic. When i check the values with openplotter diagnostic SignalK input windows, the sensor is sending values.

So it seems the issue is between signal K and red node.
Any idea ?

below is my code for the red node fonction :

Code:
var signalk_key="navigation.headingmagnetic";

if(msg.payload.hasOwnProperty(signalk_key)){
    msg.payload=msg.payload[signalk_key];
    return msg;
}


then i use a UI_text
with {{value}} in the value format filed

thanks !


Tried a change node and jsonata? They can be handy as you can put in a temporary debug node then copy what's coming in and paste it into the test tab to make sure what is going out is what you want. Also, I'm slowly going over to putting everything into global variables as it comes in , then it's easier to get to the data anywhere else in node red. For UI text just set an inject node to send the global variable to a text node. 

Probably a neater way to do this but it might give an idea >>

Code:
[
   {
       "id": "67b79641.1fad68",
       "type": "websocket in",
       "z": "749e8283.293f4c",
       "name": "SignalK input",
       "server": "fc1b2b62.0b63a8",
       "client": "",
       "x": 90,
       "y": 80,
       "wires": [
           [
               "20af45d9.7fe30a"
           ]
       ]
   },
   {
       "id": "20af45d9.7fe30a",
       "type": "json",
       "z": "749e8283.293f4c",
       "name": "",
       "pretty": false,
       "x": 90,
       "y": 240,
       "wires": [
           [
               "8b385a5c.b0c248",
               "2c398bd9.039814",
               "10608140.97117f",
               "a828164d.3005a8"
           ]
       ]
   },
   {
       "id": "10608140.97117f",
       "type": "switch",
       "z": "749e8283.293f4c",
       "name": "",
       "property": "payload.updates.values.path",
       "propertyType": "jsonata",
       "rules": [
           {
               "t": "eq",
               "v": "propulsion.engine.temperature",
               "vt": "str"
           },
           {
               "t": "eq",
               "v": "propulsion.alt.temperature",
               "vt": "str"
           },
           {
               "t": "eq",
               "v": "propulsion.exh.temperature",
               "vt": "str"
           },
           {
               "t": "eq",
               "v": "environment.outside.pressure",
               "vt": "str"
           },
           {
               "t": "eq",
               "v": "electrical.batteries.MainBank.voltage",
               "vt": "str"
           }
       ],
       "checkall": "true",
       "outputs": 5,
       "x": 250,
       "y": 140,
       "wires": [
           [
               "f9de7f8e.d11f9"
           ],
           [
               "ac6fa817.c672c8"
           ],
           [
               "7f2db92c.1b0ad8"
           ],
           [
               "a1aa7569.769a28"
           ],
           [
               "9d158a2f.8b5da8"
           ]
       ]
   },
   {
       "id": "f9de7f8e.d11f9",
       "type": "change",
       "z": "749e8283.293f4c",
       "name": "Set Global.eng",
       "rules": [
           {
               "t": "set",
               "p": "eng",
               "pt": "global",
               "to": "$round($number(payload.updates.values.value) - 273.15,2)",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 420,
       "y": 60,
       "wires": [
           []
       ]
   },
   {
       "id": "ac6fa817.c672c8",
       "type": "change",
       "z": "749e8283.293f4c",
       "name": "Set Global.alt",
       "rules": [
           {
               "t": "set",
               "p": "alt",
               "pt": "global",
               "to": "$round($number(payload.updates.values.value) - 273.15,2)",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 420,
       "y": 80,
       "wires": [
           []
       ]
   },
   {
       "id": "7f2db92c.1b0ad8",
       "type": "change",
       "z": "749e8283.293f4c",
       "name": "Set Global.exh",
       "rules": [
           {
               "t": "set",
               "p": "exh",
               "pt": "global",
               "to": "$round($number(payload.updates.values.value) - 273.15,2)",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 420,
       "y": 100,
       "wires": [
           []
       ]
   },
   {
       "id": "a1aa7569.769a28",
       "type": "change",
       "z": "749e8283.293f4c",
       "name": "Set Global.pres",
       "rules": [
           {
               "t": "set",
               "p": "pressure",
               "pt": "global",
               "to": "\t$number(payload.updates.values.value) ? $number(payload.updates.values.value) : \"\"",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 420,
       "y": 120,
       "wires": [
           []
       ]
   },
   {
       "id": "9d158a2f.8b5da8",
       "type": "change",
       "z": "749e8283.293f4c",
       "name": "Set Global.battVolts",
       "rules": [
           {
               "t": "set",
               "p": "battVolts",
               "pt": "global",
               "to": "$number(payload.updates.values.value) ? $number(payload.updates.values.value) : \"\"",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 440,
       "y": 140,
       "wires": [
           []
       ]
   },
   {
       "id": "9bc5cb83.05d3f8",
       "type": "inject",
       "z": "749e8283.293f4c",
       "name": "",
       "topic": "",
       "payload": "eng",
       "payloadType": "global",
       "repeat": "1",
       "crontab": "",
       "once": false,
       "x": 830,
       "y": 80,
       "wires": [
           [
               "d652486c.7ed398",
               "f66f5fb8.176a1"
           ]
       ]
   },
   {
       "id": "f66f5fb8.176a1",
       "type": "ui_gauge",
       "z": "749e8283.293f4c",
       "name": "EngTempGauge",
       "group": "3bc70d31.720c02",
       "order": 1,
       "width": "3",
       "height": "4",
       "gtype": "gage",
       "title": "Engine temperature",
       "label": "Deg C",
       "format": "{{value}}",
       "min": 0,
       "max": "120",
       "colors": [
           "#00b500",
           "#e6e600",
           "#ca3838"
       ],
       "seg1": "",
       "seg2": "",
       "x": 1240,
       "y": 125,
       "wires": []
   },
   {
       "id": "fc1b2b62.0b63a8",
       "type": "websocket-listener",
       "z": "",
       "path": "ws://localhost:3000/signalk/v1/stream",
       "wholemsg": "false"
   },
   {
       "id": "3bc70d31.720c02",
       "type": "ui_group",
       "z": "",
       "name": "Gauges",
       "tab": "de6fba2.670c748",
       "order": 1,
       "disp": true,
       "width": "10"
   },
   {
       "id": "de6fba2.670c748",
       "type": "ui_tab",
       "z": "",
       "name": "Gauges",
       "icon": "dashboard",
       "order": 2
   }
]
I have tried your method putting in global variable, but i was not able to make it work, even what was working in my previous method.
Reply
#4
(2018-01-22, 11:50 PM)topodom Wrote: I have tried your method putting in global variable, but i was not able to make it work, even what was working in my previous method.

Do you have a signalk message with the navigation.headingMagnetic from a debug node you could post?
Reply
#5
here is the result of the debug :

Code:
{ navigation.headingMagnetic: 1.31530016649, navigation.attitude.roll: -0.0498125188171, navigation.attitude.pitch: -0.0218765406024 }

if i move the sensor a little bit i get :
Code:
{ navigation.headingMagnetic: 1.41319958604, navigation.attitude.roll: -0.0522878579387, navigation.attitude.pitch: -0.0178265759421 }

meaning that navigation.headingMagnetic has values.
if i compare the values with the signalK diagnostic in openplotter, i get the same values for the roll and pich but for navigation.headingMagnetic i get 73 and 80 degrees ?

So two the issues become :

- why cant i get the value of navigation.headingMagnetic in a gauge or text UI ?
Now i know there is values to find i dug in around may node theni have noticed tha in the "merge values" node (the one after "Signal K delta values" node). I have two outputs and i was connected to the second one. when i put it on the first one then i have been able to get my values. Yes it's a stupid mistake, certainly a noobs mistake Sad


- why the values of navigation.headingMagnetic are different ?
For this point i don't have answer, futher i have for instance :
signal K : 119 deg, navigation.headingMagnetic: 3.47877744026
quite weird !
Reply
#6
Sorry, not sure why you can't see the nav..head ... Values, could you export and post the whole node need flow? Oops, read again, you have it working, cool, it always does in the end Smile

SignalK uses SI units, so it will be in radians I think, not degrees. So degrees I think are value* 180/Pi

Sent from my SGP511 using Tapatalk
Reply
#7
Yes it's right, even if signal K diagnostic windows give the navigation.headingMagnetic in degrees, the signal K value arrives in node red in radian.

i juste added a function to convert with this simple code :


Code:
msg.payload = Math.round(Number(msg.payload)*(180/3.14159265359))
return msg;

Thanks for help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)