We built an Autonomous Robot with the Lego NXT Mindstorm kit.
Self-driving cars are all the rage these days! We set out to make a robot that could find its own way to a target. Yep. We wanted to just type in some coordinates and let it go. Any obstacles be darned. So we built a 5-Minute robot (directions on how to build here), slapped the Dexter Industries dGPS sensor and a HiTechnic Compass on the robot, and let it go. The goal was to find our way from one end of a parking lot to the other, bypass any obstacles, and stop at 5 meters from the destination.
It was easy. No, seriously, it was easy in NXT-G. The most complicated aspect of the program was the datalogging! You can see the program below.
The Program:
The program uses the Navigator block to calculate the compass heading to the destination, and the Compass to determine which way the robot is going. The difference between the compass reading (the direction it is going) and the GPS angle to destination (the direction it should be going) is fed into the steering program, which turns the robot in the right direction. We also added a function that documents the location of the robot, so we could record and then see its path on Google Maps. Here’s a picture (click to make it larger and read the annotations):
We also wanted the robot to be able to work its way around any obstacles (cars, islands in the parking lot, etc). To do that, we added an ultrasonic sensor and wrote the program so that when the robot got within a few feet of something, it would stop, turn, and drive a bit – then continue on its way! Rinse and repeat as new obstacles come up.
Just to test the program out, we went up to the SARG and kicked it: it bounced off course, but found the right direction and made it to the goal anyway.
Running the Robot
Here’s a satellite view of the parking lot:
We ended up doing two runs. The first run had virtually no obstacles and was just to test whether the robot could go from one end of the parking lot to another. We entered the destination coordinates in place and let it go. You can see the course in the picture to the right.
Run #1: Simply Finding the Target
We just turned on the program, put the dGPS in the destination, and typed the coordinates into our program. Then we walked it around to the other end of the parking lot.
We pointed it in the wrong direction, just to make sure it would work. And voila: we let her rip!
The robot moved from one end of the parking lot, found its way to the other end. This was an easy task with the dGPS: there were no obstacles in the way and we just wanted to see the robot find the target.
You can see the path the robot took below.
Watch the video of Run #1 here:
Run #2: Getting Around Obstacles
In the second run, the robot made its way around two sets of islands, across the parking lot, and stopped within 5 meters of the destination. The robot made it over rough terrain that bounced it around and confused its direction. However, the robot was persistent. You can see below that it found its way around obstacles.
We let the robot do it’s thing and it did surprisingly well. You can see the path it traveled below.
See a video of Run #2 here:
Doing it on your own:
Doing it on your own is easy. You can buy the dGPS GPS Sensor for Mindstorms NXT here. You can download our example programs in the Downloads and Documents” section of the dGPS webpage.
You can see our instructions on Youtube about how to quickly build the 5-minute robot for this project.
Dream bigger:
Someday, we’ll turn this into an autonomous car that can go down to 7-11 and buy us a Coke. And do it with solar power.
3 Comments
-
awsome!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
Can we do this without the Lego Mindstorm NXT kit and robot?
-
Yes, yes you can. You just need the dGPS sensor. You also might want a compass; we will be coming out with one soon!
-
Leave a reply
You must be logged in to post a comment.