hobbyking_cheetah source code modified 2020/12/15
Dependencies: mbed-dev-f303 FastPWM3
Diff: main.cpp
- Revision:
- 19:bd10a04eedc2
- Parent:
- 18:f1d56f4acb39
- Child:
- 20:bf9ea5125d52
--- a/main.cpp Sun Dec 11 04:19:15 2016 +0000 +++ b/main.cpp Tue Feb 14 03:28:16 2017 +0000 @@ -81,7 +81,7 @@ Serial pc(PA_2, PA_3); Inverter inverter(PA_10, PA_9, PA_8, PA_11, 0.02014160156, 0.00005); //hall motor -PositionSensorAM5147 spi(16384, 1.65f, 21); ///1 I really need an eeprom or something to store this.... +PositionSensorAM5147 spi(16384, 4.7, 21); ///1 I really need an eeprom or something to store this.... //PositionSensorSPI spi(2048, 1.34f, 7); ///2 @@ -133,9 +133,10 @@ int position = spi.GetRawPosition(); //float m = spi.GetMechPosition(); float e = spi.GetElecPosition(); - foc.Commutate(); - float q = foc.GetQ(); - printf("position: %d angle: %f q current: %f\n\r", position, e, q); + printf("%f\n\r", e); + //foc.Commutate(); + //float q = foc.GetQ(); + //printf("position: %d angle: %f q current: %f\n\r", position, e, q); //inverter.getCurrent() //printf("%f %f %f %f \n\r", m, cmd_float[0], cmd_float[1], cmd_float[2]); //printf("%d %d %d\n\r", raw[0], raw[1], raw[2]); @@ -158,7 +159,7 @@ inverter.DisableInverter(); spi.ZeroPosition(); wait(.1); - inverter.SetDTC(0.03, 0.0, 0.0); + inverter.SetDTC(0.0, 0.0, 0.0); inverter.EnableInverter(); foc.Reset(); testing.attach(&Loop, .000025);