ambiguity_test.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2014 Swift Navigation Inc.
00003  * Contact: Ian Horn <ian@swift-nav.com>
00004  *
00005  * This source is subject to the license found in the file 'LICENSE' which must
00006  * be be distributed together with this source. All other rights reserved.
00007  *
00008  * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
00009  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
00010  * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
00011  */
00012 
00013 #ifndef LIBSWIFTNAV_AMBIGUITY_TEST_H
00014 #define LIBSWIFTNAV_AMBIGUITY_TEST_H
00015 
00016 #include "constants.h"
00017 #include "common.h"
00018 #include "memory_pool.h"
00019 #include "sats_management.h"
00020 
00021 #define MAX_HYPOTHESES 1000
00022 
00023 typedef struct {
00024   s32 N[MAX_CHANNELS-1];
00025   float ll;
00026 } hypothesis_t;
00027 
00028 typedef struct {
00029   u32 res_dim;
00030   u8 null_space_dim;
00031   double null_projector[(MAX_CHANNELS-4) * (MAX_CHANNELS-1)];
00032   double half_res_cov_inv[(2*MAX_CHANNELS - 5) * (2*MAX_CHANNELS - 5)];
00033 } residual_mtxs_t;
00034 
00035 typedef struct {
00036   u8 initialized;
00037   u8 num_matching_ndxs;
00038   u8 matching_ndxs[MAX_CHANNELS-1];
00039   s32 ambs[MAX_CHANNELS-1];
00040 } unanimous_amb_check_t; //NOTE maybe do this in a semi-decorrelated space, where more should match sooner.
00041 
00042 typedef struct {
00043   u8 num_dds;
00044   memory_pool_t *pool;
00045   residual_mtxs_t res_mtxs;
00046   sats_management_t sats;
00047   unanimous_amb_check_t amb_check;
00048 } ambiguity_test_t;
00049 
00050 void print_s32_mtx_diff(u32 m, u32 n, s32 *Z_inv1, s32 *Z_inv2);
00051 s8 get_single_hypothesis(ambiguity_test_t *amb_test, s32 *hyp_N);
00052 void create_ambiguity_test(ambiguity_test_t *amb_test);
00053 void reset_ambiguity_test(ambiguity_test_t *amb_test);
00054 void destroy_ambiguity_test(ambiguity_test_t *amb_test);
00055 void init_ambiguity_test(ambiguity_test_t *amb_test, u8 state_dim, u8 *prns, sdiff_t *sdiffs, 
00056                          double *float_mean, double *float_cov, double *DE_mtx, double *obs_cov);
00057 void print_hyp(void *arg, element_t *elem);
00058 s8 sats_match(ambiguity_test_t *amb_test, u8 num_sdiffs, sdiff_t *sdiffs);
00059 u8 ambiguity_update_reference(ambiguity_test_t *amb_test, u8 num_sdiffs, sdiff_t *sdiffs, sdiff_t *sdiffs_with_ref_first);
00060 void update_ambiguity_test(double ref_ecef[3], double phase_var, double code_var,
00061                            ambiguity_test_t *amb_test, u8 state_dim, sdiff_t *sdiffs,
00062                            u8 changed_sats);
00063 void update_unanimous_ambiguities(ambiguity_test_t *amb_test);
00064 u32 ambiguity_test_n_hypotheses(ambiguity_test_t *amb_test);
00065 u8 ambiguity_test_pool_contains(ambiguity_test_t *amb_test, double *ambs);
00066 void ambiguity_test_MLE_ambs(ambiguity_test_t *amb_test, s32 *ambs);
00067 void test_ambiguities(ambiguity_test_t *amb_test, double *ambiguity_dd_measurements);
00068 u8 ambiguity_update_sats(ambiguity_test_t *amb_test, u8 num_sdiffs, sdiff_t *sdiffs,
00069                          sats_management_t *float_sats, double *float_mean, double *float_cov_U, double *float_cov_D);
00070 u8 find_indices_of_intersection_sats(ambiguity_test_t *amb_test, u8 num_sdiffs, sdiff_t *sdiffs_with_ref_first, u8 *intersection_ndxs);
00071 u8 ambiguity_iar_can_solve(ambiguity_test_t *ambiguity_test);
00072 s8 make_dd_measurements_and_sdiffs(u8 ref_prn, u8 *non_ref_prns, u8 num_dds,
00073                                    u8 num_sdiffs, sdiff_t *sdiffs,
00074                                    double *ambiguity_dd_measurements, sdiff_t *amb_sdiffs);
00075 s8 make_ambiguity_resolved_dd_measurements_and_sdiffs(ambiguity_test_t *amb_test,
00076             u8 num_sdiffs, sdiff_t *sdiffs,
00077             double *ambiguity_dd_measurements, sdiff_t *amb_sdiffs);
00078 s8 make_ambiguity_dd_measurements_and_sdiffs(ambiguity_test_t *amb_test, u8 num_sdiffs, sdiff_t *sdiffs,
00079                                                double *ambiguity_dd_measurements, sdiff_t *amb_sdiffs);
00080 s8 make_dd_measurements_and_sdiffs(u8 ref_prn, u8 *non_ref_prns, u8 num_dds,
00081                                    u8 num_sdiffs, sdiff_t *sdiffs,
00082                                    double *ambiguity_dd_measurements, sdiff_t *amb_sdiffs);
00083 u8 ambiguity_sat_projection(ambiguity_test_t *amb_test, u8 num_dds_in_intersection, u8 *dd_intersection_ndxs);
00084 u8 ambiguity_sat_inclusion(ambiguity_test_t *amb_test, u8 num_dds_in_intersection,
00085                              sats_management_t *float_sats, double *float_mean, double *float_cov_U, double *float_cov_D);
00086 u32 float_to_decor(ambiguity_test_t *amb_test,
00087                    double *addible_float_cov, u8 num_addible_dds,
00088                    double *addible_float_mean,
00089                    u8 num_dds_to_add,
00090                    s32 *lower_bounds, s32 *upper_bounds, double *Z);
00091 s8 determine_sats_addition(ambiguity_test_t *amb_test,
00092                            double *float_N_cov, u8 num_float_dds, double *float_N_mean,
00093                            s32 *lower_bounds, s32 *upper_bounds, u8 *num_dds_to_add,
00094                            s32 *Z_inv);
00095 void add_sats(ambiguity_test_t *amb_test,
00096               u8 ref_prn,
00097               u32 num_added_dds, u8 *added_prns,
00098               s32 *lower_bounds, s32 *upper_bounds,
00099               s32 *Z_inv);
00100 void init_residual_matrices(residual_mtxs_t *res_mtxs, u8 num_dds, double *DE_mtx, double *obs_cov);
00101 void assign_residual_covariance_inverse(u8 num_dds, double *obs_cov, double *q, double *r_cov_inv);
00102 void assign_r_vec(residual_mtxs_t *res_mtxs, u8 num_dds, double *dd_measurements, double *r_vec);
00103 void assign_r_mean(residual_mtxs_t *res_mtxs, u8 num_dds, double *hypothesis, double *r_mean);
00104 double get_quadratic_term(residual_mtxs_t *res_mtxs, u8 num_dds, double *hypothesis, double *r_vec);
00105 
00106 #endif /* LIBSWIFTNAV_AMBIGUITY_TEST_H */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:14