Showing
1 changed file
with
37 additions
and
2 deletions
... | @@ -40,11 +40,13 @@ | ... | @@ -40,11 +40,13 @@ |
40 | */ | 40 | */ |
41 | 41 | ||
42 | #include "ekf.h" | 42 | #include "ekf.h" |
43 | - | 43 | +#include <iostream> |
44 | #include <ecl.h> | 44 | #include <ecl.h> |
45 | #include <geo_lookup/geo_mag_declination.h> | 45 | #include <geo_lookup/geo_mag_declination.h> |
46 | #include <mathlib/mathlib.h> | 46 | #include <mathlib/mathlib.h> |
47 | - | 47 | +#include <modules/navigator/mission.h> |
48 | +static int hold=0; | ||
49 | +int flag=0; | ||
48 | // GPS pre-flight check bit locations | 50 | // GPS pre-flight check bit locations |
49 | #define MASK_GPS_NSATS (1<<0) | 51 | #define MASK_GPS_NSATS (1<<0) |
50 | #define MASK_GPS_PDOP (1<<1) | 52 | #define MASK_GPS_PDOP (1<<1) |
... | @@ -58,6 +60,26 @@ | ... | @@ -58,6 +60,26 @@ |
58 | 60 | ||
59 | bool Ekf::collect_gps(const gps_message &gps) | 61 | bool Ekf::collect_gps(const gps_message &gps) |
60 | { | 62 | { |
63 | + mission_s mission; | ||
64 | + (dm_read(DM_KEY_MISSION_STATE, 0, &mission, sizeof(mission_s)) == sizeof(mission_s)); | ||
65 | + | ||
66 | + for (size_t i = 0; i < mission.count; i++) { | ||
67 | + | ||
68 | + struct mission_item_s mission_item {}; | ||
69 | + | ||
70 | + (dm_read((dm_item_t)mission.dataman_id, i, &mission_item, sizeof(mission_item_s)) == sizeof(mission_item_s)); | ||
71 | + if(flag==0) | ||
72 | + { | ||
73 | + /* error reading, mission is invalid */ | ||
74 | + std::cout<<"----------"<<std::endl; | ||
75 | + std::cout<<i+1<<std::endl; | ||
76 | + std::cout<< mission_item.lat <<std::endl; | ||
77 | + } | ||
78 | + | ||
79 | + } | ||
80 | + flag=1; | ||
81 | + | ||
82 | + | ||
61 | // Run GPS checks always | 83 | // Run GPS checks always |
62 | _gps_checks_passed = gps_is_good(gps); | 84 | _gps_checks_passed = gps_is_good(gps); |
63 | 85 | ||
... | @@ -140,6 +162,19 @@ bool Ekf::collect_gps(const gps_message &gps) | ... | @@ -140,6 +162,19 @@ bool Ekf::collect_gps(const gps_message &gps) |
140 | _earth_rate_NED = calcEarthRateNED((float)math::radians(lat)); | 162 | _earth_rate_NED = calcEarthRateNED((float)math::radians(lat)); |
141 | } | 163 | } |
142 | } | 164 | } |
165 | + if(hold != int(gps.time_usec/1000000)) | ||
166 | + { | ||
167 | + hold=int(gps.time_usec/1000000); | ||
168 | + if(hold%2==0) | ||
169 | + { | ||
170 | + std::cout <<"----------------------current--------------------------"<<std::endl; | ||
171 | + std :: cout << "time : "<<gps.time_usec/1000000<<std::endl; | ||
172 | + std :: cout << "lat : " <<gps.lat <<std::endl; | ||
173 | + std :: cout << "lon : " <<gps.lon <<std::endl; | ||
174 | + std :: cout << "alt : " <<gps.alt <<std::endl; | ||
175 | + } | ||
176 | + } | ||
177 | + // print GPS data every 1 seocnds | ||
143 | 178 | ||
144 | // start collecting GPS if there is a 3D fix and the NED origin has been set | 179 | // start collecting GPS if there is a 3D fix and the NED origin has been set |
145 | return _NED_origin_initialised && (gps.fix_type >= 3); | 180 | return _NED_origin_initialised && (gps.fix_type >= 3); | ... | ... |
-
Please register or login to post a comment