I am building a robot (2 powered wheels and one ball bearing). The problem is that I can't seem to make it drive straight. I literally find it impossible, I have been trying for weeks.

I have two gyro sensors (on each wheel) and the current motor rotations.

The end result would be to have the gyros at 0 degrees, I do not really care for motor rotations.

I tried to search on Google but most results are GPS related. Is there a way I can do this?

  • $\begingroup$ So the gyros are measuring the rotation rate of the wheels? $\endgroup$ – holmeski May 20 '18 at 15:35
  • $\begingroup$ @holmeski No, they are measuring the angle of the whole robot. $\endgroup$ – user9549355 May 20 '18 at 15:37
  • $\begingroup$ As straight as possible. I am trying yet another solution and hopefully it will work. $\endgroup$ – user9549355 May 20 '18 at 16:05
  • 1
    $\begingroup$ Right, but what have you done in software? I know what sensors you have. What are you doing with the measurements from the gyros? How straight do you need it to go? We may be able to conclude here that gyros will not be sufficient. $\endgroup$ – holmeski May 20 '18 at 16:18
  • $\begingroup$ What do you mean by gyro sensors on each wheels ? Are the gyros firmly attached to moving parts or to the base of your robot ? How are the gyro's oriented w.r.t. the wheel rotation axis and the robot motion direction? $\endgroup$ – N. Staub May 22 '18 at 9:02

If you’re using your gyros to measure the direction your bot is moving, you will need to use a PID system to adjust your direction based on the feedback your bot provides. This type of system continuously measures the state of your gyro and applies it to the speed of each wheel. This should keep your bot running straight. If you are using the gyros to measure the rotation of each wheel, then you should be using a rotary encoder instead. Two rotary encoded motors and a gyro will solve your problem completely

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.