DRV8323RS Version Gimbal Motor Tuning
Dependencies: mbed-dev-f303 FastPWM3
Dependents: GT_MOTOR_24NM_V03 GT_MOTOR_24NM_V03_PT1000CalTemp
FastMath/FastMath.cpp@54:59575833d16f, 2019-08-08 (annotated)
- Committer:
- benkatz
- Date:
- Thu Aug 08 17:39:43 2019 +0000
- Revision:
- 54:59575833d16f
- Parent:
- 20:bf9ea5125d52
updated position for +/- 15 turns
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
benkatz | 0:4e1c4df6aabd | 1 | #include "FastMath.h" |
benkatz | 0:4e1c4df6aabd | 2 | #include "LUT.h" |
benkatz | 0:4e1c4df6aabd | 3 | |
benkatz | 0:4e1c4df6aabd | 4 | const float Multiplier = 81.4873308631f; |
benkatz | 0:4e1c4df6aabd | 5 | |
benkatz | 0:4e1c4df6aabd | 6 | float FastMath::FastSin(float theta){ |
benkatz | 20:bf9ea5125d52 | 7 | while (theta < 0.0f) theta += 6.28318530718f; |
benkatz | 20:bf9ea5125d52 | 8 | while (theta >= 6.28318530718f) theta -= 6.28318530718f; |
benkatz | 0:4e1c4df6aabd | 9 | return SinTable[(int) (Multiplier*theta)] ; |
benkatz | 0:4e1c4df6aabd | 10 | } |
benkatz | 0:4e1c4df6aabd | 11 | |
benkatz | 0:4e1c4df6aabd | 12 | float FastMath::FastCos(float theta){ |
benkatz | 0:4e1c4df6aabd | 13 | return FastSin(1.57079632679f - theta); |
benkatz | 0:4e1c4df6aabd | 14 | } |