cedarlakeinstruments:
I don't know how you'd do it without mounting the MPU-6050 on the moving platform: you need to know its orientation.
I agree that a servo is a bad idea: now you have to manage two feedback loops, one of which you don't control.I did a proof of concept for a 1-axis stabilizer (the platform only needs one degree of freedom). It works very well: https://www.youtube.com/watch?v=Ezwf3kFpk7c
We haven't built a full-size version yet, but the PoC is very promising.
Oh that's very Nice!
I was wondering what's the logic behind making the motor move? I have tried to rework my code
if (ypr[1] > (5*M_PI)/180) // 5 degree room for movement before servo is active
{
temp[1]=ypr[1]-M_PI; // if the reading is greater than 5 degrees
}
else if (ypr[1] < -(5*M_PI)/180) // 5 degree room for movement before servo is active
{
temp[1]=ypr[1]+M_PI; // if the reading is less than -5 degrees
}
else
{
temp[1]=ypr[1]; // if the reading is between -5 and 5, simply output
}
myservoX.write(int(temp[1] * 180/M_PI)+90); // Input to the SErvo
I added the comments, just wondering if you also had to use if/ else statements depending on which way you are tilting your project.