00001 // -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*- 00002 // 00003 // Hardware in the loop gps class. 00004 // Code by James Goppert 00005 // 00006 // This library is free software; you can redistribute it and / or 00007 // modify it under the terms of the GNU Lesser General Public 00008 // License as published by the Free Software Foundation; either 00009 // version 2.1 of the License, or (at your option) any later version. 00010 // 00011 // GPS configuration : Custom protocol per "DIYDrones Custom Binary Sentence Specification V1.1" 00012 // 00013 00014 #include "AP_GPS_HIL.h" 00015 #include "WProgram.h" 00016 00017 // Constructors //////////////////////////////////////////////////////////////// 00018 AP_GPS_HIL::AP_GPS_HIL(Stream *s) : GPS(s) 00019 { 00020 } 00021 00022 // Public Methods ////////////////////////////////////////////////////////////// 00023 void AP_GPS_HIL::init(void) 00024 { 00025 } 00026 00027 bool AP_GPS_HIL::read(void) 00028 { 00029 bool result = _updated; 00030 00031 // return true once for each update pushed in 00032 _updated = false; 00033 return result; 00034 } 00035 00036 void AP_GPS_HIL::setHIL(long _time, float _latitude, float _longitude, float _altitude, 00037 float _ground_speed, float _ground_course, float _speed_3d, uint8_t _num_sats) 00038 { 00039 time = _time; 00040 latitude = _latitude*1.0e7; 00041 longitude = _longitude*1.0e7; 00042 altitude = _altitude*1.0e2; 00043 ground_speed = _ground_speed*1.0e2; 00044 ground_course = _ground_course*1.0e2; 00045 speed_3d = _speed_3d*1.0e2; 00046 num_sats = _num_sats; 00047 fix = true; 00048 _updated = true; 00049 } 00050