We are looking for a way to rotate a robot within about +/- 5 degrees of accuracy. We are using this three-axis gyroscope currently. Does anyone have any sample code or help on doing this? Would it be beneficial to pair an accelerometer with the gyro for this? (We have an accelerometer also.)
Right now, we’re just turning using encoders on the wheels, and we are using a calculation based on the degrees vs ticks of the encoders. This works decently; however, in environments with different (or slanted) surfaced, the turns are very inaccurate.
Advice or other help would be much appreciated, even if it is something other than using a gyro/accelerometer.
Edit: We are not looking for any orientation data. We simply want to rotate the robot 90 degrees, or however many degrees we pass to it via a turn function. For the turn, we are just powering one side with a positive speed and the other with a negative speed to make a point turn.