I have data from an accelerometer that measures X,Y,Z acceleration and data from a gyroscope that measure pitch, roll and yaw. How would I combine this data to find robot location and orientation in 2D or 3D space?
Look into nonlinear filters, particularly the unscented kalman filter (ukf). Using a ukf to fuse the data from a gyroscope and accelerometer will allow you to estimate orientation. However, these two sensors alone will not be capable of estimating position. You will need some sort of sensor that measures distance or position.
For information on the ukf, look into Probabilistic Robotics.
Response to comment-
Imagine you are trying to estimate the position of a car that is traveling down a straight road. To estimate the position of the car, you are given a picture of the car's speedometer every second. You can get an idea of how far the car has traveled using this information but you will not know for certain. If there is any bias in the speedometer, your guess of the total distance traveled will be way off. To really know the car's position, you need to be able to measure it directly.
Unfortunately I cannot comment.
You can, but it will most likely be very inaccurate. If you use an accelerometer output to calculate displacement by double integration, any error will be compounding. Because you have no way to offset this error, over time it will become so large that the position value is meaningless.
The other issue is if you are moving at constant velocity the accelerometer will report 0m/s/s, so double integration with respect to time will give a displacement of 0, making the robot appear stationary.
Here's a pretty good overview of what holmeski is saying, and using multiple sensors in general for different applications.
FWIW DARPA is, and has been looking into inertial sensors with enough precision to get useful positional tracking. It's called "Micro-PNT" for "position navigation and timing" and the idea is to not need a GPS.
Also, here's some more info directly from the DARPA site.
"The micro-PNT initiatives seek to increase the dynamic range of inertial sensors, reduce long-term drift in clocks and inertial sensors, and to develop miniature chips providing position, orientation, and time information. "
The bottom line general answer is, current inertial sensors generate too much uncertainty to be used standalone, and sensor fusion has it's own set of limitations.
I did the same in my graduation project. What you need is:
Controlled movement over your machine, that you can command the machine to move 1 meter forward or 50cm back etc.
You need to train your system to learn from accelerometer data according to those controlled movements.
Train on different surfaces and also calculate the time elapsed in one particular move.
After some training your machine will understand that what does it means to move 1 meter forward or backward.
Believe me, it works like magic. My project was 3D semantic analysis and map reconstruction using autonomous agents, and I have not used GPS at all. I hope this will help you and somehow will also motivate you because its possible. :-)