DO ' begin
IF IN15 = 1 THEN low 3 ' if the right sensor (15) sees black turns right wheel off
IF IN15 = 0 THEN HIGH 3 ' if the right sensor sees white turns right wheel on
IF IN14 = 1 THEN LOW 1 ' if the left sensor (14) sees black turns left wheel off
IF IN14 = 0 THEN HIGH 1 ' if the left sensor sees white turns the left wheel on
LOOP ' repeat process
The wheel stops when it sees black but it doesnt stop fast enough so it rolls just enough for the black line to end ( its a black electrical wire, not too thick at all )
Looks like you're using simple high/low (on/off) motor control on a differential drive robot, which is fine, but it sounds like your motors are too quick for·your simple·line-following routine and you are overshooting. You have a few options that might work.
1) Lower your motor voltage to slow your wheels down. Use fewer batteries for the motor drive circuit or add several silicon·diodes to drop the 6 volts down to something more useable.
2) Increase your gear reduction so your wheels rotate slower. Different transmissions will give lower RPM and higher torque.
3) Change your vehicle's geometry. Moving your two wheels farther apart will slow your turning rate down. Experiment with your line sensors' location. How far apart, how high off the ground, and how far ahead of your wheel axis will all affect your control system.
4) Consider using dynamic braking, which stops your motor in a hurry when switched off instead of simply removing power and letting your motor coast to a stop, which can encourage overshoot. If you use relays, this is pretty easy. I have a circuit posted at http://forums.parallax.com/showthread.php?p=749676.
5) Make sure your drive wheel tires are getting good traction and not skidding. If you have a caster or casters front & rear, balance the robot to put minimum weight on the casters and·concentrate the weight on the drive wheels.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ ·"If you build it, they will come."
You could also use PWM."pulse width modulation" to control motor speed.
Take a look at Experiment #22 in the StampWorks manual. Also look at Experiment #26 to have control of motor speed using a 10kohm Pot. #26 is setup for a servo but the idea can be applied to PWM.This and a dynamic braking like " erco " suggested should do the trick.
__________________$WMc%_________________
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there·········································· E=$WMc%2
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
IF IN15 = 1 THEN low 3 ' if the right sensor (15) sees black turns right wheel off
IF IN15 = 0 THEN HIGH 3 ' if the right sensor sees white turns right wheel on
IF IN14 = 1 THEN LOW 1 ' if the left sensor (14) sees black turns left wheel off
IF IN14 = 0 THEN HIGH 1 ' if the left sensor sees white turns the left wheel on
LOOP ' repeat process
The wheel stops when it sees black but it doesnt stop fast enough so it rolls just enough for the black line to end ( its a black electrical wire, not too thick at all )
1) Lower your motor voltage to slow your wheels down. Use fewer batteries for the motor drive circuit or add several silicon·diodes to drop the 6 volts down to something more useable.
2) Increase your gear reduction so your wheels rotate slower. Different transmissions will give lower RPM and higher torque.
3) Change your vehicle's geometry. Moving your two wheels farther apart will slow your turning rate down. Experiment with your line sensors' location. How far apart, how high off the ground, and how far ahead of your wheel axis will all affect your control system.
4) Consider using dynamic braking, which stops your motor in a hurry when switched off instead of simply removing power and letting your motor coast to a stop, which can encourage overshoot. If you use relays, this is pretty easy. I have a circuit posted at http://forums.parallax.com/showthread.php?p=749676.
5) Make sure your drive wheel tires are getting good traction and not skidding. If you have a caster or casters front & rear, balance the robot to put minimum weight on the casters and·concentrate the weight on the drive wheels.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
You could also use PWM."pulse width modulation" to control motor speed.
Take a look at Experiment #22 in the StampWorks manual. Also look at Experiment #26 to have control of motor speed using a 10kohm Pot. #26 is setup for a servo but the idea can be applied to PWM.This and a dynamic braking like " erco " suggested should do the trick.
__________________$WMc%_________________
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there·········································· E=$WMc%2
Post Edited ($WMc%) : 1/13/2009 1:32:24 AM GMT