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
How to split pitch and roll into two objects in node red?
#3
(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.

Code:
object
roll: -0.0008377580640000001
pitch: -0.0005061454970000001
yaw: null



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
navigation.attitude : msg.payload : number
-0.000785398185
1/26/2020, 7:27:13 PMnode: b92f2e27.99214
navigation.attitude : msg.payload : number
0.00022689280900000004
1/26/2020, 7:27:13 PMnode: b92f2e27.99214
navigation.attitude : msg.payload : null
null

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.

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

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.

   
Reply


Messages In This Thread
RE: How to split pitch and roll into two objects in node red? - by craig - 2020-01-31, 11:38 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)