![](/media/cache/profiles/23d6c2965508b167da9c4bdcef3a2aa3.50x50_q85.jpg)
Code for my balancing robot, controlled with a PS3 controller via bluetooth
Diff: BalancingRobot.h
- Revision:
- 2:caec5534774d
- Parent:
- 1:01295228342f
- Child:
- 3:c3963f37d597
diff -r 01295228342f -r caec5534774d BalancingRobot.h --- a/BalancingRobot.h Tue Feb 14 18:31:05 2012 +0000 +++ b/BalancingRobot.h Thu Feb 16 20:25:52 2012 +0000 @@ -53,7 +53,6 @@ double Ki = 2; double Kd = 12; double targetAngle = 90; -double lastTargetAngle; double lastError; double iTerm; @@ -83,15 +82,19 @@ bool steerRight; bool steerRotateRight; +double targetOffset = 0; + void calibrateSensors(); -void PID(double restAngle); +void PID(double restAngle, double offset); double kalman(double newAngle, double newRate, double looptime); double getGyroYrate(); double getAccY(); void move(Motor motor, Direction direction, float speed); void stop(Motor motor); void processing(); -void receiveSerial(); +void receivePS3(); +void receiveXbee(); void stopAndReset(); +void processing(); #endif \ No newline at end of file