A RF map-based localization algorithm for indoor environments