-
Interesting, thanks.
April 1 my PC power supply emitted the magic smoke. I'm on a different one now and hoping that the a new PC power supply will fix the old one and lots of files will still be there. If not it's going to take a while to get most everything restored.
Then I will be able to try your fix. -
Some useful links:
https://github.com/xcoder123/MAX30100
https://github.com/sparkfun/SparkFun_MAX3010x_Sensor_Library
https://www.sparkfun.com/products/14045
Also lots of Max30100 boards on Amazon, prices all over the place.
-
A suggestion:
Using two way communication.
A sends a 16 byte random number to B
B receives random number and uses secret key and the AES block encryption to encrypt the random number. B sends the encrypted results to A.
A uses original random number and secret key to calculate the encrypted value to compare with the message from B. -
-
A Google search produces at least one path for a driver in C.
A bit of translation would produce the code that you need. ( a week to a month estimate)
https://github.com/adafruit/Adafruit_INA219This link is a good discussion of the chip
http://cdwilson.us/articles/understanding-the-INA219/A NODEjs version of the code
https://github.com/brettmarl/node-ina219
and another
https://libraries.io/npm/ina219Have fun sorting it all out.
-
-
Here are some things to try.
- Check the arguments to accel.ff(600,10);
The datasheet shows the 600 would be much smaller, Values between 300 mg and 600 mg
(0x05 to 0x09) are recommended. - Likewise the 10 Values between 100 ms
and 350 ms (0x14 to 0x46) are recommended
http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf
page 26
Register 0x28—THRESH_FF (Read/Write)
The THRESH_FF register is eight bits and holds the threshold
value, in unsigned format, for free-fall detection. The acceleration on
all axes is compared with the value in THRESH_FF to determine if
a free-fall event occurred. The scale factor is 62.5 mg/LSB. Note
that a value of 0 mg may result in undesirable behavior if the freefall
interrupt is enabled. Values between 300 mg and 600 mg
(0x05 to 0x09) are recommended.
Register 0x29—TIME_FF (Read/Write)
The TIME_FF register is eight bits and stores an unsigned time
value representing the minimum time that the value of all axes
must be less than THRESH_FF to generate a free-fall interrupt.
The scale factor is 5 ms/LSB. A value of 0 may result in undesirable
behavior if the free-fall interrupt is enabled. Values between 100 ms
and 350 ms (0x14 to 0x46) are recommended.- The interrupt polarity could be flipped.
Register 0x31 bit D5
INT_INVERT Bit
A value of 0 in the INT_INVERT bit sets the interrupts to active
high, and a value of 1 sets the interrupts to active low.
- Check the arguments to accel.ff(600,10);
-
Now you have me a bit worried. The oriental specifications for this device are sketchy at best.
It seems to contain 3 switches, 3 resistors and have 8 pins.
Connecting both ground and 3.3V from the Pico to this device without a proper diagram runs the risk of shorting 3.3 to ground and popping the fuse on the Pico, A Bad thing :(
If you have an ohmmeter that would provide a way to probe the device safely and figure out how it is wired. Short of that connect ground only and not the 3.3V. use the pin setup with pull up. The code that reads a Pico pin to light the LED can then be used as a test probe to puzzle out a proper wiring sequence. -
Translating C to Espruino Javascript
• #define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
So my guess is it becomes this:
function CHECK_BIT (val, pos) { return ((val) & (1<<(pos))); }
And the init_i2c function is puzzling to me. Looks like init_i2c("/dev/i2c-1"); is akin to calling I2C1.setup().
Some #define statements have to become functions.
Having done this for the LSM9DS1 IMU these snippets may help.
The other gotchas are handling the bytes read as unsigned or signed values, big or little endian and two’s compliment math. C programmers seem to grab a datasheet for a chip and #define everything in sight, at the end there tends to be a lot of unused stuff defined in the C code. I usually resort to commenting out blocks of stuff to see what complains and uncomment the complaints.void LSM9DS1::initI2C() { Wire.begin(); // Initialize I2C library } Becomes //Configuration //The I2C pins that the LSM9D01 is connected to //PICO I2C pins //IC1 sda=B7 scl=B6 //IC1 sda=B9 scl=B8 shim pins //IC3 sda=B4 scl=A8 //IC2 sda=B3 scl=B10 var W; function start(){ // console.log("start"); I2C3.setup({ scl :A8, sda: B4} ); //console.log(I2C3); var xgAddress= 0x6B;// Would be 0x1C if SDO_M is LOW var mAddress= 0x1e;// Would be 0x6A if SDO_AG is LOW W =require("slimLSM9DS1").connect(I2C3,xgAddress,mAddress); W.run();//Get it started
uint8_t LSM9DS1::I2CreadByte(uint8_t address, uint8_t subAddress) { int timeout = LSM9DS1_COMMUNICATION_TIMEOUT; uint8_t data; // `data` will store the register data Wire.beginTransmission(address); // Initialize the Tx buffer Wire.write(subAddress); // Put slave register address in Tx buffer Wire.endTransmission(true); // Send the Tx buffer, but send a restart to keep connection alive Wire.requestFrom(address, (uint8_t) 1); // Read one byte from slave register address while ((Wire.available() < 1) && (timeout-- > 0)) delay(1); if (timeout <= 0) return 255; //! Bad! 255 will be misinterpreted as a good value. data = Wire.read(); // Fill Rx buffer with result return data; // Return data read from slave register } Becomes /** 'mReadByte(subAddress) read a byte from the magnetometer at subaddress'*/ LSM9DS1.prototype.mReadByte=function(subAddress){ var x=this.mAddress; var data=Uint8Array(1); this.i2c.writeTo(x, subAddress); data=this.i2c.readFrom(x, 1); return data[0]; };//end mReadByte
uint8_t LSM9DS1::I2CreadBytes(uint8_t address, uint8_t subAddress, uint8_t * dest, uint8_t count) { int timeout = LSM9DS1_COMMUNICATION_TIMEOUT; Wire.beginTransmission(address); // Initialize the Tx buffer // Next send the register to be read. OR with 0x80 to indicate multi-read. Wire.write(subAddress | 0x80); // Put slave register address in Tx buffer Wire.endTransmission(true); // Send the Tx buffer, but send a restart to keep connection alive uint8_t i = 0; Wire.requestFrom(address, count); // Read bytes from slave register address while ((Wire.available() < count) && (timeout-- > 0)) delay(1); if (timeout <= 0) return -1; for (int i=0; i<count;) { if (Wire.available()) { dest[i++] = Wire.read(); } } return count; } Becomes /** 'mReadBytes(subAddress,count) read count bytes from magnetometer at subAddress'*/ LSM9DS1.prototype.mReadBytes=function(subAddress,count){ var x=this.mAddress; var dest=new Uint8Array(count); this.i2c.writeTo(x, subAddress|0x80); dest=this.i2c.readFrom(x, count); return dest; };//end mReadBytes
// Wire.h read and write protocols void LSM9DS1::I2CwriteByte(uint8_t address, uint8_t subAddress, uint8_t data) { Wire.beginTransmission(address); // Initialize the Tx buffer Wire.write(subAddress); // Put slave register address in Tx buffer Wire.write(data); // Put data in Tx buffer Wire.endTransmission(); // Send the Tx buffer } Becomes LSM9DS1.prototype.mWriteByte=function(subAddress,data){ //console.log("mWriteByte ",this.mAddress, subAddress, data); var x=this.mAddress; this.i2c.writeTo(x, subAddress,data); return 0; };//end mWriteByte
-
This code looks like it could be of use to you. It at least helps to sort out the various sequences of bytes that are needed to converse with the fuel gauge chip. Translating from C to JavaScript would need to be done. A starting point is to replace the #define variable 0xvalue with var variable= 0xvalue. For example
#define BQ27441_CONTROL_STATUS 0x0000
becomes
var BQ27441_CONTROL_STATUS= 0x0000;then functions need to be redefined
void init_i2c(char *DeviceName)
{
}
rewrite as
function init_i2c(DeviceName){
}
Lots of work from there to get it all working.https://github.com/chintanp/i2c-charger/blob/master/BQ-27441-Gauge/c/gauge.c
-
-
Looks like the ff function free fall is the right track.
There are two different interrupt pins on the chip a register controls which one is used
and a different register controls polarity.
Which interuppt pin is being used?ADXL345.prototype.interrupts = function(enable,map) { this.i2c.writeTo(this.a,[0x2E,enable,map]); }
http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf
page 27Register 0x2F—INT_MAP (R/W)
D7 D6 D5 D4 D3 D2 D1 D0 DATA_READY SINGLE_TAP DOUBLE_TAP Activity Inactivity FREE_FALL Watermark Overrun Any bits set to 0 in this register send their respective interrupts to
the INT1 pin, whereas bits set to 1 send their respective interrupts
to the INT2 pin. All selected interrupts for a given pin are OR’ed. -
http://www.espruino.com/modules/ADXL345.js
Several of the functions refer to a variable thresh, likely an abbreviation for threshold.
The tap function looks promising.
Accelerometer interrupts generally are tripped by a change larger than the threshold and exceeding a period of time.The datasheet for the ADXL345 might help you figure it out.
http://www.analog.com/en/products/mems/accelerometers/adxl345.html#product-overview -
This may help:
https://www.espruino.com/Pico+Buttons
Using the button and LED on the PicoclearWatch(); // remove our last watch setWatch(function(e) { digitalWrite(LED1, e.state); presses++; console.log("Pressed "+presses); }, BTN, { repeat: true, debounce : 50 });
Now using Pin B4 instead of the button, connect one of the encoder output to pin B4 and the other common wire to ground.
Use pinMode(B4,input_pullup)
http://www.espruino.com/Reference#l__global_pinModepinMode(B4,input_pullup); setWatch(function() { digitalPulse(LED2, 1, 50); }, B4, { repeat: true, debounce : 50, edge: "rising" }
See if the LED blinks as you turn the shaft encoder
-
The pimoroni link you cited points to this tutorial for Arduino. Looks like it uses ground and two digital input pins.
http://bildr.org/2012/08/rotary-encoder-arduino/
If needed you can examine the encoder module code that is located here.
http://www.espruino.com/modules/ -
The PICO page cites this datasheet link:
http://www.espruino.com/datasheets/STM32F401xD.pdf
I like the fuel gauge device for a battery. Hope you get it working.
Try connecting a battery. The assumptions often wind up being the problem.
These may also help:
Section 9.5.4 of
http://www.ti.com/lit/ds/symlink/bq27441-g1.pdfand
http://www.espruino.com/Reference#I2C
Looks like you have to send several bytes to get a response from the device.
If needed I can really confuse you with some code snippets from something else, that show sending the address and a sub address and a command byte. -
If 12 factor calibration is used on both accelerometer and magnetometer data, and the Rodrigues formula is applied do the magnetic dip statistics improve?
Code to apply 12 factor calibrations ( Using a LSM9DS1 IMU )
//Use 12 element calibration on raw count magnetometer data function cal8G(S){ var i; var mm=[0,0,0]; var scale=8; var mres=[ [0.970972836,0.171154738,-0.000344029], [-0.095223453,0.956653319,-0.000125418], [0.017179224,0.005190024,1], ]; var moff=[1057.176483,120.7727841,549.551664]; for(i=0;i<3;i++) S.m[i] -=moff[i]; for(i=0;i<3;i++) mm[i]=S.m[0]*mres[i][0]+S.m[1]*mres[i][1]+S.m[2]*mres[i][2]; for(i=0;i<3;i++)S.m[i]=mm[i]*scale/32768; }//end cal8G(S) //Use 12 element calibration on raw count accelerometer data function calA2(S){ var i; var mm=[0,0,0]; var scale=2; var mres=[ [1.005708319,-0.007635345,-1.55429E-05], [0.001530038,1.006717582,-9.04159E-05], [0.017299441,0.097632586,1] ]; var moff=[-126.0318135,-350.2409885,730.2274842]; for(i=0;i<3;i++) S.a[i] -=moff[i]; for(i=0;i<3;i++) mm[i]=S.a[0]*mres[i][0]+S.a[1]*mres[i][1]+S.a[2]*mres[i][2]; for(i=0;i<3;i++)S.a[i]=mm[i]*scale/32768; }//end cal8G(S) //////////////////// function readall(W){ if(W.magAvailable()){ W.readMag(); W.readAccel(); cal8G(W); calA2(W); console.log(W.a,',',W.m); //console.log(W.a); }//endif }//end readall
Data were collected and pasted into the following code that is used to determine the signs of the magnetometer axis that produce the best magnetic dip angle statistics.
function test(){ FF=require("Rodrigues").connect(); var i,j,k,l; var d=""; var t=[0,0,0]; console.log("mmm,mmp,mpm,mpp,pmm,pmp,ppm,ppp"); for(i=0;i<Adata.length;i++){ d=" "+i; A=FF.Setup(Adata[i],[0,0,1]); Theta=FF.theta; Kn=FF.Kn; A=FF.An; for(j=-1;j<2;j=j+2){ for(k=-1;k<2;k=k+2){ for(l=-1;l<2;l=l+2){ t[0]=Mdata[i][0]*j; t[1]=Mdata[i][1]*k; t[2]=Mdata[i][2]*l; B=FF.RotVector(t); An=FF.An; dip=pirate*Math.atan(B[2]/Math.sqrt(B[0]*B[0]+B[1]*B[1])); d=d+","+dip; }//nextl }//nextk }//nextj console.log(d); }//next i }
This produces output that looks like the following:
N mmm mmp mpm mpp pmm pmp ppm ppp 0 66.84 -65.86 63.19 -69.97 69.97 -63.19 65.86 -66.84 1 65.84 -67.25 63.43 -70.09 70.09 -63.43 67.25 -65.84 2 66.60 -64.70 61.16 -71.07 71.07 -61.16 64.70 -66.60 This output is copied into a CSV file and the CSV file is opened using Excel. Descriptive Statistics are then applied to the columns of data
Statistic mmm mmp mpm mpp pmm pmp ppm ppp Mean 36.62 -58.66 22.56 -72.11 72.11 -22.56 58.66 -36.62 Standard Error 7 4.84 8.39 0.39 0.39 8.39 4.84 7 Median 65.64 -72.26 65.17 -72.21 72.21 -65.17 72.26 -65.64 Mode #N/A #N/A #N/A #N/A #N/A #N/A #N/A #N/A Standard Deviation 58.16 40.16 69.67 3.27 3.27 69.67 40.16 58.16 Sample Variance 3382.36 1613.19 4853.89 10.67 10.67 4853.89 1613.19 3382.36 Kurtosis -0.42 3.95 -1.6 0.78 0.78 -1.6 3.95 -0.42 Skewness -1.16 2.31 -0.59 0.28 -0.28 0.59 -2.31 1.16 Range 177.14 150.05 169.77 14.85 14.85 169.77 150.05 177.14 Minimum -88.87 -87.5 -81.07 -79.4 64.56 -88.7 -62.55 -88.27 Maximum 88.27 62.55 88.7 -64.56 79.4 81.07 87.5 88.87 Sum 2526.48 -4047.26 1556.98 -4975.74 4975.74 -1556.98 4047.26 -2526.48 Count 69 69 69 69 69 69 69 69 COV 159.00% -68.00% 309.00% -5.00% 5.00% -309.00% 68.00% -159.00% The mpp and pmm columns produce the smallest coffoecoent of variation (COV) values. The following code uses the +X, -Y, -Z (pmm) combination.
function test(){ FF=require("Rodrigues").connect(); var i; for(i=0;i<Adata.length;i++){ A=FF.Setup(Adata[i],[0,0,1]); Theta=FF.theta; Kn=FF.Kn; A=FF.An; t[0]=Mdata[i][0]*1; t[1]=Mdata[i][1]*-1; t[2]=Mdata[i][2]*-1; B=FF.RotVector(t); An=FF.An; heading=pirate*Math.atan2(-B[1],B[0]); if(heading<0)heading+=360; dip=pirate*Math.atan(B[2]/Math.sqrt(B[0]*B[0]+B[1]*B[1])); console.log(i,',',A,',',An,',',B,',', Theta,',',heading,',',dip); }//next i }
This produces the following:
N ax ay az mx my mz m1x m1y m1z Tilt Heading Dip 0 0.12 0.04 0.99 0.08 0.37 0.92 -0.03 0.34 0.94 7.34 264.53 69.97 1 0.13 0.02 0.99 0.11 0.36 0.93 -0.02 0.34 0.94 7.66 267.24 70.09 2 0.13 0.06 0.99 0.11 0.38 0.92 -0.01 0.32 0.95 7.97 268.51 71.07 3 0.16 0.06 0.99 0.11 0.39 0.92 -0.04 0.33 0.94 9.72 263.55 70.79 4 0.16 0.08 0.98 -0.09 0.34 0.94 -0.24 0.26 0.94 10.39 227.72 69.28 5 0.06 0.07 1.00 -0.10 0.32 0.94 -0.16 0.25 0.96 5.34 237.84 72.82 6 0.08 0.05 1.00 -0.12 0.30 0.95 -0.19 0.25 0.95 5.16 232.69 71.77 7 0.08 0.06 0.99 -0.12 0.30 0.95 -0.20 0.25 0.95 5.79 231.24 71.55 8 0.12 -0.01 0.99 -0.17 -0.01 0.99 -0.28 0.01 0.96 6.68 181.35 73.45 9 0.13 -0.01 0.99 -0.18 0.00 0.98 -0.31 0.01 0.95 7.25 180.95 72.20 10 0.10 -0.02 0.99 -0.18 -0.01 0.98 -0.28 0.01 0.96 6.00 182.72 73.58 11 0.12 -0.01 0.99 -0.19 0.00 0.98 -0.30 0.01 0.95 6.82 181.88 72.27 12 0.09 0.05 0.99 -0.04 -0.21 0.98 -0.12 -0.26 0.96 5.94 114.97 73.10 13 0.07 0.05 1.00 -0.04 -0.23 0.97 -0.11 -0.28 0.95 4.89 110.49 72.52 14 0.08 0.05 1.00 -0.03 -0.23 0.97 -0.10 -0.28 0.95 5.31 110.53 72.62 15 0.09 0.05 1.00 -0.02 -0.23 0.97 -0.11 -0.28 0.95 5.68 111.32 72.63 16 0.08 0.09 0.99 0.08 -0.19 0.98 0.01 -0.28 0.96 7.09 88.93 73.76 17 0.11 0.09 0.99 0.10 -0.19 0.98 -0.01 -0.27 0.96 8.00 91.34 74.09 18 0.10 0.08 0.99 0.11 -0.20 0.97 0.01 -0.28 0.96 7.25 87.14 73.69 19 0.13 0.08 0.99 0.10 -0.20 0.97 -0.02 -0.28 0.96 8.80 94.39 73.48 20 0.12 0.14 0.98 0.31 -0.08 0.95 0.20 -0.21 0.96 10.39 46.51 73.30 21 0.09 0.12 0.99 0.30 -0.09 0.95 0.21 -0.20 0.96 8.76 44.28 73.03 22 0.09 0.12 0.99 0.30 -0.09 0.95 0.21 -0.21 0.95 8.76 45.22 72.50 23 0.08 0.11 0.99 0.30 -0.08 0.95 0.22 -0.19 0.96 7.84 40.87 73.14 24 -0.11 0.02 0.99 0.19 0.08 0.98 0.30 0.06 0.95 6.49 349.05 72.11 25 -0.15 0.00 0.99 0.17 0.05 0.98 0.32 0.05 0.95 8.75 350.49 71.26 26 -0.16 0.02 0.99 0.16 0.05 0.99 0.32 0.03 0.95 9.48 354.59 71.02 27 -0.17 -0.03 0.99 0.15 0.03 0.99 0.31 0.06 0.95 9.79 349.45 71.54 28 -0.03 -0.05 1.00 0.13 0.23 0.97 0.15 0.27 0.95 3.14 299.10 71.81 29 -0.04 -0.03 1.00 0.11 0.23 0.97 0.15 0.26 0.95 2.85 299.20 72.50 30 -0.03 -0.04 1.00 0.12 0.23 0.97 0.15 0.26 0.95 2.87 300.37 72.21 31 -0.01 -0.05 1.00 0.12 0.22 0.97 0.13 0.27 0.96 2.70 295.80 72.84 32 -0.15 -0.12 0.98 -0.15 0.17 0.97 -0.01 0.28 0.96 10.81 268.65 73.89 33 -0.14 -0.13 0.98 -0.16 0.17 0.97 -0.03 0.29 0.96 10.96 264.77 72.81 34 -0.14 -0.11 0.98 -0.17 0.16 0.97 -0.03 0.27 0.96 10.31 263.52 74.28 35 -0.09 -0.13 0.99 -0.14 0.15 0.98 -0.05 0.27 0.96 9.17 259.69 73.83 36 0.95 -0.10 0.31 0.90 0.32 0.28 0.04 0.41 0.91 72.21 275.70 65.49 37 0.94 -0.10 0.34 0.89 0.33 0.31 0.04 0.42 0.91 70.14 274.89 65.04 38 0.94 -0.10 0.32 0.88 0.33 0.33 0.01 0.43 0.90 71.15 270.85 64.56 39 0.94 -0.11 0.33 0.88 0.32 0.34 0.00 0.43 0.90 70.81 270.42 64.75 40 0.08 -0.04 -1.00 -0.02 0.26 -0.97 0.31 0.08 0.95 -5.33 345.27 71.59 41 0.09 -0.06 -0.99 0.01 0.25 -0.97 0.30 0.07 0.95 -6.19 347.94 71.84 42 0.06 -0.08 -1.00 0.02 0.26 -0.97 0.31 -0.12 0.94 -5.42 21.98 70.65 43 0.12 -0.07 -0.99 0.04 0.24 -0.97 0.31 0.08 0.95 -8.02 345.75 71.41 44 -0.92 -0.36 -0.18 -0.97 -0.23 -0.02 0.10 0.18 0.98 -79.40 298.09 77.90 45 -0.92 -0.37 -0.16 -0.97 -0.23 -0.05 0.05 0.18 0.98 -80.68 286.11 79.40 46 -0.90 -0.40 -0.18 -0.96 -0.26 -0.03 0.07 0.20 0.98 -79.86 289.55 77.59 47 -0.90 -0.40 -0.17 -0.96 -0.28 -0.03 0.07 0.18 0.98 -80.38 291.45 78.69 48 -0.90 -0.42 -0.15 -0.95 -0.30 0.01 0.08 0.18 0.98 -81.59 294.28 78.29 49 -0.97 -0.07 0.21 -0.98 -0.20 -0.04 -0.24 -0.15 0.96 77.69 147.66 73.67 50 -0.95 -0.08 0.31 -0.98 -0.21 0.00 -0.29 -0.15 0.94 71.91 152.86 70.74 51 -0.95 -0.09 0.31 -0.98 -0.21 0.05 -0.25 -0.15 0.96 72.06 149.36 73.18 52 -0.94 -0.08 0.33 -0.98 -0.20 0.05 -0.27 -0.15 0.95 70.50 151.66 72.02 53 0.07 -0.06 -1.00 0.39 0.00 -0.92 0.04 0.33 0.94 -5.19 276.97 70.45 54 0.09 -0.08 -0.99 0.39 0.00 -0.92 0.02 0.31 0.95 -6.85 274.35 71.97 55 0.06 -0.10 -0.99 0.38 -0.01 -0.92 0.21 0.26 0.94 -6.54 309.08 70.25 56 0.14 -0.05 -0.99 0.43 -0.01 -0.90 -0.20 0.22 0.96 -8.75 227.03 72.81 57 0.99 -0.09 -0.15 0.98 0.09 0.17 -0.29 0.20 0.94 -81.59 215.17 69.31 58 0.99 -0.08 -0.09 0.98 0.09 0.19 -0.26 0.19 0.95 -84.78 215.22 71.22 59 0.99 -0.08 -0.08 0.98 0.10 0.18 -0.24 0.20 0.95 -85.65 220.13 71.89 60 0.99 -0.10 -0.08 0.98 0.08 0.17 -0.23 0.20 0.95 -85.15 220.17 72.19 61 -0.16 -0.98 -0.13 -0.31 -0.95 0.06 -0.13 0.21 0.97 -82.70 238.86 75.94 62 -0.15 -0.98 -0.10 -0.32 -0.95 0.03 -0.15 0.15 0.98 -84.48 224.53 77.45 63 -0.17 -0.98 -0.13 -0.33 -0.94 0.06 -0.13 0.21 0.97 -82.56 239.09 75.75 64 -0.18 -0.98 -0.08 -0.33 -0.94 0.05 -0.12 0.16 0.98 -85.15 231.68 78.45 65 -0.17 0.97 0.18 -0.57 0.81 0.17 -0.41 -0.09 0.91 79.85 167.84 65.39 66 -0.23 0.95 0.21 -0.59 0.79 0.17 -0.38 -0.06 0.92 77.75 170.57 67.09 67 -0.24 0.94 0.23 -0.60 0.78 0.19 -0.39 -0.08 0.92 76.95 168.65 66.85 68 -0.22 0.94 0.27 -0.61 0.77 0.20 -0.42 -0.04 0.91 74.08 174.05 65.15 -
Rework the results table:
ax ay az mx my mz m1x m1y m1z Tilt Heading Dip 0.005 0.04 0.999 -0.039 0.34 0.94 -0.044 0.302 0.952 2.326 351.676 72.231 0.054 0.06 0.997 0.02 0.369 0.929 -0.03 0.312 0.95 4.635 354.468 71.747 0.046 0.062 0.997 0.01 0.356 0.934 -0.033 0.298 0.954 4.401 353.694 72.543 0.089 0.071 0.994 0.022 0.361 0.932 -0.062 0.294 0.954 6.512 348.128 72.507 0.068 0.02 0.998 -0.164 0.235 0.958 -0.228 0.216 0.949 4.036 313.42 71.701 0.124 0.03 0.992 -0.143 0.244 0.959 -0.261 0.215 0.941 7.324 309.538 70.221 0.092 0.043 0.995 -0.145 0.25 0.957 -0.232 0.208 0.95 5.818 311.918 71.825 0.116 0.054 0.992 -0.138 0.266 0.954 -0.249 0.215 0.944 7.351 310.819 70.781 0.089 0.054 0.995 -0.247 0.043 0.968 -0.332 -0.009 0.943 5.964 268.508 70.605 0.077 0.042 0.996 -0.246 0.036 0.969 -0.32 -0.004 0.948 5.015 269.292 71.365 0.089 0.062 0.994 -0.256 0.037 0.966 -0.341 -0.023 0.94 6.245 266.217 70.018 0.076 0.059 0.995 -0.236 0.024 0.971 -0.309 -0.033 0.95 5.512 263.948 71.882 0.116 0.04 0.992 -0.074 -0.217 0.973 -0.186 -0.256 0.949 7.038 216.003 71.568 0.095 0.023 0.995 -0.089 -0.221 0.971 -0.182 -0.243 0.953 5.637 216.774 72.344 0.075 0.032 0.997 -0.086 -0.205 0.975 -0.158 -0.237 0.959 4.659 213.743 73.46 0.094 0.02 0.995 -0.094 -0.21 0.973 -0.186 -0.229 0.956 5.543 219.004 72.851 -0.024 0.081 0.996 -0.035 -0.249 0.968 -0.012 -0.327 0.945 4.84 182.173 70.919 -0.022 0.069 0.997 -0.035 -0.239 0.97 -0.014 -0.305 0.952 4.13 182.653 72.208 -0.04 0.077 0.996 -0.034 -0.248 0.968 0.004 -0.322 0.947 4.976 179.263 71.195 -0.047 0.06 0.997 -0.048 -0.248 0.968 -0.003 -0.306 0.952 4.4 180.514 72.177 0.128 0.023 0.991 0.327 -0.174 0.929 0.205 -0.196 0.959 7.486 133.68 73.513 0.147 0.006 0.989 0.365 -0.157 0.918 0.226 -0.162 0.961 8.46 125.583 73.858 0.143 -0.022 0.99 0.38 -0.173 0.909 0.246 -0.152 0.957 8.292 121.771 73.191 0.194 -0.018 0.981 0.4 -0.166 0.901 0.218 -0.149 0.965 11.208 124.264 74.7 -0.098 -0.003 0.995 0.215 -0.012 0.976 0.31 -0.009 0.951 5.611 91.609 71.952 -0.022 -0.032 0.999 0.238 -0.01 0.971 0.259 0.02 0.966 2.197 85.483 74.949 -0.039 -0.01 0.999 0.234 0.013 0.972 0.272 0.023 0.962 2.312 85.191 74.17 -0.068 -0.002 0.998 0.229 0.048 0.972 0.295 0.05 0.954 3.915 80.368 72.575 -0.022 -0.017 1 0.046 0.24 0.97 0.067 0.257 0.964 1.589 14.58 74.577 -0.022 -0.083 0.996 0.071 0.212 0.975 0.092 0.292 0.952 4.916 17.528 72.195 0.021 -0.075 0.997 0.09 0.208 0.974 0.07 0.28 0.957 4.452 14.09 73.209 0.003 -0.122 0.993 0.119 0.199 0.973 0.115 0.316 0.942 7.007 20.062 70.328 -
Software Gimbaled Compass
The data were acquired using the 12 element calibration of a LSM9DS1 IMU
The 12 element calibration was obtained using a collection of raw data points taken at many different orientations, and processed using am Excel spreadsheet and the solver function to fit the data to a spherical surface. This method is discussed further in the following conversation link. (note a long cable was used to minimize the IMU from the magnetic fields of the table and computer)
http://forum.espruino.com/conversations/298287/
The following code was used to apply the calibrations://Use 12 element calibration on raw count magnetometer data function cal8G(S){ var i; var mm=[0,0,0]; var scale=8; var mres=[ [0.970972836,0.171154738,-0.000344029], [-0.095223453,0.956653319,-0.000125418], [0.017179224,0.005190024,1], ]; var moff=[1057.176483,120.7727841,549.551664]; for(i=0;i<3;i++) S.m[i] -=moff[i]; for(i=0;i<3;i++) mm[i]=S.m[0]*mres[i][0]+S.m[1]*mres[i][1]+S.m[2]*mres[i][2]; for(i=0;i<3;i++)S.m[i]=mm[i]*scale/32768; }//end cal8G(S) function readall(W){ var heading,dip; var pirate=180/Math.PI; if(W.magAvailable()){ W.readMag(); W.readAccel(); cal8G(W); W.m[2]=-W.m[2]; heading=pirate*Math.atan2(W.m[0],-W.m[1]); if(heading<0)heading +=360; dip=pirate*Math.atan(W.m[2]/Math.sqrt(W.m[0]*W.m[0]+W.m[1]*W.m[1])); console.log(W.a,',',W.m,',',heading,',',dip); }//endif }//end readall
The dataset
The following dataset was obtained using the above calibration with the IMU approximately level starting at 0 and proceeding by approximate 45 degree steps.
(360, 315, 270 ,225 ,180 ,135 ,90 ,45)ax ay az mx my mz heading dip 0.005221328 0.038883267 0.965721486 -0.017482972 -0.152165638 0.420466182 353.4457781 69.98441706 0.053742128 0.060580467 0.998802538 0.008982245 -0.163318019 0.411716107 3.148009986 68.333274 0.045889728 0.061932867 1.00154912 0.004620515 -0.160749845 0.421310071 1.646428435 69.10788548 0.086792528 0.069459267 0.973839161 0.009863154 -0.162452582 0.419266816 3.474393718 68.78469698 0.065286328 0.019067667 0.963829397 -0.073864097 -0.105995351 0.43284815 325.1288376 73.38107377 0.122655728 0.030180867 0.982750293 -0.064172881 -0.109797951 0.430729882 329.6952783 73.5503905 0.090484328 0.042881667 0.982628223 -0.064828213 -0.112110436 0.429526044 329.9612166 73.22163288 0.113982928 0.052818867 0.973839161 -0.061649354 -0.118602017 0.424600681 332.5345796 72.5255674 0.088491928 0.053877267 0.991661425 -0.11020607 -0.019251924 0.432085705 279.9090234 75.48383928 0.075717128 0.041294067 0.982750293 -0.108910915 -0.016052224 0.429125695 278.3843782 75.61167923 0.088609128 0.061932867 0.987999316 -0.112078203 -0.016217852 0.423323378 278.2336196 75.02319545 0.073373128 0.057581667 0.966453908 -0.105814424 -0.010888918 0.434674039 275.875387 76.24886152 0.110994328 0.038648067 0.951927543 -0.033200414 0.097015611 0.435331124 198.8918302 76.74596353 0.092652528 0.022419267 0.965721486 -0.040103186 0.098880808 0.435206472 202.0760467 76.22399812 0.073490328 0.031886067 0.982994434 -0.038122585 0.091081115 0.432258614 202.7120608 77.13311516 0.090367128 0.019302867 0.952232718 -0.042207576 0.093858834 0.4357436 204.2130729 76.71158587 -0.023316872 0.080160867 0.985924121 -0.015551534 0.110731677 0.43034586 187.994526 75.43470381 -0.021148672 0.067577667 0.980675098 -0.015549808 0.106691785 0.433040365 188.2921962 76.01869954 -0.038845872 0.075339267 0.973656056 -0.01500844 0.109727365 0.427652799 187.7885496 75.48110246 -0.045819272 0.058287267 0.963463186 -0.021450093 0.110121715 0.429476292 191.0223588 75.35988506 0.124589528 0.022713267 0.963829397 0.145392752 0.077359058 0.413377119 118.0160836 68.27734928 0.138946528 0.005249667 0.934837701 0.160771714 0.068957421 0.404331212 113.2152255 66.60400467 0.133613928 -0.020328333 0.927330377 0.16788097 0.076340165 0.401990206 114.4526189 65.35553348 0.188404928 -0.017505933 0.954918265 0.177739414 0.073471827 0.40011101 112.4586468 64.32722696 -0.098676472 -0.003393933 1.005028123 0.093650207 0.005196927 0.424718089 93.17625478 77.54674095 -0.021090072 -0.030912333 0.975548146 0.103647753 0.004453889 0.423075824 92.46056617 76.22222377 -0.038787272 -0.009861933 0.991112109 0.100384753 -0.005683938 0.417053226 86.75928569 76.4454667 -0.064454072 -0.001747533 0.942222954 0.100278956 -0.021119951 0.424901951 78.10664105 76.44022583 -0.021617472 -0.017564733 1.003990526 0.020143978 -0.104996777 0.423349642 10.86041872 75.8270026 -0.021793272 -0.080892333 0.974083302 0.030669343 -0.092007227 0.423620563 18.43509874 77.10486344 0.019871328 -0.071307933 0.95082891 0.039384256 -0.090485263 0.423949378 23.52137433 76.89631367 0.003053128 -0.116231133 0.946007133 0.051640347 -0.086696446 0.42372145 30.77995151 76.60433025 Using the Dip Angle Statistic to Determine Axis Signs
The data were then processed using the Rodrigues.js module into datasets where various combinations of the signs of the X, Y , and Z axis were manipulated. The following table shows the statistics of the Dip angle as the signs of the X, Y amd Z data were changed. Compare the Dip Range
Statistic Raw x,y,z x,y,-z x,-y,-z Mean 73.68802652 -73.39285194 73.27452467 72.29268725 Standard Error 0.683692412 1.227276358 0.898702904 0.23150967 Median 75.48247087 -75.00020203 73.83858428 72.20170648 Mode #N/A #N/A #N/A #N/A Standard Deviation 3.867548323 6.94252348 5.083831342 1.309616458 Sample Variance 14.95793003 48.19863227 25.84534112 1.715095267 Kurtosis 0.028460278 1.561952363 -0.906235772 -0.460864552 Skewness -1.151317713 1.323796746 0.029464285 0.276014742 Range 13.21951399 29.10003759 17.46765933 4.930872778 Minimum 64.32722696 -83.15527605 64.49625552 70.01846639 Maximum 77.54674095 -54.05523846 81.96391485 74.94933917 Sum 2358.016849 -2348.571262 2344.784789 2313.365992 Count 32 32 32 32 Code used to apply the Rodrigues.js module
The follwing code was used to apply the Rodrigues.js module.
function test(){ FF=require("Rodrigues").connect(); var i; for(i=0;i<Adata.length;i++){ // for(i=0;i<4;i++){ A=FF.Setup(Adata[i],[0,0,1]); Theta=FF.theta; Kn=FF.Kn; A=FF.An; // Mdata[i][0]=-Mdata[i][0]; // Positive x, negate y and z to minimize dip range // z was negated in acquisition program Mdata[i][1]=-Mdata[i][1]; B=FF.RotVector(Mdata[i]); An=FF.An; heading=pirate*Math.atan2(B[1],B[0]); if(heading<0)heading +=360; dip=pirate*Math.atan(B[2]/Math.sqrt(B[0]*B[0]+B[1]*B[1])); console.log(i,',',A,',',Kn,',',An,',',B,',', Theta,',',heading,',',dip); }//next i }
The Results
The final output using positive X and negative Y and Z follows:
( ais accelerometer, k is rotation axis, m raw data, m1 is processed data; vectors have been Normed to unit vectors)N ax ay az kx ky kz mx my mz m1x m1y m1z Tilt Heading Dip 0 0.005 0.040 0.999 0.991 -0.133 0.000 -0.039 0.340 0.940 -0.044 0.302 0.952 2.326 351.676 72.231 1 0.054 0.060 0.997 0.748 -0.664 0.000 0.020 0.369 0.929 -0.030 0.312 0.950 4.635 354.468 71.747 2 0.046 0.062 0.997 0.803 -0.595 0.000 0.010 0.356 0.934 -0.033 0.298 0.954 4.401 353.694 72.543 3 0.089 0.071 0.994 0.625 -0.781 0.000 0.022 0.361 0.932 -0.062 0.294 0.954 6.512 348.128 72.507 4 0.068 0.020 0.998 0.280 -0.960 0.000 -0.164 0.235 0.958 -0.228 0.216 0.949 4.036 313.420 71.701 5 0.124 0.030 0.992 0.239 -0.971 0.000 -0.143 0.244 0.959 -0.261 0.215 0.941 7.324 309.538 70.221 6 0.092 0.043 0.995 0.428 -0.904 0.000 -0.145 0.250 0.957 -0.232 0.208 0.950 5.818 311.918 71.825 7 0.116 0.054 0.992 0.420 -0.907 0.000 -0.138 0.266 0.954 -0.249 0.215 0.944 7.351 310.819 70.781 8 0.089 0.054 0.995 0.520 -0.854 0.000 -0.247 0.043 0.968 -0.332 -0.009 0.943 5.964 268.508 70.605 9 0.077 0.042 0.996 0.479 -0.878 0.000 -0.246 0.036 0.969 -0.320 -0.004 0.948 5.015 269.292 71.365 10 0.089 0.062 0.994 0.573 -0.820 0.000 -0.256 0.037 0.966 -0.341 -0.023 0.940 6.245 266.217 70.018 11 0.076 0.059 0.995 0.617 -0.787 0.000 -0.236 0.024 0.971 -0.309 -0.033 0.950 5.512 263.948 71.882 12 0.116 0.040 0.992 0.329 -0.944 0.000 -0.074 -0.217 0.973 -0.186 -0.256 0.949 7.038 216.003 71.568 13 0.095 0.023 0.995 0.235 -0.972 0.000 -0.089 -0.221 0.971 -0.182 -0.243 0.953 5.637 216.774 72.344 14 0.075 0.032 0.997 0.398 -0.917 0.000 -0.086 -0.205 0.975 -0.158 -0.237 0.959 4.659 213.743 73.460 15 0.094 0.020 0.995 0.209 -0.978 0.000 -0.094 -0.210 0.973 -0.186 -0.229 0.956 5.543 219.004 72.851 16 -0.024 0.081 0.996 0.960 0.279 0.000 -0.035 -0.249 0.968 -0.012 -0.327 0.945 4.840 182.173 70.919 17 -0.022 0.069 0.997 0.954 0.299 0.000 -0.035 -0.239 0.970 -0.014 -0.305 0.952 4.130 182.653 72.208 18 -0.040 0.077 0.996 0.889 0.458 0.000 -0.034 -0.248 0.968 0.004 -0.322 0.947 4.976 179.263 71.195 19 -0.047 0.060 0.997 0.786 0.618 0.000 -0.048 -0.248 0.968 -0.003 -0.306 0.952 4.400 180.514 72.177 20 0.128 0.023 0.991 0.179 -0.984 0.000 0.327 -0.174 0.929 0.205 -0.196 0.959 7.486 133.680 73.513 21 0.147 0.006 0.989 0.038 -0.999 0.000 0.365 -0.157 0.918 0.226 -0.162 0.961 8.460 125.583 73.858 22 0.143 -0.022 0.990 -0.150 -0.989 0.000 0.380 -0.173 0.909 0.246 -0.152 0.957 8.292 121.771 73.191 23 0.194 -0.018 0.981 -0.093 -0.996 0.000 0.400 -0.166 0.901 0.218 -0.149 0.965 11.208 124.264 74.700 24 -0.098 -0.003 0.995 -0.034 0.999 0.000 0.215 -0.012 0.976 0.310 -0.009 0.951 5.611 91.609 71.952 25 -0.022 -0.032 0.999 -0.826 0.564 0.000 0.238 -0.010 0.971 0.259 0.020 0.966 2.197 85.483 74.949 26 -0.039 -0.010 0.999 -0.246 0.969 0.000 0.234 0.013 0.972 0.272 0.023 0.962 2.312 85.191 74.170 27 -0.068 -0.002 0.998 -0.027 1.000 0.000 0.229 0.048 0.972 0.295 0.050 0.954 3.915 80.368 72.575 28 -0.022 -0.017 1.000 -0.631 0.776 0.000 0.046 0.240 0.970 0.067 0.257 0.964 1.589 14.580 74.577 29 -0.022 -0.083 0.996 -0.966 0.260 0.000 0.071 0.212 0.975 0.092 0.292 0.952 4.916 17.528 72.195 30 0.021 -0.075 0.997 -0.963 -0.268 0.000 0.090 0.208 0.974 0.070 0.280 0.957 4.452 14.090 73.209 31 0.003 -0.122 0.993 -1.000 -0.026 0.000 0.119 0.199 0.973 0.115 0.316 0.942 7.007 20.062 70.328 -
-
Used a long cable to move magnetometer away from the table and computer with improved results.
8 Gauss range
11Jan2017
LSM9DS1 long cableoffset value axis xgain ygain zgain xoffset 1057.176483 x 0.970972836 -0.095223453 0.017179224 yoffset 120.7727841 y 0.171154738 0.956653319 0.005190024 zoffset 549.551664 z -0.000344029 -0.000125418 1 Stat Value Mean 1805.82288 Standard Error 2.302069588 Median 1805.330298 Mode #N/A Standard Deviation 20.20057865 Sample Variance 408.0633778 Kurtosis 0.449741028 Skewness 0.019637359 Range 97.68571284 Minimum 1757.482648 Maximum 1855.168361 Sum 139048.3617 Count 77 COV 1.12% N x y z r x1 y1 z1 r1 error error^2 0 481 -114 -1116 1220.578961 -1655867 -5512957.334 -4481757046 4481760743 -2241780074 5.02558E+18 1 1150 82 -1248 1699.037375 -2393599 -4101041.62 -6041270293 6041272159 -3801291491 1.44498E+19 2 1223 1763 1306 2511.87858 2783145 4445402.421 8208139517 8208141193 -5968160524 3.56189E+19 3 -497 1005 1203 1644.458269 3815848 -550325.0282 9822473543 9822474300 -7582493631 5.74942E+19 4 2030 1599 312 2602.891661 366043 3769985.976 2027116432 2027119971 212860697.9 4.53097E+16 5 1109 -301 -1253 1700.144406 -2848644 -5140973.94 -7028156509 7028158967 -4788178298 2.29267E+19 6 429 -1157 -545 1348.968124 -2266216 -7282210.964 -5081260925 5081266649 -2841285980 8.07291E+18 7 52 -1187 -15 1188.233142 -1197310 -7126541.529 -2239969012 2239980669 0 0 8 1509 892 -981 2008.757327 -1462570 -1017395.195 -3627393468 3627393906 -1387413237 1.92492E+18 9 1607 1377 -648 2213.251454 -550865 914976.1828 -1241463461 1241463920 998516748.2 9.97036E+17 10 2039 1361 -281 2467.549999 -669396 2212286.456 -919612333 919615237.6 1320365431 1.74336E+18 11 1211 1171 -923 1920.85684 -656518 -727515.6291 -1916284327 1916284578 323696091.1 1.04779E+17 12 418 1637 1422 2208.297308 3762777 2951937.793 10226948810 10226949928 -7986969260 6.37917E+19 13 352 1627 1426 2191.919022 3836897 2821260.374 10372358286 10372359379 -8132378711 6.61356E+19 14 -50 1486 -151 1494.488876 2257316 -809238.2217 4924569343 4924569927 -2684589258 7.20702E+18 15 939 1372 -793 1841.997286 101834 -470986.6254 -209753014 209753567.5 2030227101 4.12182E+18 16 1927 1686 409 2592.914576 724900 3973031.015 2885928000 2885930826 -645950157.2 4.17252E+17 17 -32 1678 235 1694.677845 2949962 338386.0304 6888765729 6888766369 -4648785700 2.16112E+19 18 1297 1908 182 2314.259493 1527991 3086982.486 4145556064 4145557495 -1905576826 3.63122E+18 19 2097 1616 454 2686.071667 475455 4160036.49 2455909180 2455912749 -215932080.7 4.66267E+16 20 -556 1068 236 1226.970252 2808457 -2082511.029 6449109003 6449109951 -4209129282 1.77168E+19 21 -466 1183 1146 1711.712885 3941057 -144274.6037 10026168448 10026169224 -7786188555 6.06247E+19 22 1754 1621 1246 2693.821264 1862825 4892237.013 6312980978 6312983148 -4073002480 1.65893E+19 23 2161 45 -951 2361.429017 -3346358 -1987850.236 -7430868391 7430869410 -5190888742 2.69453E+19 24 1370 1708 1416 2607.5314 2660189 4737898.003 8122950769 8122952586 -5882971918 3.46094E+19 25 -376 489 -587 851.5080739 837574 -4584451.155 1266377324 1266385899 973594769.5 9.47887E+17 26 1526 1354 -749 2173.244809 -601318 553490.6629 -1496994925 1496995148 742985520.5 5.52027E+17 27 408 758 -1043 1352.359789 -338112 -3326583.487 -1601564975 1601568465 638412203.2 4.0757E+17 28 2462 862 1451 2984.943718 234602 4525753.577 3288154671 3288157794 -1048177125 1.09868E+18 29 1135 1979 568 2351.018928 2287251 3624842.703 6203839725 6203841206 -3963860537 1.57122E+19 30 -611 409 1331 1520.579824 3333728 -2030604.264 8925017953 8925018807 -6685038138 4.46897E+19 31 -450 -603 1254 1462.403843 1718497 -4425703.656 5429285478 5429287554 -3189306885 1.01717E+19 32 2286 1349 901 2803.105064 428622 4545555.819 2966103310 2966106824 -726126155.4 5.27259E+17 33 598 -485 2237 2365.79754 1747250 -732208.3364 7000183420 7000183676 -4760203008 2.26595E+19 34 1100 -1207 1827 2450.464854 -315408 -2367095.8 2224668352 2224669634 15311034.96 2.34428E+14 35 2565 461 -448 2644.32411 -2702145 570664.8623 -5320722523 5320723240 -3080742571 9.49097E+18 36 -174 1541 178 1560.974375 2879685 -340738.7636 6629862586 6629863220 -4389882552 1.92711E+19 37 -700 526 1097 1403.597164 3316100 -2272732.031 8570767797 8570768740 -6330788071 4.00789E+19 38 -699 -193 940 1187.202594 2186967 -4335253.641 5968204807 5968206782 -3728226114 1.38997E+19 39 1584 1159 -782 2112.785129 -968071 107951.3846 -2304459926 2304460132 -64479463.23 4.1576E+15 40 1406 -1236 1693 2524.04061 -896372 -2140392.25 900192221 900195211.9 1339785457 1.79503E+18 41 1326 1811 -121 2247.807376 1000608 2394331.492 2649974684 2649975955 -409995285.9 1.68096E+17 42 -456 1301 749 1568.928934 3605094 -483732.4905 8815751912 8815752662 -6575771994 4.32408E+19 43 -761 437 912 1265.635809 3053439 -2904155.285 7763145551 7763146695 -5523166026 3.05054E+19 44 25 1341 -476 1423.194295 1583371 -1580481.75 3101342793 3101343600 -861362931.3 7.41946E+17 45 2116 1514 209 2610.236196 23796 3533214.309 1191667249 1191672487 1048308182 1.09895E+18 46 2183 266 1949 2938.510847 403512 3373582.734 4197506676 4197508051 -1957527382 3.83191E+18 47 969 -4 2371 2561.370336 2073630 1326705.535 7962174568 7962174949 -5722194280 3.27435E+19 48 832 -52 2327 2471.812493 2128986 901011.0785 7988609359 7988609694 -5748629025 3.30467E+19 49 2158 959 -608 2438.505485 -1736301 866958.8605 -3571057200 3571057727 -1331077059 1.77177E+18 50 1638 934 -908 2092.812462 -1480891 -572675.0196 -3540718745 3540719101 -1300738432 1.69192E+18 51 821 1310 1917 2462.728162 3428256 3629272.403 10241084758 10241085975 -8001105306 6.40177E+19 52 2220 1390 874 2761.227263 532055 4492006.001 3135161893 3135165156 -895184487.5 8.01355E+17 53 2119 1382 -198 2537.575418 -641961 2537448.933 -735938824 735943478.4 1504037190 2.26213E+18 54 -249 1355 -71 1379.516944 2430822 -1344846.092 5341571389 5341572111 -3101591443 9.61987E+18 55 47 1240 -612 1383.60146 1260401 -2020448.989 2248630642 2248631903 -8651234.314 7.48439E+13 56 -24 -44 -873 874.4375335 -641878 -5795536.348 -2150918337 2150926241 89054427.99 7.93069E+15 57 -141 -809 -407 916.52114 -934354 -7149593.281 -2221788011 2221799711 18180957.7 3.30547E+14 58 105 -1389 200 1407.247668 -1268621 -7190333.493 -2108617729 2108630370 131350298.6 1.72529E+16 59 -158 959 -583 1133.372842 1184142 -3026900.242 2067914284 2067916838 172063830.3 2.9606E+16 60 1045 1836 -175 2119.798575 1318984 1890898.208 3186098836 3186099670 -946119001.5 8.95141E+17 61 2656 329 -355 2699.741099 -2876226 546643.9099 -5551041308 5551042080 -3311061411 1.09631E+19 62 2783 418 64 2814.943872 -2414431 1675006.865 -4008488164 4008489241 -1768508572 3.12762E+18 63 -801 499 533 1083.831629 2728394 -3439629.992 6585238109 6585239573 -4345258904 1.88813E+19 64 -121 -1190 392 1258.731504 -495703 -6758716.115 -281175684 281257339.9 1958723329 3.8366E+18 65 1790 1654 1142 2691.464285 1735883 4865270.691 5921807007 5921809260 -3681828591 1.35559E+19 66 935 -1637 1115 2190.255465 -1527604 -4898399.044 -1294023939 1294034112 945946556.8 8.94815E+17 67 2392 574 1629 2950.386585 159968 3976113.502 3333381785 3333384160 -1093403492 1.19553E+18 68 1355 1923 335 2376.168975 1659256 3474806.948 4632299241 4632300841 -2392320173 5.7232E+18 69 118 838 -831 1186.05607 383324 -3269728.886 124190111 124233738.3 2115746930 4.47639E+18 70 2301 -1224 1134 2842.311207 -2670137 -1508863.429 -3341740176 3341741583 -1101760915 1.21388E+18 71 93 1625 -112 1631.507891 2307303 -152990.882 5117959913 5117960435 -2877979767 8.28277E+18 72 914 588 -1194 1614.551331 -1373273 -3142203.132 -3862053767 3862055289 -1622074621 2.63113E+18 73 1457 421 -1209 1939.528551 -2287084 -2663776.435 -5683800959 5683802043 -3443821375 1.18599E+19 74 29 -240 -861 894.2941351 -949562 -6178082.069 -2777485328 2777492361 -537511692.8 2.88919E+17 75 1035 1729 -460 2066.946056 848867 1136466.219 1824721631 1824722182 415258486.3 1.7244E+17 76 1280 1711 -378 2169.97811 618245 1642362.14 1501092802 1501093828 738886840.9 5.45954E+17 -
(Found the error in the previous post, a copy and paste in Excel)
In Depth Magnetometer Calibration Using Excel and Solver
The mathematical model
Given raw magnetometer readings X, Y , and Z,
For each reading calculate:
Let Xa= X-Xoffset, Ya=Y-Yoffset, and Za=Z-Zoffset, and
The calibrated values X1, Y1, Z1 are given by:
X1=Xa*gainXX + Ya*gainXY + Za*gainXZ,
Y1=Xa*gainYX + Ya*gainYY + Za*gainYZ,
Z1=Xa*gainZX + Ya*gainZY + Za*gainZZ.
Let R1= sqrt( X1^2+Y1^2+Z1^2), and
Error = R1-Rtarget, and Error Squared = Error^2
Take the sum of the Error Squared for all the samples = SES.
Set the X, Y, and Z offsets =0,
Set gainXX, gainYY and gainZZ =1, and the other 6 gains =0;
Use solver to minimize SES while changing the offsets, and all of the gains except gainZZResults
r1 stats Mean 2792.675963 Standard Error 27.03157384 Median 2784.500715 Mode #N/A Standard Deviation 216.2525907 Sample Variance 46765.18298 Kurtosis -0.287108248 Skewness -0.366464619 Range 848.6523987 Minimum 2329.127457 Maximum 3177.779856 Sum 178731.2617 Count 64 COV 0.077435619 COV% 7.74% Magcal 4 Gauss 5 Hz 11Jan2017
offset value axis xgain ygain zgain xoffset 1741.458318 x 0.863257581 -0.3926702 0.358295402 yoffset 150.0131291 y 0.399463789 0.673246386 0.034881236 zoffset 1234.272835 z 3.12226E-06 -3.2123E-06 1 N x y z r x1 y1 z1 r1 error error^2 0 3453 -1701 -1738 4223.417337 738.0793342 -1918.249765 -2423.600946 3177.779856 -385.1038923 148305.0078 1 3381 -1643 -1723 4135.134702 699.0937349 -1850.929269 -2432.375103 3135.461665 -342.7857013 117502.037 2 3355 -1693 -1711 4129.139741 656.6758859 -1874.382201 -2431.434845 3139.491561 -346.815598 120281.059 3 3407 -1633 -1731 4155.803051 725.5330449 -1854.406204 -2430.71061 3142.224473 -349.5485101 122184.1609 4 4665 -757 1189 4873.29406 2161.450477 -1758.630861 970.5809689 2950.708066 -158.0321025 24974.14542 5 4673 -815 1151 4881.18377 2145.18752 -1800.820391 933.4242204 2952.298147 -159.6221841 25479.24165 6 4697 -829 1165 4909.814151 2160.313252 -1819.669971 955.5349728 2981.811401 -189.135438 35772.21392 7 4643 -819 1181 4860.346798 2117.692031 -1791.733367 952.5358334 2932.959684 -140.283721 19679.52238 8 715 -815 4223 4359.95172 -1271.576393 -246.6416096 2587.291018 2893.408616 -100.7326523 10147.06725 9 727 -813 4177 4317.039147 -1260.418518 -250.0070114 2545.660325 2851.586372 -58.91040867 3470.436249 10 749 -785 4243 4379.529084 -1230.241659 -239.795069 2620.519498 2904.843999 -112.1680354 12581.66817 11 611 -807 4179 4299.838485 -1358.159609 -200.4177964 2506.307346 2857.68111 -65.00514671 4225.669099 12 -657 -1013 833 1466.869797 -2535.070208 158.8100096 -1301.196759 2853.929675 -61.25371127 3752.017145 13 -711 -989 817 1466.673447 -2572.099037 196.172165 -1335.707561 2904.873778 -112.1978142 12588.34951 14 -701 -999 844 1483.825461 -2567.461015 185.5129124 -1305.47342 2886.266092 -93.59012836 8759.112126 15 -711 -995 795 1458.619553 -2574.495888 192.1327573 -1357.916849 2916.998842 -124.3228786 15456.17813 16 3613 481 -1543 3958.02716 1747.831143 -512.0540098 -2095.162824 2776.116041 16.55992257 274.2310357 17 3611 525 -1540 3960.624446 1763.681044 -481.6458381 -2091.34464 2777.818558 14.85740514 220.7424876 18 3653 569 -1572 4017.381485 1817.514169 -468.5150427 -2106.761459 2821.578981 -28.90301747 835.3844188 19 3631 489 -1555 3980.113943 1766.565452 -513.7360638 -2100.434457 2792.221901 0.454061814 0.206172131 20 3597 565 2639 4496.882809 1767.587037 -449.232024 2084.034473 2769.36329 23.31267347 543.4807445 21 3593 599 2606 4478.804081 1777.715672 -424.7708601 2050.787254 2747.076929 45.5990339 2079.271892 22 3631 577 2604 4505.319744 1801.731251 -454.5037418 2061.635092 2775.45463 17.22133316 296.5743156 23 3617 549 2634 4507.998004 1778.460752 -467.8573541 2085.642282 2780.596497 12.07946639 145.9135084 24 -185 2581 2177 3381.584688 -691.9355777 2393.112869 337.2818337 2513.866162 278.8098011 77734.90521 25 -145 2557 2207 3380.846492 -666.9923117 2361.248051 380.7765001 2483.014669 309.6612945 95890.11729 26 -153 2599 2220 3421.492364 -657.1208526 2392.665719 392.3751488 2512.093811 280.5821522 78726.34413 27 -157 2557 2228 3395.126213 -677.3513371 2365.960026 397.4769552 2492.901845 299.7741183 89864.52203 28 431 -7 -767 879.8289607 -1193.990385 408.8758362 -2476.280838 2779.345116 13.33084684 177.7114774 29 463 -83 -736 873.4723808 -1196.725294 345.1435649 -2436.466359 2736.355939 56.32002402 3171.945106 30 429 17 -746 860.7241138 -1186.129704 425.8190224 -2455.160279 2759.716926 32.95903781 1086.298173 31 427 -9 -638 767.7590768 -1198.24194 409.0996099 -2348.783782 2668.319976 124.3559878 15464.4117 32 1387 3417 2378 4387.999772 999.057694 2338.668648 1130.68292 2783.151305 9.524658502 90.71911958 33 1377 3429 2382 4396.372823 995.2186962 2350.674294 1131.518541 2792.214909 0.461054752 0.212571485 34 1457 3355 2349 4347.030596 1034.718879 2269.440551 1124.600961 2736.006377 56.66958609 3211.441988 35 1373 3445 2338 4383.993385 998.1569491 2363.017058 1086.643459 2785.850125 6.825838565 46.59207212 36 3471 2883 1405 4725.839079 2584.769791 1160.833507 885.7439583 2968.688543 -176.0125795 30980.42815 37 3345 2939 1448 4682.248392 2498.369442 1248.011612 885.5520868 2929.775649 -137.0996855 18796.32378 38 3405 2909 1461 4710.714065 2538.181024 1204.253967 919.0033738 2955.868354 -163.1923911 26631.75652 39 3393 2931 1484 4722.866291 2536.610208 1223.777356 938.4712162 2968.627728 -175.9517649 30959.02358 40 3143 2419 -178 3970.099999 2116.265164 977.248095 -830.9618274 2474.689807 317.986156 101115.1954 41 3147 2451 -205 3994.125061 2132.500951 997.2213852 -855.4124462 2504.74375 287.9322136 82904.9596 42 3135 2411 -161 3958.1646 2106.163446 975.0034309 -817.1072405 2460.532543 332.1434204 110319.2517 43 3103 2383 -179 3916.546821 2067.354161 968.7180363 -847.549368 2435.304456 357.3715073 127714.3942 44 185 3641 713 3714.764461 50.89677217 2961.470767 -957.1747571 3112.729204 -320.0532409 102434.077 45 181 3667 707 3738.916822 57.82978161 2980.545873 -963.7010265 3133.004573 -340.3286093 115823.5623 46 143 3653 733 3728.5583 19.43358169 2986.041807 -951.8045891 3134.127521 -341.4515573 116589.166 47 153 3623 712 3695.467765 16.08217827 2961.917781 -970.2680722 3116.831037 -324.1550734 105076.5116 48 2099 -3223 2501 4587.867805 -1038.742081 -2411.268931 1277.177838 2919.655151 -126.9791875 16123.71405 49 2087 -3223 2526 4596.082462 -1049.101094 -2406.556969 1297.878293 2928.586283 -135.9103193 18471.6149 50 2079 -3203 2573 4604.538956 -1048.017732 -2389.950831 1342.709554 2934.804097 -142.1281338 20200.40643 51 2129 -3179 2505 4573.150664 -995.2679345 -2393.426209 1293.461474 2896.9104 -104.2344367 10864.81779 52 -109 -2125 1255 2470.33014 -2506.20747 -805.0245965 -721.6388134 2729.451055 63.2249088 3997.389092 53 -97 -2101 1269 2456.414257 -2486.261204 -793.5787706 -702.5021189 2702.734036 89.94192774 8089.550366 54 -173 -2103 1319 2488.433041 -2552.667552 -765.0824888 -679.802332 2750.198912 42.4770515 1804.299904 55 -153 -2117 1301 2489.517825 -2540.994949 -782.3612844 -691.1247612 2747.070794 45.60516933 2079.831469 56 333 -831 -375 970.6054811 -1607.746566 -107.3987654 -2148.135926 2685.306588 107.3693755 11528.18279 57 285 -829 -326 935.2764297 -1648.383849 -87.20426041 -2116.264343 2683.905487 108.7704759 11831.01643 58 309 -877 -348 992.8313049 -1646.839998 -128.944101 -2131.339552 2696.537937 96.13802609 9242.520061 59 253 -877 -315 965.5894573 -1695.182319 -106.9546759 -2118.404095 2715.274997 77.40096666 5990.909641 60 3419 -2285 710 4173.114664 475.4493671 -2298.082732 -8.153631469 2346.764331 445.9116326 198837.1841 61 3395 -2277 684 4144.708675 457.9268143 -2283.272592 -42.47367124 2329.127457 463.5485064 214877.2178 62 3429 -2275 693 4172.998323 488.0765277 -2295.276915 -21.22186508 2346.692392 445.9835715 198901.3461 63 3451 -2273 697 4190.672858 507.8671346 -2302.56918 -9.269603757 2357.93125 434.7447135 189002.9659 http://diydrones.com/forum/topics/magnetometer-soft-and-hard-iron-calibration
-
In Depth Magnetometer Calibration Using Excel and Solver
( Best fit so far!)
The mathematical model
Given raw magnetometer readings X, Y , and Z,
For each reading calculate:
Let Xa= X-Xoffset, Ya=Y-Yoffset, and Za=Z-Zoffset, and
The calibrated values X1, Y1, Z1 are given by:
X1=Xa*gainXX + Ya*gainXY + Za*gainXZ,
Y1=Xa*gainYX + Ya*gainYY + Za*gainYZ,
Z1=Xa*gainZX + Ya*gainZY + Za*gainZZ.
Let R1= sqrt( X1^2+Y1^2+Z1^2), and
Error = R1-Rtarget, and Error Squared = Error^2
Take the sum of the Error Squared for all the samples = SES.
Set the X, Y, and Z offsets =0,
Set gainXX, gainYY and gainZZ =1, and the other 6 gains =0;
Use solver to minimize SES while changing the offsets, and all of the gains except gainZZResults
r1 stats Mean 3117.206387 Standard Error 1.005167936 Median 3119.478578 Mode #N/A Standard Deviation 8.041343492 Sample Variance 64.66320515 Kurtosis -0.864123021 Skewness -0.291754939 Range 27.37080618 Minimum 3101.887692 Maximum 3129.258498 Sum 199501.2087 Count 64 cov 0.002579663 Magcal 4 Gauss 5 Hz 11Jan2017
error = 4129.637996Offset Value Axis xgain ygain zgain xoffset 638.3171635 x -0.005373179 0.092816827 0.084165352 yoffset 125.7515646 y -0.004554252 -0.103490134 0.004828644 zoffset 3341.735388 z -0.08843408 0.094803696 1 (Back to the drawing board because the X and Y gains are too small)
N x y z r x1 y1 z1 r1 error error^2 0 3453 -1701 -1738 4223.417337 442.4174201 59.33861037 -3079.535366 3111.718547 4.553628065 20.73552856 1 3381 -1643 -1723 4135.134702 441.2136312 54.80011423 -3079.90296 3111.828203 4.443971966 19.74888684 2 3355 -1693 -1711 4129.139741 440.5198375 48.34904687 -3079.615717 3111.338671 4.933504364 24.33946531 3 3407 -1633 -1731 4155.803051 441.7358587 58.51563949 -3079.954256 3112.020705 4.251470614 18.07500238 4 4665 -757 1189 4873.29406 172.7593596 -94.34721157 -3099.703419 3105.947276 10.32489947 106.6035491 5 4673 -815 1151 4881.18377 176.3410159 -95.04998877 -3099.28195 3105.749387 10.52278769 110.7290608 6 4697 -829 1165 4909.814151 175.037742 -95.08402029 -3099.268663 3105.663444 10.60873144 112.5451828 7 4643 -819 1181 4860.346798 173.8674059 -100.501382 -3099.331213 3105.830706 10.4414693 109.0242812 8 715 -815 4223 4359.95172 -74.06143648 -462.3864042 -3093.645286 3128.885974 -12.6137993 159.1079327 9 727 -813 4177 4317.039147 -70.06705543 -461.5084948 -3093.729721 3128.747844 -12.47566864 155.6423081 10 749 -785 4243 4379.529084 -76.14943373 -459.8156956 -3093.955444 3128.863932 -12.59175646 158.5523309 11 611 -807 4179 4299.838485 -69.64796033 -462.7892605 -3093.225351 3128.428969 -12.15679335 147.7876245 12 -657 -1013 833 1466.869797 234.0038399 -404.2074408 -3084.870216 3120.026554 -3.754379313 14.09536403 13 -711 -989 817 1466.673447 235.5996348 -400.3426095 -3084.622015 3119.402886 -3.130710964 9.801351141 14 -701 -999 844 1483.825461 233.2037254 -402.438937 -3084.662639 3119.532765 -3.260589446 10.63144353 15 -711 -995 795 1458.619553 237.5725101 -399.3862665 -3084.539666 3119.348496 -3.076321134 9.46375172 16 3613 481 -1543 3958.02716 414.3756879 216.5243802 -3092.44633 3127.589219 -11.31704349 128.0754734 17 3611 525 -1540 3960.624446 413.9207449 220.5440825 -3092.636235 3127.997596 -11.72542068 137.48549 18 3653 569 -1572 4017.381485 416.3245748 233.3204843 -3092.651637 3129.258498 -12.98632299 168.6445848 19 3631 489 -1555 3980.113943 415.3037456 220.6027051 -3092.421607 3127.97285 -11.70067486 136.9057922 20 3597 565 2639 4496.882809 44.24777705 -157.3892385 -3107.992798 3112.289908 3.982267156 15.8584517 21 3593 599 2606 4478.804081 47.03274985 -152.5322222 -3108.072578 3112.168586 4.103589344 16.8394455 22 3631 577 2604 4505.319744 47.10563075 -151.8534292 -3108.039993 3112.103951 4.16822427 17.37409356 23 3617 549 2634 4507.998004 44.6553519 -157.3030955 -3107.952379 3112.251011 4.021164599 16.16976474 24 -185 2581 2177 3381.584688 96.24431343 -28.19245814 -3100.266032 3101.887692 14.38448319 206.9133566 25 -145 2557 2207 3380.846492 93.4856659 -33.5947497 -3100.503284 3102.094259 14.1779165 201.0133163 26 -153 2599 2220 3421.492364 92.1877297 -27.18843576 -3100.510806 3102.000169 14.27200652 203.6901701 27 -157 2557 2228 3395.126213 91.69302836 -34.41427218 -3100.459497 3102.005972 14.26620361 203.5245653 28 431 -7 -767 879.8289607 365.0707723 -200.9031402 -3091.302457 3119.26107 -2.988894959 8.933493078 29 463 -83 -736 873.4723808 362.5034972 -211.7680404 -3091.2913 3119.669276 -3.397100785 11.54029375 30 429 17 -746 860.7241138 363.1151009 -202.6600393 -3091.582907 3119.424392 -3.152216975 9.936471856 31 427 -9 -638 767.7590768 353.6933771 -225.0636403 -3092.363668 3120.651487 -4.379311514 19.17836934 32 1387 3417 2378 4387.999772 66.21507103 124.0127614 -3108.518418 3111.695737 4.576438419 20.94378861 33 1377 3429 2382 4396.372823 65.86041548 125.5063989 -3108.495982 3111.725682 4.546493018 20.67059876 34 1457 3355 2349 4347.030596 68.68590046 117.3753027 -3108.68621 3111.659471 4.612703873 21.27703702 35 1373 3445 2338 4383.993385 69.7001397 130.3714175 -3108.419309 3111.932746 4.339428815 18.83064244 36 3471 2883 1405 4725.839079 143.4956967 207.1728909 -3111.499374 3121.688642 -5.416466456 29.33810886 37 3345 2939 1448 4682.248392 140.1150137 203.7879992 -3111.471431 3121.284388 -5.012212653 25.12227568 38 3405 2909 1461 4710.714065 138.7796075 202.3567737 -3111.575237 3121.235092 -4.962916449 24.63053968 39 3393 2931 1484 4722.866291 136.7099082 203.1705467 -3111.650454 3121.271603 -4.999427663 24.99427696 40 3143 2419 -178 3970.099999 287.3624218 256.2839073 -3104.515596 3128.302365 -12.0301897 144.7254642 41 3147 2451 -205 3994.125061 289.5829131 264.325944 -3104.45156 3129.112647 -12.84047192 164.877719 42 3135 2411 -161 3958.1646 285.9384618 252.6505205 -3104.566376 3127.926705 -11.65453029 135.8280762 43 3103 2383 -179 3916.546821 287.8297361 247.9689525 -3104.391036 3127.55148 -11.27930518 127.2227254 44 185 3641 713 3714.764461 218.8962238 253.2896075 -3099.22339 3117.251482 -0.979306912 0.959042028 45 181 3667 707 3738.916822 219.3299105 258.6135189 -3099.178072 3117.674018 -1.401843218 1.965164408 46 143 3653 733 3728.5583 217.2985647 253.6413137 -3099.071136 3117.016922 -0.744746647 0.554647569 47 153 3623 712 3695.467765 219.2385762 249.8929967 -3099.05838 3116.837324 -0.565148844 0.319393216 48 2099 -3223 2501 4587.867805 81.75220912 -486.072025 -3081.66385 3120.833466 -4.561291068 20.80537621 49 2087 -3223 2526 4596.082462 79.60583526 -487.8804985 -3081.666425 3121.062707 -4.790532247 22.94919921 50 2079 -3203 2573 4604.538956 75.40133387 -490.0864914 -3081.874321 3121.509164 -5.236989049 27.4260543 51 2129 -3179 2505 4573.150664 81.03689034 -483.7972845 -3082.113572 3120.905455 -4.633279728 21.46728104 52 -109 -2125 1255 2470.33014 198.8044841 -455.9608393 -3079.70644 3119.617808 -3.34563262 11.19325763 53 -97 -2101 1269 2456.414257 197.3926267 -456.5013745 -3080.007177 3119.904096 -3.631920504 13.19084655 54 -173 -2103 1319 2488.433041 193.3883928 -458.8260158 -3079.648536 3119.640282 -3.368107032 11.34414498 55 -153 -2117 1301 2489.517825 194.9365022 -458.1597874 -3079.610165 3119.60084 -3.328664726 11.08000886 56 333 -831 -375 970.6054811 334.6838879 -309.346388 -3088.258196 3121.705813 -5.433637378 29.52441515 57 285 -829 -326 935.2764297 330.5994221 -317.5810956 -3088.389151 3122.226975 -5.954799411 35.45963602 58 309 -877 -348 992.8313049 332.6346197 -314.3031054 -3087.92768 3121.654944 -5.382768361 28.97419523 59 253 -877 -315 965.5894573 330.017193 -320.3009077 -3087.899191 3121.958589 -5.686413856 32.33530255 60 3419 -2285 710 4173.114664 228.7731624 -252.9791429 -3087.385737 3106.169071 10.10310436 102.0727176 61 3395 -2277 684 4144.708675 231.1649708 -252.2388575 -3087.31939 3106.220002 10.05217284 101.0461788 62 3429 -2275 693 4172.998323 230.1772675 -250.3026719 -3087.413005 3106.083074 10.18910087 103.8177765 63 3451 -2273 697 4190.672858 229.6962127 -248.8553876 -3087.472054 3105.989865 10.28231054 105.72591 http://diydrones.com/forum/topics/magnetometer-soft-and-hard-iron-calibration
-
Rodrigues Rotation Formula Module Numerical Issues
The origin of the issues is a divide by zero problem
Resolution of these issues must apply to both the Setup() and RotVector() functions.
The divide by zero problem arises when the Norm of a vector is computed.
Given vector V the Norm(V) is given by V/ sqrt(V dot V). If the dot product is zero then a division by zero will occur. The Norm is also called the unit vector and the components of the unit vector are the direction cosines.The Rodrigues’ formula requires four different vectors to be Normed:
- The vector A an argument to the Setup(A,B) function,
- The vector B an argument to the Setup(A,B) function,
- The vector C an argument to the RotVector(C) function, and
The vector K used in the Setup(A,B) function.
What should the Rodrigues formula return in each case?
Zero vectors as arguments.
A zero vector has the components [0, 0, 0] and its dot product is zero.
If vectors A and/or B are zero then Setup(A,B) should return the Norm of vector A. The RotVector(C) should return the Norm of vector C.The K vector is the cross product of vectors A and B. K is a zero vector if
Vector A and/or B is a zero vector. Return the Norm of A.
Vectors A and B point in the same direction. Return the Norm of A.
Vectors A and B point in opposite directions. Return the -Norm of A.
These modifications have been implemented in the attached Rodrigues.js file.
This update functions with the previous test program testRodrigues1.js and with a new test file TestRodrigues10jan17.jsFiles attached:
//testRodrigues1.js
//TestRodrigues10jan17.js
//Rodrigues10jan17.js as module //Rodrigues.js - The vector A an argument to the Setup(A,B) function,
Translating Arduino code is only as good as the original code.
Having reviewed the fine Vogan poetry in the datasheet a rewrite seems in order.