Skip to content

Instantly share code, notes, and snippets.

@dmalawey
Created September 9, 2020 07:26
Show Gist options
  • Save dmalawey/8b63adaa9bb83daff7ff58b150c3c423 to your computer and use it in GitHub Desktop.
Save dmalawey/8b63adaa9bb83daff7ff58b150c3c423 to your computer and use it in GitHub Desktop.
make a function in nodered to extract individual axes from the gamepad
[{"id":"4a052b50.075214","type":"tab","label":"PlotGP","disabled":false,"info":""},{"id":"350633a1.11bc9c","type":"ui_gauge","z":"4a052b50.075214","name":"","group":"341ef7b5.bb9218","order":1,"width":"5","height":"5","gtype":"gage","title":"Axis0 (theta dot)","label":"percent","format":"{{value}}","min":"-100","max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":460,"y":280,"wires":[]},{"id":"1cbd9feb.395ee","type":"file in","z":"4a052b50.075214","name":"read uFile.txt","filename":"/tmp/uFile.txt","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":130,"y":120,"wires":[["7d96ee41.f7f52","9f412f87.46433"]]},{"id":"7d96ee41.f7f52","type":"csv","z":"4a052b50.075214","name":"parse values","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"GP_tdot, GP_xdot","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":190,"y":180,"wires":[["2c3f9ccf.818b84","d7dc5615.75ce08","99988631.c44068"]]},{"id":"2c3f9ccf.818b84","type":"debug","z":"4a052b50.075214","name":"debug2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":360,"y":180,"wires":[]},{"id":"9f412f87.46433","type":"debug","z":"4a052b50.075214","name":"debug1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":320,"y":120,"wires":[]},{"id":"d7dc5615.75ce08","type":"function","z":"4a052b50.075214","name":"grab_tdot","func":"//node.warn(msg.payload['GP_tdot']);\nmsg.payload=msg.payload['GP_tdot']\n//return(msg.payload['GP_tdot']);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":260,"y":240,"wires":[["f49cf3f8.22f23","350633a1.11bc9c"]]},{"id":"f49cf3f8.22f23","type":"debug","z":"4a052b50.075214","name":"debug3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":440,"y":240,"wires":[]},{"id":"99988631.c44068","type":"function","z":"4a052b50.075214","name":"grab_xdot","func":"msg.payload=msg.payload.GP_xdot;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":260,"y":280,"wires":[["ef8ea60d.aa9c28","a3f35163.73b8a"]]},{"id":"ef8ea60d.aa9c28","type":"ui_gauge","z":"4a052b50.075214","name":"","group":"341ef7b5.bb9218","order":1,"width":"5","height":"5","gtype":"gage","title":"Axis1 (x dot)","label":"percent","format":"{{value}}","min":"-100","max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":450,"y":360,"wires":[]},{"id":"a3f35163.73b8a","type":"debug","z":"4a052b50.075214","name":"debug4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":440,"y":320,"wires":[]},{"id":"3e49dbd3.953354","type":"watch","z":"4a052b50.075214","name":"","files":"/tmp/uFile.txt","recursive":"","x":130,"y":40,"wires":[["1cbd9feb.395ee"]]},{"id":"341ef7b5.bb9218","type":"ui_group","z":"","name":"GamePad Signal","tab":"d7c99dbb.b1cd4","order":1,"disp":true,"width":"10","collapse":false},{"id":"d7c99dbb.b1cd4","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":2,"disabled":false,"hidden":false}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment