solaESKF_EIGEN
Dependencies: mbed LPS25HB_I2C LSM9DS1 PIDcontroller LoopTicker GPSUBX_UART_Eigen SBUS_without_mainfile MedianFilter Eigen UsaPack solaESKF_Eigen Vector3 CalibrateMagneto FastPWM
Diff: main.cpp
- Revision:
- 5:9cad4ce807b9
- Parent:
- 4:7d2eae0115a2
- Child:
- 6:2cba569272fe
diff -r 7d2eae0115a2 -r 9cad4ce807b9 main.cpp --- a/main.cpp Thu Jan 21 09:04:24 2021 +0000 +++ b/main.cpp Thu Jan 21 09:09:57 2021 +0000 @@ -13,7 +13,7 @@ return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; } -int ch1, ch2, ch1_b, ch2_b; +int ch1, ch2; float rc1, rc2; int out1, out2; @@ -22,12 +22,15 @@ led1 = !led1; if(sbus.failSafe == false) { - ch1_b = ch1; - ch2_b = ch2; + ch1 = int(sbus.getData(1)); ch2 = int(sbus.getData(2)); pc.printf("ch1 :%d\r\n", ch1); pc.printf("ch2 :%d\r\n", ch1); + float LP_rc = 0.65; + float LP_rc3 = 0.15; + rc1 = LP_rc*float(map(ch1,368,1680,-1000,1000))/1000.0+(1.0-LP_rc)*rc1; + rc2 = LP_rc*float(map(ch2,368,1680,-1000,1000))/1000.0+(1.0-LP_rc)*rc2; pc.printf("rc1 :%f\r\n", rc1); pc.printf("rc2 :%f\r\n", rc1); int pwmMax = 1800;