A low cost position and attitude sensor for nanosatellites