Oskar Weigl
/
Quadcopter_copy
Very early flyable code.
motors.h
- Committer:
- madcowswe
- Date:
- 2011-10-01
- Revision:
- 0:9fcb3bf5c231
File content as of revision 0:9fcb3bf5c231:
void initmotor() { PWMleft.period_ms(20); PWMleft = 0.01; PWMright.period_ms(20); PWMright = 0.01; PWMfront.period_ms(20); PWMfront = 0.01; PWMrear.period_ms(20); PWMrear = 0.01; } bool leftM(float thrust) { float output = (634 + 0.657 * thrust) / 10000; if (output > 0.0910) { PWMleft = 0.0910; return true; } else { PWMleft = output; return false; } } bool rightM(float thrust) { float output = (617 + 0.474 * thrust) / 10000; if (output > 0.0822) { PWMright = 0.0822; return true; } else { PWMright = output; return false; } } bool frontM(float thrust) { float output = (637 + 0.509 * thrust) / 10000; if (output > 0.0880) { PWMfront = 0.0800; return true; } else { PWMfront = output; return false; } } bool rearM(float thrust) { float output = (644 + 0.470 * thrust) / 10000; if (output > 0.0908) { PWMrear = 0.0908; return true; } else { PWMrear = output; return false; } }