Pages: [1]   Go Down
Author Topic: Turning at percise right angles.  (Read 660 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a track based robot powered by a twin gearbox and two dc motors. I want it to move along a preprogramed path and end up back at the same spot, requiring more than a few precise right angle turns. I thought this would be an easy thing to accomplish but it's been mostly frustrating.

I thought I could just use code like this:

Code:
digitalWrite(H1,LOW); //H-bridge running Motor 1 forward
digitalWrite(H2,HIGH); //H-bridge running Motor 2 backward
analogWrite (Motor2,100); //motor speed
analogWrite (Motor1,100); //motor speed
delay(1400);  //a smaller number here results in a smaller angle, large in a larger angle

but the result has been spotty at best. If getting the number right wasn't difficult enough, everything from the conditions of the treads to the little imperfections in the driving surface change how the thing turns. Even when working on the flattest and smoothest surface I have, the results are inconsistent and the whole project kind of falls apart if the pathing isn't working properly.

Is there another realistic solution that would provide me anything close to consistent movement?
Logged

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4339
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think you've just proved to yourself what the limitations of open-loop (dead-reckoning) control are. You might need to consider either or both of line following and position feedback of some sort.


Logged

Roy from ITCrowd: Have you tried turning it off an on again?
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

South Texas
Offline Offline
Edison Member
*
Karma: 8
Posts: 1025
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You are experiencing something called SLIP. the tires do not have an absolute grip to the surface they are running on and when you turn and such they slip slightly.

As the previous poster stated - you are running in an open loop configuration with no feedback from the environment. You might try running on a grid with something attaches to you robot that can detect that grid. That would give you some position feedback that you could then use to correct for errors.
Logged

SW Scotland
Offline Offline
Edison Member
*
Karma: 17
Posts: 1389
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Or incorporate a compass unit into your design so it knows what direction it's heading in.  But even that won't give perfect resolution - probably a couple of degrees of error.  You could fit a beacon (flashing lED ?) at your desired end location and fit the robot with a "eye" so's it can home in on the beacon.
Logged

Pages: [1]   Go Up
Jump to: