last working

Dependencies:   FastPWM3 mbed

Fork of foc-ed_in_the_bot_compact by Bayley Wang

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Transforms.cpp Source File

Transforms.cpp

00001 #include "mbed.h"
00002 #include "Transforms.h"
00003 
00004 void Transforms::Park(float alpha, float beta, float theta, float *d, float *q){
00005     float cosine = cos(theta);
00006     float sine = sin(theta);
00007     *d = alpha * cosine - beta * sine;
00008     *q = -beta * cosine - alpha * sine;
00009 }
00010 
00011 void Transforms::InvPark(float d, float q, float theta, float *alpha, float *beta){
00012     float cosine = cos(theta);
00013     float sine = sin(theta);
00014     *alpha = d * cosine - q * sine;
00015     *beta = q * cosine + d * sine;
00016 }
00017 
00018 void Transforms::Clarke(float a, float b, float *alpha, float *beta){
00019     *alpha = a;
00020     *beta = sqrtf(3.0f) / 3.0f * (a + 2.0f * b);
00021 }
00022 
00023 void Transforms::InvClarke(float alpha, float beta, float *a, float *b, float *c){
00024     *a = alpha;
00025     *b = 0.5f * (-alpha + sqrtf(3.0f) * beta);
00026     *c = 0.5f * (-alpha - sqrtf(3.0f) * beta);
00027 } 
00028