![]() |
How to split pitch and roll into two objects in node red? - Printable Version +- OpenMarine (https://forum.openmarine.net) +-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1) +--- Forum: Node Red (https://forum.openmarine.net/forumdisplay.php?fid=15) +--- Thread: How to split pitch and roll into two objects in node red? (/showthread.php?tid=2274) |
How to split pitch and roll into two objects in node red? - craig - 2020-01-26 I have the payload from the SignalK value as the following in a node red flow, but I am not sure how to separate them into two separate values to perform some calculations on them. Code: object When I use the split node, I get the values, but lose the "roll" and "pitch" names from the subsequent outputs Code: 1/26/2020, 7:27:13 PMnode: b92f2e27.99214 I tried to use a "change" to delete roll and pitch from the message in two different change nodes to branch the thread message payloads, but that failed. Could someone point me in the right direction on the best way to pull the values from the payload? I would also like to do this with the long/lat position values once I get it working. RE: How to split pitch and roll into two objects in node red? - Moeritsen - 2020-01-29 (2020-01-26, 07:48 PM)craig Wrote: I have the payload from the SignalK value as the following in a node red flow, but I am not sure how to separate them into two separate values to perform some calculations on them. Hi Craig, I had the same problem: My approach has been to parse the incoming SignalK sentence into a json-object. You may use the json-parser-node. After that you can access every value inside the incoming object like this: msg.payload = msg.payload.updates[0].values[2].value; if the upper objectlevel is called "updates" or different doesnt matter. I produced a little video for explaination, but its in german: https://www.youtube.com/watch?v=UgLgrTWe77o Hope this will help you Moeritsen RE: How to split pitch and roll into two objects in node red? - craig - 2020-01-31 (2020-01-29, 01:38 PM)Moeritsen Wrote:(2020-01-26, 07:48 PM)craig Wrote: I have the payload from the SignalK value as the following in a node red flow, but I am not sure how to separate them into two separate values to perform some calculations on them. THank you for replying. I managed to figure it out with the following flow. In the split node, I set the "copy key" to msg.topic and then used a switch node to route the msg.topic to the correct process. |