vincenthure
Posts: 3
Joined: Tue Mar 06, 2018 3:47 pm

autopilot calibration problem

Tue Mar 06, 2018 4:07 pm

I get trouble with calibration of the IMU of the sense_hat

I follow the official procedure to calibrate the sensor of the board:

cd RTEllipsoidFit
RTIMULibCal
rm ~/.config/sense_hat/RTIMULib.ini
sudo cp RTIMULib.ini /etc

Everything work good and nicely.

I use 'node-red-node-pi-sense-hat' to read the sensor and I get crazy values.
The compass value and the orientation value are not good.
When I turn my board of 180 degres the new value change to 280
The opposite side is 100 degres wrong.
My file RTIMULib.ini look good and I think it is not used
The right place is /etc ??
Is a special place to use with nodered??

My projet is to make a autopilot for a sailing boat.
If I can solve this problem it will a big step because everything else is working good.

The flows :
[{"id":"2382edab.72d392","type":"tab","label":"PILOTE","disabled":false,"info":""},{"id":"426e8b48.9c8054","type":"tab","label":"POWER","disabled":false,"info":""},{"id":"11f8763a.611cca","type":"ui_group","z":"","name":"PILOTE","tab":"34cd704e.4b062","disp":true,"width":"6","collapse":false},{"id":"34cd704e.4b062","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1},{"id":"a7ba38ff.4cdf48","type":"ui_base","theme":{"name":"theme-dark","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"Arial,Arial,Helvetica,sans-serif","edited":true,"reset":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#097479","value":"#097479","edited":false},"page-titlebar-backgroundColor":{"value":"#097479","edited":false},"page-backgroundColor":{"value":"#111111","edited":false},"page-sidebar-backgroundColor":{"value":"#000000","edited":false},"group-textColor":{"value":"#0eb8c0","edited":false},"group-borderColor":{"value":"#555555","edited":false},"group-backgroundColor":{"value":"#333333","edited":false},"widget-textColor":{"value":"#eeeeee","edited":false},"widget-backgroundColor":{"value":"#097479","edited":false},"widget-borderColor":{"value":"#333333","edited":false},"base-font":{"value":"Arial,Arial,Helvetica,sans-serif"}}},"site":{"name":"Dashboard","hideToolbar":"true","allowSwipe":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"349cc573.55423a","type":"json-db-collection","z":"","name":"KPID","collection":"Kpid","save":true},{"id":"7563ddea.f4ef84","type":"ui_group","z":"","name":"PARAMETRES","tab":"9aae86d6.87cff8","order":3,"disp":true,"width":"6","collapse":false},{"id":"9aae86d6.87cff8","type":"ui_tab","z":"","name":"parametre","icon":"dashboard","order":3},{"id":"f87e0d63.5fb3","type":"ui_tab","z":"","name":"Monitor","icon":"dashboard","order":2},{"id":"441a6c4.dddc794","type":"ui_group","z":"","name":"Monitor","tab":"f87e0d63.5fb3","order":1,"disp":true,"width":"6","collapse":false},{"id":"b572f694.c01378","type":"ui_tab","z":"","name":"Power","icon":"dashboard","order":4},{"id":"96b9b4d5.2ba1a8","type":"ui_group","z":"","name":"Power","tab":"b572f694.c01378","order":1,"disp":true,"width":"6","collapse":false},{"id":"ca604486.068d88","type":"ui_gauge","z":"2382edab.72d392","name":"Input","group":"441a6c4.dddc794","order":1,"width":0,"height":0,"gtype":"gage","title":"Input","label":"degrés","format":"{{value| number:0}}","min":"-10","max":"10","colors":["#ff0000","#00ff00","#ff0000"],"seg1":"-5","seg2":"+5","x":822,"y":258,"wires":[]},{"id":"5c9afeb7.823f","type":"ui_button","z":"2382edab.72d392","name":"","group":"11f8763a.611cca","order":1,"width":0,"height":0,"passthru":true,"label":"Set Cap","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":711.5000076293945,"y":431.0000057220459,"wires":[["a849d068.a4255"]]},{"id":"a849d068.a4255","type":"function","z":"2382edab.72d392","name":"Set cap","func":"if( msg.payload === true ) \n flow.set(\"cap\",flow.get(\"heading\"));\nreturn msg;","outputs":1,"noerr":0,"x":925.5000076293945,"y":431.0000057220459,"wires":[[]]},{"id":"ee81d8d.6d51f28","type":"function","z":"2382edab.72d392","name":"PID","func":"var Vp = msg.payload;\n\nvar Vi = flow.get(\"Vi\") + Vp;\n Vi = Math.min(Vi, 20);\n Vi = Math.max(Vi,-20);\n\nvar Vd = Vp - flow.get(\"Vp\");\n\nvar output = flow.get(\"Kp\")*Vp;\n output += flow.get(\"Ki\")*Vi;\n output += flow.get(\"Kd\")*Vd;\n output = Math.min(output,100);\n output = Math.max(output,-100);\n\nmsg.payload = output;\n\nflow.set(\"Vi\",Vi);\nflow.set(\"Vp\",Vp);\n\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":159,"wires":[["fb875439.b84778","f5cde2d6.fe40e"]]},{"id":"5eaa7208.71508c","type":"rpi-gpio out","z":"2382edab.72d392","name":"INVERSE out","pin":"11","set":"","level":"0","freq":"","out":"out","x":1032,"y":145,"wires":[]},{"id":"207dfbe0.2c4954","type":"rpi-gpio out","z":"2382edab.72d392","name":"PWM out","pin":"12","set":"","level":"0","freq":"","out":"pwm","x":1025,"y":78,"wires":[]},{"id":"274dc601.71652a","type":"ui_button","z":"2382edab.72d392","name":"-1","group":"11f8763a.611cca","order":2,"width":"3","height":"1","passthru":true,"label":"-1","color":"","bgcolor":"","icon":"","payload":"-1","payloadType":"num","topic":"","x":701.5000076293945,"y":471.0000057220459,"wires":[["fccf0585.dcfa68"]]},{"id":"df0308bf.449c18","type":"ui_button","z":"2382edab.72d392","name":"+10","group":"11f8763a.611cca","order":5,"width":"3","height":"1","passthru":false,"label":"+10","color":"","bgcolor":"","icon":"","payload":"+10","payloadType":"num","topic":"","x":701.5000076293945,"y":591.0000057220459,"wires":[["fccf0585.dcfa68"]]},{"id":"78838785.188188","type":"ui_button","z":"2382edab.72d392","name":"-10","group":"11f8763a.611cca","order":4,"width":"3","height":"1","passthru":false,"label":"-10","color":"","bgcolor":"","icon":"","payload":"-10","payloadType":"num","topic":"","x":701.5000076293945,"y":551.0000057220459,"wires":[["fccf0585.dcfa68"]]},{"id":"3473d137.95edce","type":"ui_button","z":"2382edab.72d392","name":"+1","group":"11f8763a.611cca","order":3,"width":"3","height":"1","passthru":true,"label":"+1","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"num","topic":"","x":701.5000076293945,"y":511.0000057220459,"wires":[["fccf0585.dcfa68"]]},{"id":"fccf0585.dcfa68","type":"function","z":"2382edab.72d392","name":"Adjust cap","func":"flow.set(\"cap\",flow.get(\"cap\")+msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":935.5000076293945,"y":531.0000057220459,"wires":[[]]},{"id":"41a23d3a.3016c4","type":"ui_numeric","z":"2382edab.72d392","name":"Kp","label":"Paramètre Kp","group":"7563ddea.f4ef84","order":1,"width":0,"height":0,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":"50","step":1,"x":937.5000076293945,"y":641.0000057220459,"wires":[["25fcd8f1.3c06f8"]]},{"id":"ffc2ab93.ff61d8","type":"ui_numeric","z":"2382edab.72d392","name":"Ki","label":"Paramètre Ki","group":"7563ddea.f4ef84","order":2,"width":0,"height":0,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":"50","step":1,"x":937.5000076293945,"y":681.0000057220459,"wires":[["4e3f18a9.4c2048"]]},{"id":"b1da501b.37d83","type":"ui_numeric","z":"2382edab.72d392","name":"Kd","label":"Paramètre Kp","group":"7563ddea.f4ef84","order":3,"width":0,"height":0,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":"50","step":1,"x":937.5000076293945,"y":721.0000057220459,"wires":[["e70c6b77.6b7268"]]},{"id":"6f744180.cfc","type":"config","z":"2382edab.72d392","name":"Init Value","properties":[{"p":"Vi","pt":"flow","to":"0","tot":"num"},{"p":"Vp","pt":"flow","to":"0","tot":"num"},{"p":"cap","pt":"flow","to":"0","tot":"num"}],"active":true,"x":121,"y":59,"wires":[]},{"id":"25fcd8f1.3c06f8","type":"function","z":"2382edab.72d392","name":"Set Kp","func":"flow.set(\"Kp\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":1089.5,"y":641,"wires":[[]]},{"id":"4e3f18a9.4c2048","type":"function","z":"2382edab.72d392","name":"Set Ki","func":"flow.set(\"Ki\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":1089.5,"y":681,"wires":[[]]},{"id":"e70c6b77.6b7268","type":"function","z":"2382edab.72d392","name":"Set Kd","func":"flow.set(\"Kd\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":1089.5,"y":721,"wires":[[]]},{"id":"b68f6a38.1f4c98","type":"function","z":"2382edab.72d392","name":"Yaw","func":"msg.payload = msg.payload.orientation.yaw;\nflow.set(\"heading\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":228,"y":156,"wires":[["bd9434d1.645ac8","2e7510d9.35ba1"]]},{"id":"c64267e9.b634d8","type":"rpi-sensehat in","z":"2382edab.72d392","name":"IMU","motion":true,"env":false,"stick":false,"x":85.5,"y":157,"wires":[["b68f6a38.1f4c98"]]},{"id":"d3e6f191.2a8e3","type":"rpi-sensehat in","z":"2382edab.72d392","name":"Joystick","motion":false,"env":false,"stick":true,"x":91.00000762939453,"y":465.0000057220459,"wires":[["28815e42.b79992"]]},{"id":"28815e42.b79992","type":"switch","z":"2382edab.72d392","name":"KEY","property":"payload.key","propertyType":"msg","rules":[{"t":"eq","v":"ENTER","vt":"str"},{"t":"eq","v":"LEFT","vt":"str"},{"t":"eq","v":"RIGHT","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":228.00000762939453,"y":466.0000057220459,"wires":[["ee893594.42a108"],["12fb952f.351a7b"],["d1bd5766.ecbda8"]]},{"id":"ee893594.42a108","type":"switch","z":"2382edab.72d392","name":"State","property":"payload.state","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":388.00000762939453,"y":429.0000057220459,"wires":[["32f3b4dd.85a42c"]]},{"id":"12fb952f.351a7b","type":"switch","z":"2382edab.72d392","name":"State","property":"payload.state","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":386.50000762939453,"y":470.0000057220459,"wires":[["55f09413.ced89c"]]},{"id":"d1bd5766.ecbda8","type":"switch","z":"2382edab.72d392","name":"State","property":"payload.state","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":385.50000762939453,"y":509.0000057220459,"wires":[["ee9de78f.c45a68"]]},{"id":"32f3b4dd.85a42c","type":"function","z":"2382edab.72d392","name":"true","func":"msg.payload = true;\nreturn msg;","outputs":1,"noerr":0,"x":541.0000076293945,"y":429.0000057220459,"wires":[["5c9afeb7.823f"]]},{"id":"55f09413.ced89c","type":"function","z":"2382edab.72d392","name":"-1","func":"msg.payload = -1;\nreturn msg;","outputs":1,"noerr":0,"x":540.5000076293945,"y":470.0000057220459,"wires":[["274dc601.71652a"]]},{"id":"ee9de78f.c45a68","type":"function","z":"2382edab.72d392","name":"+1","func":"msg.payload = 1;\nreturn msg;","outputs":1,"noerr":0,"x":538.5000076293945,"y":511.0000057220459,"wires":[["3473d137.95edce"]]},{"id":"4a7dd360.8c26fc","type":"function","z":"2382edab.72d392","name":"Paramètre","func":"Kp =flow.get(\"Kp\");\nKi =flow.get(\"Ki\");\nKd =flow.get(\"Kd\");\nmsg.payload =[Kp,Ki,Kd];\nreturn msg;","outputs":1,"noerr":0,"x":456.00000762939453,"y":788.0000057220459,"wires":[["44b23128.a21e"]]},{"id":"44b23128.a21e","type":"json","z":"2382edab.72d392","name":"","property":"payload","action":"","pretty":false,"x":621.0000076293945,"y":788.0000057220459,"wires":[["f964a005.0e63f"]]},{"id":"f964a005.0e63f","type":"DataIn","z":"2382edab.72d392","collection":"349cc573.55423a","name":"","update":false,"path":"/home/pi","x":772.0000076293945,"y":787.0000057220459,"wires":[]},{"id":"fb86f973.56bed8","type":"DataOut","z":"2382edab.72d392","collection":"349cc573.55423a","name":"","path":"/home/pi","error":false,"x":451.00000762939453,"y":700.0000057220459,"wires":[["18459fd.a1d516"]]},{"id":"18459fd.a1d516","type":"json","z":"2382edab.72d392","name":"","property":"payload","action":"","pretty":false,"x":607.0000076293945,"y":700.0000057220459,"wires":[["f107ce16.4f1c7"]]},{"id":"f107ce16.4f1c7","type":"function","z":"2382edab.72d392","name":"Split","func":"msg1={};\nmsg2={};\nmsg3={};\n\nmsg1.payload = msg.payload[0];\nmsg2.payload = msg.payload[1];\nmsg3.payload = msg.payload[2];\nreturn [msg1,msg2,msg3];","outputs":3,"noerr":0,"x":738.0000076293945,"y":700.0000057220459,"wires":[["41a23d3a.3016c4"],["ffc2ab93.ff61d8"],["b1da501b.37d83"]]},{"id":"c3195484.2afa58","type":"ui_button","z":"2382edab.72d392","name":"Télécharge paramètres","group":"7563ddea.f4ef84","order":4,"width":"3","height":"1","passthru":true,"label":"Load","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":277.00000762939453,"y":700.0000057220459,"wires":[["fb86f973.56bed8"]]},{"id":"5f7b6dcf.686604","type":"ui_button","z":"2382edab.72d392","name":"Sauvegarde Paramètres","group":"7563ddea.f4ef84","order":5,"width":"3","height":"1","passthru":false,"label":"Save","color":"","bgcolor":"red","icon":"","payload":"true","payloadType":"bool","topic":"","x":228.50000762939453,"y":788.0000057220459,"wires":[["4a7dd360.8c26fc"]]},{"id":"434bc137.c4927","type":"inject","z":"2382edab.72d392","name":"BOOT","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":96.00000762939453,"y":699.0000057220459,"wires":[["c3195484.2afa58"]]},{"id":"34906464.d6b57c","type":"exec","z":"426e8b48.9c8054","command":"sudo reboot","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":389,"y":82,"wires":[[],[],[]]},{"id":"35118981.2dd646","type":"ui_button","z":"426e8b48.9c8054","name":"Eteindre","group":"96b9b4d5.2ba1a8","order":1,"width":"3","height":"1","passthru":false,"label":"Eteindre","color":"","bgcolor":"red","icon":"","payload":"êtes vous sure de vouloir eteindre?","payloadType":"str","topic":"","x":139.5,"y":174,"wires":[["ef9510d8.405a4"]]},{"id":"ef9510d8.405a4","type":"exec","z":"426e8b48.9c8054","command":"sudo poweroff","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":392,"y":176,"wires":[[],[],[]]},{"id":"2e7510d9.35ba1","type":"ui_gauge","z":"2382edab.72d392","name":"Compas","group":"11f8763a.611cca","order":6,"width":0,"height":0,"gtype":"compass","title":"Compas","label":"degrés","format":"{{value| number:0}}","min":0,"max":"360","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":825,"y":310.75,"wires":[]},{"id":"bc199e36.1594d","type":"inject","z":"2382edab.72d392","name":"Boot 3s","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":true,"onceDelay":"3","x":524.5,"y":378,"wires":[["5c9afeb7.823f"]]},{"id":"8d1b5f34.11ba2","type":"ui_button","z":"2382edab.72d392","name":"Pilote","group":"7563ddea.f4ef84","order":6,"width":0,"height":0,"passthru":false,"label":"Home","color":"","bgcolor":"","icon":"","payload":"Home","payloadType":"str","topic":"Home","x":187.5,"y":947,"wires":[["cba30c13.4e341"]]},{"id":"cba30c13.4e341","type":"ui_ui_control","z":"2382edab.72d392","name":"","x":533.5,"y":991,"wires":[[]]},{"id":"7217f1f1.8f21b","type":"ui_button","z":"2382edab.72d392","name":"parametre","group":"11f8763a.611cca","order":7,"width":0,"height":0,"passthru":false,"label":"paramètres","color":"","bgcolor":"","icon":"","payload":"parametre","payloadType":"str","topic":"tab","x":200,"y":1001,"wires":[["cba30c13.4e341"]]},{"id":"37d9931b.0fa82c","type":"ui_button","z":"2382edab.72d392","name":"Monitor","group":"11f8763a.611cca","order":8,"width":0,"height":0,"passthru":false,"label":"Monitoring","color":"","bgcolor":"","icon":"","payload":"Monitor","payloadType":"str","topic":"tab","x":200,"y":1049,"wires":[["cba30c13.4e341"]]},{"id":"52c7a309.5112ac","type":"ui_button","z":"2382edab.72d392","name":"Home","group":"441a6c4.dddc794","order":3,"width":0,"height":0,"passthru":false,"label":"Home","color":"","bgcolor":"","icon":"","payload":"Home","payloadType":"str","topic":"tab","x":187,"y":895,"wires":[["cba30c13.4e341"]]},{"id":"538c37d3.958728","type":"ui_button","z":"426e8b48.9c8054","name":"","group":"96b9b4d5.2ba1a8","order":2,"width":"3","height":"1","passthru":false,"label":"Reboot","color":"","bgcolor":"red","icon":"","payload":"êtes vous sure de vouloir redémarer?","payloadType":"str","topic":"","x":136.5,"y":83,"wires":[["34906464.d6b57c"]]},{"id":"fb875439.b84778","type":"function","z":"2382edab.72d392","name":"PWM","func":"msg1={};\nmsg2={};\n\nmsg1.payload = Math.abs(msg.payload);\nmsg2.payload = (msg.payload>0)?true:false;\nreturn [msg1,msg2];","outputs":2,"noerr":0,"x":828.5,"y":112,"wires":[["207dfbe0.2c4954"],["5eaa7208.71508c"]]},{"id":"f5cde2d6.fe40e","type":"ui_gauge","z":"2382edab.72d392","name":"Output","group":"441a6c4.dddc794","order":2,"width":0,"height":0,"gtype":"gage","title":"Output","label":"Pwm","format":"{{value| number:0}}","min":"-100","max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"-50","seg2":"50","x":821.5,"y":208,"wires":[]},{"id":"e594f0cf.fcb47","type":"ui_button","z":"2382edab.72d392","name":"Power","group":"11f8763a.611cca","order":8,"width":0,"height":0,"passthru":false,"label":"Power","color":"","bgcolor":"","icon":"","payload":"Power","payloadType":"str","topic":"tab","x":189,"y":1106,"wires":[["cba30c13.4e341"]]},{"id":"13f332e1.7f4f3d","type":"ui_button","z":"2382edab.72d392","name":"Home","group":"96b9b4d5.2ba1a8","order":3,"width":0,"height":0,"passthru":false,"label":"Home","color":"","bgcolor":"","icon":"","payload":"Home","payloadType":"str","topic":"tab","x":190,"y":1162,"wires":[["cba30c13.4e341"]]},{"id":"bd9434d1.645ac8","type":"function","z":"2382edab.72d392","name":"Deviation","func":"var hdg = msg.payload;\nvar deviation = hdg-flow.get(\"cap\");\nif( deviation>180 ) deviation -=360;\nif( deviation<-180) deviation +=360;\n\n\nmsg.payload = deviation;\nreturn msg;","outputs":1,"noerr":0,"x":424.5,"y":157,"wires":[["ee81d8d.6d51f28","ca604486.068d88"]]}]

Return to “Astro Pi”

Who is online

Users browsing this forum: No registered users and 1 guest