Does he literally always turn left when you expect him to go right and vice versa? Is it possible that you simply have the motors connected backwards compared to the code you borrowed from fritsl?
Try a simple program to turn first the right wheel forward for 5 seconds, then the left wheel forward for 5 seconds. Then confirm both wheels backwards as well. Just to be sure everything is connected as expected.
If you find it is not connected as you thought, either correct the code or the connections, whichever is easier!
The first thing I did was make sure worward was forward and back was back on both wheels.
He runs forward and does stop when he sees something.
I notice though that if I create a corner infront of him that is positivley more to one side, He stops, looks around but then does not take the best path.
I will check it out tonight. Right now I dont feel to good. Doctor diagnosed 99% that I have H1N1 so please dont lean too close to our monitor when I am online
I’m a programmer but I never really seem to get far enough to actually start doing some REAL AI programming, which is the reason I started this whole robotics adventure in the 1st place. I keep struggling with practical, mechanical and practical problems. Figuring out which parts to get has been a nightmare. Obtaining the actual parts have been even worse and putting them together well…hotdamn
Anyway since I discovered the wonders of double sided sticky tape things have changed somewhat. From now on I’ll choose the EASY way so I can start programming ASAP
Anyway being mechanichaly inclined is definately NOT the worst thing to be in this business
Is there one of you that has a basic start here robot who has used the GP2D12 sensor. I would like to see the program you are using to compare with mine as I am trying to figure why the G_Bot seems to be turning the wrong way.
Have you checked the datasheet for the sharp sensor? I remember something about a constant being 0.42 for the GP2D120 while it’s 4.0 for the GP2D12. That is for converting the voltage to distance. And have you calibrated your sensor? (again see the datasheet)
Your little G_Bot seems to have the same problem my Peek-E was having, turning toward the object instead of away from it. You may have the lturn and rturn backwards like I did.
If you are using the “Start Here” code, try replacing this subroutine:
’ Decide which is the better way: if b1<b2 then gosub body_lturn else gosub body_rturn end if return
with this one:
’ Decide which is the better way: if b1<b2 then gosub body_rturn else gosub body_lturn end if return
Notice the lturn and rturn are switched. This may be the only minor tweak you need to really get G_Bot going.
When I went to bed I felt like I had achieved my lifes work
Only difference to your changes was as follows:
gosub lturn ’ look to one side pause servo_turn ’ wait for the servo to be finished turning readadc 1, b1 <<------------------------------------------------------------- I CHANGED THIS TO B2 gosub totalhalt ’ Look the other way: gosub rturn ’ look to another side pause servo_turn ’ wait for the servo to be finished turning readadc 1, b2 <<------------------------------------------------------------- I CHANGED THIS TO B1