So the physical hardware and software are coming along well. I have also been able to get around some device configuration issues.
First I set the gps to use the uart on the arduino. Apparently there is a hardware buffer that is better able to handle the nema strings than the newsoftserial library. I now get timely and reasonable coordinates.
Second I wired up the xbee shield to the software serial port. I also configured them to crank at 115200. I get some funny asci characters on occasion the the telemetry is solid enough.
I also have wired up the throttle and steering to servos in code. The steering now reacts to the given gps data, a target location, and the compass reading. I was able to get the jitters out but now when I swing wheels around I get somewhat erratic readings from the compass - always something to improve.
I now plan to use the telemetry from the hardware platform (using the RC controller) to gather some gps data. With this I hope to create a course up and down my street!
Ben's Brew DB Project
Sunday, July 31, 2011
Monday, July 4, 2011
Turnkey Linux LAMP appliance and Zend
So I wanted to bring up a test environment for a web project I was considering. For this project I wanted a LAMP server with Zend server installed. Unfortunately the instructions and my weak knowledge of linux/apache stifled what should have been a straight forward install.
I now submit for my own reference and edification the steps I had to follow to get things running.
1. Installed Zend Studio trial on my windows host
2. Install vmplayer
3. Download the Turnkey LAMP appliance
4. Unzipped it and played it on the player - applied the security updates automatically and configured the network connections
5. Installed Samba (apt-get install samba)
6. Installed Aptitude (apt-get install aptitude)
7. I then followed the manual install instructions for Zend Server
8. Picked up the webmin samba component with (apt-get install webmin-samba)
9. Created a share to the /var/www/ folder after logging into webmin via the default IP assigned to the VM
10. Changed the file and folder permissions and chmod'd the web folder so I could write to it from my windows host
11. Created an example project via Zend studio in the shared LAMP folder
12. Finally configured the virtual host per the quickstart guide
Whew! So I now have a Zend server that displays the welcome screen and runs the example project. Now all I have to do is walk the example and learn how to use Zend. Hopefully it is easier than getting the example to work!
I now submit for my own reference and edification the steps I had to follow to get things running.
1. Installed Zend Studio trial on my windows host
2. Install vmplayer
3. Download the Turnkey LAMP appliance
4. Unzipped it and played it on the player - applied the security updates automatically and configured the network connections
5. Installed Samba (apt-get install samba)
6. Installed Aptitude (apt-get install aptitude)
7. I then followed the manual install instructions for Zend Server
8. Picked up the webmin samba component with (apt-get install webmin-samba)
9. Created a share to the /var/www/ folder after logging into webmin via the default IP assigned to the VM
10. Changed the file and folder permissions and chmod'd the web folder so I could write to it from my windows host
11. Created an example project via Zend studio in the shared LAMP folder
12. Finally configured the virtual host per the quickstart guide
Whew! So I now have a Zend server that displays the welcome screen and runs the example project. Now all I have to do is walk the example and learn how to use Zend. Hopefully it is easier than getting the example to work!
More coffee and jitter free Servos
So after an extensive look at example code I was able to smooth out those shakes. I ended up adding a delay() and servo.detach() after each servo.write() statement. With a lot of bench testing I am now able to turn the board and see the wheels turn in kind towards the offending waypoint.
Now what... guess I need to figure out how to go forward! I made another cable with some servo extensions and plugged everything into the arduino. After more fiddling with the stock speed controller on the Traxxas (the ESC XL 5 was set to training mode or something) I got regular servo commands to spin motors.
Yay!
So now I have left right and forward. Now I need to capture some gps data on my street to get multiple points for this thing to follow. I built an arduino stack with an xbee shield and the gps shield (both retail kits) with the thought I would strap this puppy down with some zip ties. With everything secured I then could tear up asphalt and wirelessly obtain my waypoints. Unfortunately I only get a few lines of lat/lon data before the wireless connection binds up and freezes on the serial monitor.
After a beer I came to the conclusion that the serial stream from the xbee (9600 by default) was probably binding up the flow of data from the gps and my print statements. I recalled reading in the Sparfun gps shield example that the baud rate needed to be 115200 to keep things nice. That or my arduino was browning out with my janky 9V battery connection... After another beer I decided that even if I was wrong I should be able to tinker with google maps and come up with some approximate points for testing.
Soon I hope to have the hardware stack rebuilt to put the bench test model onto the frame.
Now what... guess I need to figure out how to go forward! I made another cable with some servo extensions and plugged everything into the arduino. After more fiddling with the stock speed controller on the Traxxas (the ESC XL 5 was set to training mode or something) I got regular servo commands to spin motors.
Yay!
So now I have left right and forward. Now I need to capture some gps data on my street to get multiple points for this thing to follow. I built an arduino stack with an xbee shield and the gps shield (both retail kits) with the thought I would strap this puppy down with some zip ties. With everything secured I then could tear up asphalt and wirelessly obtain my waypoints. Unfortunately I only get a few lines of lat/lon data before the wireless connection binds up and freezes on the serial monitor.
After a beer I came to the conclusion that the serial stream from the xbee (9600 by default) was probably binding up the flow of data from the gps and my print statements. I recalled reading in the Sparfun gps shield example that the baud rate needed to be 115200 to keep things nice. That or my arduino was browning out with my janky 9V battery connection... After another beer I decided that even if I was wrong I should be able to tinker with google maps and come up with some approximate points for testing.
Soon I hope to have the hardware stack rebuilt to put the bench test model onto the frame.
Wednesday, June 22, 2011
Jitters
So with code for the compass, gps, and servo all bootloaded up on the arduino I ran my first test of the navigation software. And it seemed to kinda work?
With the compass and bearing calculations establishing that I turn to the right or more lefter on a consistent basis the servo writes should be no problem right?
Wrong...the servo write statement did turn the wheels of the car when I pointed the arduino in a particular direction relative to a point, but the servo has got some wacky jitters as I continue to move things around.
At first I thought that I must be near a degree value where the bearing that was being calculated was bouncing to the left and right of the heading reading or vice versa.
Creating an error correction value that would allow for readings to bounce + or - 5 degrees still didn't fix the issue. Don't know what I will do to fix it but for now I can get things to turn in the right direction even if they are a bit twitchy.
With the compass and bearing calculations establishing that I turn to the right or more lefter on a consistent basis the servo writes should be no problem right?
Wrong...the servo write statement did turn the wheels of the car when I pointed the arduino in a particular direction relative to a point, but the servo has got some wacky jitters as I continue to move things around.
At first I thought that I must be near a degree value where the bearing that was being calculated was bouncing to the left and right of the heading reading or vice versa.
Creating an error correction value that would allow for readings to bounce + or - 5 degrees still didn't fix the issue. Don't know what I will do to fix it but for now I can get things to turn in the right direction even if they are a bit twitchy.
Monday, June 13, 2011
Don't void the warranty!
With my code coming together for navigation I need to get back to the platform itself. I have decided that I finally need to put down the RC controller and see if I can actually control the RC car with the arduino.
Taking the top off the receiver wasn't too hard. Just had to remove some screws with the hex wrench that came with the car. After that I unplugged the servo and speed control. With some okie ingenuity I was able to rig up a connection to the servo with a servo extension from SparkFun even though the plugs didn't completely mate.
Once I got the whole thing wired up I began with some simple code from the arduino sketches to "write" the servo positions to the servo. I had to swap some wires to establish what was power, ground, and data but once that was established I was able to point wheels left, right, and center on command. I did notice that although the servo was equipped to run from 0 to 180 degrees the linkages under the car only allowed for a min of 45 and a max of 135 with 90 being dead center.
Soon I hope to combine the waypoint bearing calculations and compass readings from the navigation testing with the servo controller code!
Taking the top off the receiver wasn't too hard. Just had to remove some screws with the hex wrench that came with the car. After that I unplugged the servo and speed control. With some okie ingenuity I was able to rig up a connection to the servo with a servo extension from SparkFun even though the plugs didn't completely mate.
Once I got the whole thing wired up I began with some simple code from the arduino sketches to "write" the servo positions to the servo. I had to swap some wires to establish what was power, ground, and data but once that was established I was able to point wheels left, right, and center on command. I did notice that although the servo was equipped to run from 0 to 180 degrees the linkages under the car only allowed for a min of 45 and a max of 135 with 90 being dead center.
Soon I hope to combine the waypoint bearing calculations and compass readings from the navigation testing with the servo controller code!
Saturday, June 4, 2011
Fun with Trigonometry!
So now we have a nice heading value coming back from the compass. Next I need to calculate a bearing to know what to match my heading to. I Frankensteined my San Jose GPS module off of the old truck onto the dev shield that had the compass already running.http://www.blogger.com/img/blank.gif. With a few code tweaks to combine code from the compass example and last year's banana I was able to get a heading along with a latitude and longitude.
Ok so I know where I am and where I'm facing.... I need somewhere to go....
What I did to get crackin' at some testing was to pick several points (8 to be precise). The first four were directly north, south, east, and west of my current position on my desk.
This is fairly simple to fake, in North America we live in the 4th quadrant, latitude to the north will increase - latitudes south will have a smaller decreased value. For longitude we will have increasing numerical values to the east (although they will still be negative) and even smaller negative values numbers ("more negativer") numbers to the west.
For points north east, south east, south west, and north west I had to do some thinking but I already had values to combine from the first set of spoofed points.
Now the hard part: trigonometry. For me the classes that introduced me to the theories of Pythagoras were of a bygone era. Quite literally the last time I used trigonometry to do much of anything I was a decade ago. This was going to be fun I thought I'd just work out the 8 examples and with an arcosine or two I'd have the bearing in radians er or degrees ... or was that supposed to be arctangent?
I will admit that I eventually caved and got the calculation for bearing by googling. This proves that anyone regardless of how they did in math in highschool may be able to program a robot to drive itself around. More on test results later.
Ok so I know where I am and where I'm facing.... I need somewhere to go....
What I did to get crackin' at some testing was to pick several points (8 to be precise). The first four were directly north, south, east, and west of my current position on my desk.
This is fairly simple to fake, in North America we live in the 4th quadrant, latitude to the north will increase - latitudes south will have a smaller decreased value. For longitude we will have increasing numerical values to the east (although they will still be negative) and even smaller negative values numbers ("more negativer") numbers to the west.
For points north east, south east, south west, and north west I had to do some thinking but I already had values to combine from the first set of spoofed points.
Now the hard part: trigonometry. For me the classes that introduced me to the theories of Pythagoras were of a bygone era. Quite literally the last time I used trigonometry to do much of anything I was a decade ago. This was going to be fun I thought I'd just work out the 8 examples and with an arcosine or two I'd have the bearing in radians er or degrees ... or was that supposed to be arctangent?
I will admit that I eventually caved and got the calculation for bearing by googling. This proves that anyone regardless of how they did in math in highschool may be able to program a robot to drive itself around. More on test results later.
Wednesday, May 25, 2011
Heading out
So after running the car flat out and watching my children crash it into trees an parked cars, I decided it was far past time to get to work. I wanted to first address problems with steering from last year. I had a GPS module to tell me when to turn but I was using a rather crude delay to time the corning for the truck.
This year I got a compass! With the compass I should be able to get a heading to point the truck in the right direction. In the past I attempted to use the GPS modulehttp://www.blogger.com/img/blank.gif for this but had limited success. GPS modules need time to get locks and can take even more time it seems to establish that you are traveling in a specific direction. During last year's Autonomous Vehicle Competition at SparkFun I overheard several other teams having difficulty getting reliable data from GPS - either because of the weather (snow/rain) or because of weather proofing (plastic wrap, zip sandwich bags, tupperware, etc)
Instead I give you the HMC6352 for an instant heading. I wired up the HMC6352 to a development shield on my arduino and with some example code I was able to get reasonable values for where I pointed the little bugger. When I turned right the heading followed - turned left and numbers seemed to go in the right direction.
Yay!
This year I got a compass! With the compass I should be able to get a heading to point the truck in the right direction. In the past I attempted to use the GPS modulehttp://www.blogger.com/img/blank.gif for this but had limited success. GPS modules need time to get locks and can take even more time it seems to establish that you are traveling in a specific direction. During last year's Autonomous Vehicle Competition at SparkFun I overheard several other teams having difficulty getting reliable data from GPS - either because of the weather (snow/rain) or because of weather proofing (plastic wrap, zip sandwich bags, tupperware, etc)
Instead I give you the HMC6352 for an instant heading. I wired up the HMC6352 to a development shield on my arduino and with some example code I was able to get reasonable values for where I pointed the little bugger. When I turned right the heading followed - turned left and numbers seemed to go in the right direction.
Yay!
Subscribe to:
Posts (Atom)