Ok, in truth it's not exactly that, but that's the nickname it got.
It's a self-stabilizing platform. It doesn't matter the angle you put the lower platform in, the upper platform will ever stay in the horizontal position.
I used the method from this post, by Lauzsus, and adapted to my needs, including the servo motors.
It reads the inclination angle data given by the accelerometer and gyro, applies Kalman Filter to best predict the real inclination and write to the servo motors the inverse angle to compensate the inclination.
Then I basically used the same code, just adapting it to write the angles to the servos:
// added in the beginning: #include <Servo.h>
Servo servo1;
Servo servo2;
// added in setup:
servo1.attach(6);
servo2.attach(9);
// added in the end of loop() function:
servo1.writeMicroseconds(1560-yAngle9.55);
servo2.writeMicroseconds(1510+xAngle9.55);
Where 1560 and 1510 are the values corresponding to the center position of my servos and yAngle and xAngle varies from -90 to +90 and are scaled to fit the observed servo limits.
It reads the inclination angle data given by the accelerometer and gyro, applies Kalman Filter to best predict the real inclination and write to the servo motors the inverse angle to compensate the inclination.
Then I basically used the same code, just adapting it to write the angles to the servos:
// added in the beginning: #include <Servo.h>
Servo servo1;
Servo servo2;
// added in setup:
servo1.attach(6);
servo2.attach(9);
// added in the end of loop() function:
servo1.writeMicroseconds(1560-yAngle9.55);
servo2.writeMicroseconds(1510+xAngle9.55);
Where 1560 and 1510 are the values corresponding to the center position of my servos and yAngle and xAngle varies from -90 to +90 and are scaled to fit the observed servo limits.
Any question, please comment!
By sure, you mean "No, but I do what to show you how I use the servo lib"?
retrolefty:
Well it is your sketch, and your free to show what parts of it you wish.
I hope you didn't get me wrong. I didn't show the rest because it was not my creation. (I adapted from Lauszus post, which adapted from another project)
really thanks for info sharing buddy! i am confused with how to connect the 6dof to my my arduino uno!!! there is no pins declared in the program! it is done via i2c! i am sorry i am a beginner and can u exp about i2c connections? my mail id is raghavendran.dme@gmail.com