org-arl / unet-contrib

Unet user contributions
BSD 3-Clause "New" or "Revised" License
11 stars 15 forks source link

Unable to fetch node parameters when origin is [Float.NaN, Float.NaN] #69

Closed AnneThKu closed 2 years ago

AnneThKu commented 2 years ago

When node.origin is set as [Float.NaN, Float.NaN], if we try to fetch multiple node parameters including origin, it does not return any of the parameters. For example, await nodeinfo.get(['origin', 'location', 'address', 'mobility', 'heading']); returns value as ,,,,.

mchitre commented 2 years ago

Tested on fjåge Java gateway and on Fjage.jl. Both work as expected. So I suspect this is specific to JS.

notthetup commented 2 years ago

It seems to return [null, null, null, null, null]

Most likely from fjage.js, since on modern UnetStacks, Parameter are not provided by unet.js anymore. They're based into fjage.

https://github.com/org-arl/fjage/blob/master/gateways/js/src/fjage.js#L174...L176

notthetup commented 2 years ago

OK. This is an issue with JSON not supporting NaN. https://github.com/org-arl/fjage/issues/109

notthetup commented 2 years ago

Will reopen https://github.com/org-arl/fjage/issues/109 and close this issue.

mchitre commented 2 years ago

Did you check the JSON generated? node.orgin is a double[] and so should be encoded by fjåge as a base64 string with IEEE NaNs and not as NaN in JSON.

notthetup commented 2 years ago

Yes the JSON had NaN..

"action":"send","message":{"clazz":"org.arl.fjage.param.ParameterRsp","data":{"index":-1,"values":null,"param":"org.arl.unet.nodeinfo.NodeInfoParam.origin","value":[NaN,NaN],"readonly":[],"msgID":"4c17723b-70c1-452d-9746-60f7f6905a57","perf":"INFORM","recipient":"WebGW-","sender":"node","inReplyTo":"38b8889ceca220f2121de0d990cf04af","sentAt":1647307089333}},"relay":false}\n