OpenMarine
Output furuno proprietary attitude sentence (pitch and roll) - 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: Output furuno proprietary attitude sentence (pitch and roll) (/showthread.php?tid=4556)



Output furuno proprietary attitude sentence (pitch and roll) - Sparhawk76 - 2023-03-31

The following flow takes the navigation.attitude SignalK delta provided by pypilot and converts it to the proprietary Furuno nmea0183 attitude sentence to get pitch and roll data into TimeZero (and possibly Furuno MFDs capable of reciving nmea0183).  Hope it comes in handy to someone.

Code:
[{"id":"e0d8cd0801ac2f1d","type":"tab","label":"Furuno Attitude Nmea0183","disabled":false,"info":"","env":[]},{"id":"722e61e7d37a6496","type":"signalk-on-delta","z":"e0d8cd0801ac2f1d","name":"","context":"vessels.self","flatten":true,"x":120,"y":100,"wires":[["45c8e6e408bd747b"]]},{"id":"d466e1e9de17ba49","type":"function","z":"e0d8cd0801ac2f1d","name":"NMEA Checksum","func":"var checksum = 0; for (var i = 0; i < msg.payload.length; i++) { checksum = checksum ^ msg.payload.charCodeAt(i); } msg.payload = \"$\" + msg.payload + \"*\" + checksum.toString(16); return msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1070,"y":220,"wires":[["28a12ea80f583a6f"]]},{"id":"4752fa756953d653","type":"join","z":"e0d8cd0801ac2f1d","name":"Attitude","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":",","joinerType":"str","accumulate":true,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":600,"y":220,"wires":[["a906fbf1e61bc251"]]},{"id":"a1357af7c8a58c32","type":"split","z":"e0d8cd0801ac2f1d","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"topic","x":530,"y":100,"wires":[["5de5090ab9e5812b"]]},{"id":"5de5090ab9e5812b","type":"switch","z":"e0d8cd0801ac2f1d","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"roll","vt":"str"},{"t":"eq","v":"pitch","vt":"str"},{"t":"eq","v":"yaw","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":190,"y":220,"wires":[["d218d37c2272a431"],["a9fc128b097fc253"],["5bc792bf760ed7f9"]]},{"id":"a906fbf1e61bc251","type":"change","z":"e0d8cd0801ac2f1d","name":"Furuno NMea Sentence","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"PFEC,GPatt,\" & $.payload.yaw & \",\" &  $.payload.pitch & \",\" & $.payload.roll & \",\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":220,"wires":[["d466e1e9de17ba49"]]},{"id":"28a12ea80f583a6f","type":"signalk-send-nmea0183","z":"e0d8cd0801ac2f1d","name":"","nmea0183Event":"nmea0183out","x":1310,"y":220,"wires":[]},{"id":"a9fc128b097fc253","type":"function","z":"e0d8cd0801ac2f1d","name":"Radians To Degrees","func":"msg.payload = 57.2957795785523 * msg.payload\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":220,"wires":[["4752fa756953d653"]]},{"id":"d218d37c2272a431","type":"function","z":"e0d8cd0801ac2f1d","name":"Radians To Degrees","func":"msg.payload = 57.2957795785523 * msg.payload\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":180,"wires":[["4752fa756953d653"]]},{"id":"5bc792bf760ed7f9","type":"function","z":"e0d8cd0801ac2f1d","name":"Radians To Degrees","func":"msg.payload = 57.2957795785523 * msg.payload\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":260,"wires":[["4752fa756953d653"]]},{"id":"45c8e6e408bd747b","type":"switch","z":"e0d8cd0801ac2f1d","name":"navigation.attitude","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"navigation.attitude","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":350,"y":100,"wires":[["a1357af7c8a58c32"]]},{"id":"44d8a6fe333d680f","type":"comment","z":"e0d8cd0801ac2f1d","name":"Converts navigation.attitude (provided by pypilot) into proprietary furuno sentence to work with TimeZero","info":"Source of following info: https://marport.com/documentation.html?https://marport.com/doc_web/PSY/user/topics/r-WinchNMEA.html\nFEC - Furuno attitude message\t\n$PFEC,GPatt,aaa.a,bb.b,cc.c,*hh<CR><LF>\n\n$PFEC: Talker identifier + sentence formatter*\nGPatt: Global positioning attitude, sentence formatter\naaa.a: Heading true*\nbb.b: Pitch*\ncc.c: Roll*\n*hh: Checksum*","x":390,"y":40,"wires":[]}]