Ben Katz
/
Hobbyking_Cheetah_V1
FOC Implementation for putting multirotor motors in robots
Diff: Transforms/Transforms.cpp
- Revision:
- 14:80ce59119d93
- Parent:
- 10:370851e6e132
--- a/Transforms/Transforms.cpp Sun May 22 03:47:40 2016 +0000 +++ b/Transforms/Transforms.cpp Mon Oct 31 16:48:16 2016 +0000 @@ -9,10 +9,10 @@ //float sine = sin(theta); float cosine = FastCos(theta); float sine = FastSin(theta); - *d = alpha*cosine - beta*sine; //This is a hack - effectively using -beta instead of beta - *q = -beta*cosine - alpha*sine; //I think because I'm using pi as the d axis offset instead of zero, but I need to investigate more. - //*d = alpha*cosine + beta*sine; - //*q = beta*cosine - alpha*sine; + //*d = alpha*cosine - beta*sine; //This is a hack - effectively using -beta instead of beta + //*q = -beta*cosine - alpha*sine; //I think because I'm using pi as the d axis offset instead of zero, but I need to investigate more. + *d = alpha*cosine + beta*sine; + *q = beta*cosine - alpha*sine; //DAC->DHR12R1 = (int) (*q*49.648f) + 2048; //DAC->DHR12R1 = (int) (*q*2048.0f) + 2048; }