My AGV


3689350111?profile=original


You can see my forum post here :http://diydrones.com/forum/topics/gps-libraryish-code?xg_source=activity

Here is all the information on it here :http://letsmakerobots.com/node/18922


I now have a compass module and i wrote some better code. The compass module is just a life saver. It is really accurate and just makes programming easier. You use i2c to communicate with it and just a snippet of code. Just make sure you mount it level and away from the electronics.

My new code has improved steering. I guess its proportional but i do not know if it is definition proportional drive. I came up with this little formula of delay=degree error / 180 *3000. It takes about 3 secs to turn 180 degrees so 3000 was my number i could tweak. Of course it is out of 180 because that is the most i will be turning either left or right. Our degree of error is how much we are off from our current heading to the heading we need to be at. Simply subtract the current heading from the desired heading and take the absolute value and presto! This code seems to work really well. I tested this in a parking lot plus i had 2 waypoints this time. (see video). You can see the results. the waypoints were given a radius of 2 meters but it normally gets closer than that. I will reduce the radius next time. The AGV is programmed to stop when it reaches its last GPS point. I ordered a l298 motor driver and will update this post when i have that on the AGV and i will have a more complicated path of waypoints.


E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • I have a car that is exactly like the one that you used above. Did you modify the steering at all or does it work well with the "bang bang" or disproportional steering?
  • Yeah i found out it needed to be mounted perfectly real quick! Here is a little newer version of the code but of course you would need to adjust gains and the code for your magnetometer. Tell me how it goes. If you plug your GPS in then you should get data with the code but be mind full that there are delays for the motors that will slow the data down if you are just serial printing it. If you get magnetometer readings of 0-360 then you can substitute those readings for the "headinggps" value in the code. "headinggps" equals the value read from my compass. Should work for you. Also it should give print the distance from your current location to your next GPS waypoint.gps_with_heading.pde
  • My problem with the compass is for every degree of tilt there is 2 degrees of error on heading. I'm going to give your code a try.... I've been interested in doing the same thing. I'm going to try a magnetometer with the ArduIMU board... Thanks for posting this!!!!!
  • wow great design, patrick keep it up
  • Developer
    Compass is good...
This reply was deleted.