Software > Software

Dual sensors differential drive?

(1/3) > >>

Hydro:
Was wondering how I could accomplish a simple thing as that.
I mean, I obviously have to take in both sensors in consideration for each motor, but is there a short way to combine the two?

Last year I did something that involved one sensor, so it was easy, and I even used a derived answer or something (not sure how to say it in English :p - the method that involves checking the last error).

Basically, what I'm looking for (I'm using normal GP12, by the way) is a simple formula and calculation method, to keep my robot right in between 2 walls. Also, since it was a year ago, I don't really remember what, and how I used the "last error" method, but I remember that without it the robot would drive like a wave - coming closer and further from the wall, never slowing down to a full line. So prehaps, including that would be great.

Thanks.

JonHylands:
You're looking for PID control - doing wall following with PID is relatively straight-forward...

- Jon

Hydro:
Yes, I've read about it, but I'm not on how to take 2 sensors into account, for both motors.

Admin:

--- Quote ---Yes, I've read about it, but I'm not on how to take 2 sensors into account, for both motors.
--- End quote ---
Its exactly like a photovore, but instead of light brightness, you use distance to the wall.
http://www.societyofrobots.com/programming_photoresistor.shtml

Have the robot drive straight when distances are equal. The code and electronics are EXACTLY the same as a photovore, just the sensors are different.

Hydro:
Well, of course that's one way of using it.
I'm just thinking if there's a way to use it, with just one line, no "if"s.
(Considering I have a Drive function, which works like so: Drive(Left Motor Speed%, Right Motor Speed%)).
I was wondering if there's a simple way I could use to calculate the needed %?

Maybe something like (assume SensLeft and SensRight are already new information)
(SensLeft - SensRight) * KC + General_Speed.
would work? (Well, for the Right Motor you use SensRight - SensLeft).

Navigation

[0] Message Index

[#] Next page

Go to full version