Skip to content

Commit

Permalink
Merge pull request #116 from LORD-MicroStrain/fix/cv7_ublox_example_f…
Browse files Browse the repository at this point in the history
…ix_type_bug

Fixed UBlox parser bug
  • Loading branch information
drobb257 authored Nov 22, 2024
2 parents e84d13b + dc0ae42 commit 6a483df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/CV7_INS/CV7_INS_simple_ublox_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ int main(int argc, const char* argv[])

// Check if measurement update is valid to send
mip::Timestamp elapsed_time_from_last_measurement_update = current_timestamp - prev_measurement_update_timestamp;
bool ublox_data_valid = pvt_message_valid && pvt_message.time_valid && pvt_message.llh_position_valid;
bool ublox_data_valid = pvt_message_valid && pvt_message.time_valid && pvt_message.fix_valid;
bool send_measurement_update = ublox_data_valid && elapsed_time_from_last_measurement_update > 250; // Cap maximum GNSS measurement input rate to 4hz

if (send_measurement_update)
Expand Down
13 changes: 11 additions & 2 deletions examples/CV7_INS/ublox_device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,22 @@ namespace mip
double longitude = 0;
double height_above_ellipsoid = 0;
float llh_position_uncertainty[3] = {0, 0, 0};
bool llh_position_valid = false;
bool fix_valid = false;

// NED velocity
float ned_velocity[3] = {0, 0, 0};
float ned_velocity_uncertainty[3] = {0, 0, 0};
};

enum FixType : uint8_t
{
NO_FIX = 0,
DEAD_RECKONING_ONLY = 1,
FIX_2D = 2,
FIX_3D = 3,
FIX_3D_AND_DEAD_RECKONING = 4,
TIME_FIX_ONLY = 5
};

UbloxPVTMessage extract_pvt_message(const uint8_t payload[PVT_PAYLOAD_SIZE])
{
Expand All @@ -118,7 +127,7 @@ namespace mip
ublox_message.llh_position_uncertainty[0] = float(ublox_message_raw.horizontal_accuracy) * 1e-3f;
ublox_message.llh_position_uncertainty[1] = float(ublox_message_raw.horizontal_accuracy) * 1e-3f;
ublox_message.llh_position_uncertainty[2] = float(ublox_message_raw.vertical_accuracy) * 1e-3f;
ublox_message.llh_position_valid = !ublox_message_raw.llh_invalid_flag;
ublox_message.fix_valid = ublox_message_raw.fix_type == FIX_3D || ublox_message_raw.fix_type == FIX_3D_AND_DEAD_RECKONING;

// NED velocity
ublox_message.ned_velocity[0] = float(ublox_message_raw.north_velocity) * 1e-3f;
Expand Down

0 comments on commit 6a483df

Please sign in to comment.