Driving robot in a Circle

Hi, I am new here.

I would like to have some help in controlling a two wheel drive robot to drive in a perfect or almost perfect cirle. Its for my final year project and I have about 10 days to make it work. 

My chassis is 400mm by 255mm, four wheeled with two DC motor wheels at the front, fitted with motor encoders, and castor wheels at the rear. The distance between the two front wheels is 180mm, and have a diameter of 85mm. 

I tried to drive the motors by analogue writing diffent voltages but I ended up with a spiral instead of a circle.

Thanks

Circle

Compute the distance each wheel has to travel and adjust the wheel speed accordingly.

 

Yeah, what GG said.

Yeah, what GG said.  

Differential voltages aren’t going to do it by themselves.  You want to calculate what the inner wheel needs to turn (C = 2* pie * r), what the outer wheel needs to turn to make the circle and then use the encoders on the inner and outer wheel to adjust motor speeds to ensure you keep on the perfect circle.  The math is easy, the pid will be the pain so it doesn’t chase the perfect circle like a drunk driver.

Good luck.  Let us know you how you make out.

 

String.

Attach a string to the center of the circle and the robot.   Drive the robot with a slight steer to the outside to keep the string under tension.

This is a joke, but maybe the rules don’t prevent it.

Another joke…use a hard axle and slightly different size wheels on one side.

I’m just spitballing, but

I’m just spitballing, but here’s how I’d approach it.

Assuming your robot travels clockwise, two circles - outer circle (left wheel - circumference = CL) and inner circle (right wheel - circumference = CR). The circimference of the circles (CL and CR) is the distance that each wheel needs to travel to make a complete circle. As the robot travels, take the distance that the left wheel has travelled and divide it by CL, then multiply by CR. That is the distance that SHOULD have been travelled by the right wheel. Then apply PID calculations using your current right wheel distance and your expected right wheel distance, and use the PID result to adjust the right wheel speed. It might be a little squirrely at first, but it would settle down soon enough and maintain the circle. The PID could just be P, or maybe PI, or maybe PD, or maybe full-blown PID. If you need help with PID, here’s a video that I think does a really good job of explaining it, along with pseudo code for using it.

https://www.youtube.com/watch?v=JEpWlTl95Tw