As a mobile robot navigates through an indoor environment, the condition of the floor is of low (or no) relevance to its decisions. In an outdoor environment, however, terrain characteristics play a major role on the robot's motion. Without an adequate assessment of terrain conditions and irregularities, the robot will be prone to major failures, since the environment conditions may greatly vary. As such, it may assume any orientation about the three axes of its reference frame, which leads to a full six degrees of freedom configuration. The added three degrees of freedom have a major bearing on position and velocity estimation due to higher time complexity of classical techniques such as Kalman filters and particle filters. This article presents an algorithm for localization of mobile robots based on the complementary filtering technique to estimate the localization and orientation, through the fusion of data from IMU, GPS and compass. The main advantages are the low complexity of implementation and the high quality of the results for the case of navigation in outdoor environments (uneven terrain). The results obtained through this system are compared positively with those obtained using more complex and time consuming classic techniques.