track.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2012 Swift Navigation Inc.
00003  * Contact: Fergus Noble <fergus@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_TRACK_H
00014 #define LIBSWIFTNAV_TRACK_H
00015 
00016 #include "common.h"
00017 #include "ephemeris.h"
00018 
00028 typedef struct {
00029   float pgain;         
00030   float igain;         
00031   float aiding_igain;  
00032   float prev_error;    
00033   float y;             
00034 } aided_lf_state_t;
00035 
00039 typedef struct {
00040   float pgain;      
00041   float igain;      
00042   float prev_error; 
00043   float y;          
00044 } simple_lf_state_t;
00045 
00046 typedef struct { //TODO, add carrier aiding to the code loop.
00047   float carr_freq;             
00048   aided_lf_state_t carr_filt ; 
00049   float code_freq;             
00050   simple_lf_state_t code_filt; 
00051   float prev_I;                
00052   float prev_Q;                
00053 } aided_tl_state_t;
00054 
00058 typedef struct {
00059   float code_freq;             
00060   float carr_freq;             
00061   simple_lf_state_t code_filt; 
00062   simple_lf_state_t carr_filt; 
00063 } simple_tl_state_t;
00064 
00069 typedef struct {
00070   float code_freq;             
00071   float carr_freq;             
00072   simple_lf_state_t code_filt; 
00073   simple_lf_state_t carr_filt; 
00074   u32 sched;                   
00075   u32 n;                       
00076   float A;                     
00077   float carr_to_code;          
00078 } comp_tl_state_t;
00079 
00080 
00084 typedef struct {
00085   float I; 
00086   float Q; 
00087 } correlation_t;
00088 
00092 typedef struct {
00093   float log_bw;     
00094   float A;          
00095   float I_prev_abs; 
00096   float nsr;        
00097 } cn0_est_state_t;
00098 
00109 typedef struct {
00110   u8 prn;                  
00111   double code_phase_chips; 
00112   double code_phase_rate;  
00113   double carrier_phase;    
00114   double carrier_freq;     
00115   u32 time_of_week_ms;     
00117   double receiver_time;    
00119   double snr;              
00120   u16 lock_counter;        
00126 } channel_measurement_t;
00127 
00128 typedef struct {
00129   double raw_pseudorange;
00130   double pseudorange;
00131   double carrier_phase;
00132   double raw_doppler;
00133   double doppler;
00134   double sat_pos[3];
00135   double sat_vel[3];
00136   double snr;
00137   double lock_time;
00138   gps_time_t tot;
00139   u8 prn;
00140   u16 lock_counter;
00141 } navigation_measurement_t;
00142 
00143 void calc_loop_gains(float bw, float zeta, float k, float loop_freq,
00144                      float *pgain, float *igain);
00145 float costas_discriminator(float I, float Q);
00146 float frequency_discriminator(float I, float Q, float prev_I, float prev_Q);
00147 float dll_discriminator(correlation_t cs[3]);
00148 
00149 void aided_lf_init(aided_lf_state_t *s, float y0,
00150                    float pgain, float igain,
00151                    float aiding_igain);
00152 float aided_lf_update(aided_lf_state_t *s, float p_i_error, float aiding_error);
00153 
00154 void simple_lf_init(simple_lf_state_t *s, float y0,
00155                     float pgain, float igain);
00156 float simple_lf_update(simple_lf_state_t *s, float error);
00157 
00158 
00159 void simple_tl_init(simple_tl_state_t *s, float loop_freq,
00160                     float code_freq, float code_bw,
00161                     float code_zeta, float code_k,
00162                     float carr_freq, float carr_bw,
00163                     float carr_zeta, float carr_k);
00164 void simple_tl_update(simple_tl_state_t *s, correlation_t cs[3]);
00165 
00166 void aided_tl_init(aided_tl_state_t *s, float loop_freq,
00167                    float code_freq, float code_bw,
00168                    float code_zeta, float code_k,
00169                    float carr_freq, float carr_bw,
00170                    float carr_zeta, float carr_k,
00171                    float carr_freq_igain);
00172 void aided_tl_update(aided_tl_state_t *s, correlation_t cs[3]);
00173 
00174 void comp_tl_init(comp_tl_state_t *s, float loop_freq,
00175                     float code_freq, float code_bw,
00176                     float code_zeta, float code_k,
00177                     float carr_freq, float carr_bw,
00178                     float carr_zeta, float carr_k,
00179                     float tau, float cpc, u32 sched);
00180 void comp_tl_update(comp_tl_state_t *s, correlation_t cs[3]);
00181 
00182 void cn0_est_init(cn0_est_state_t *s, float bw, float cn0_0,
00183                   float cutoff_freq, float loop_freq);
00184 float cn0_est(cn0_est_state_t *s, float I);
00185 
00186 void calc_navigation_measurement(u8 n_channels, channel_measurement_t meas[],
00187                                  navigation_measurement_t nav_meas[],
00188                                  double nav_time, ephemeris_t ephemerides[]);
00189 void calc_navigation_measurement_(u8 n_channels, channel_measurement_t* meas[],
00190                                   navigation_measurement_t* nav_meas[],
00191                                   double nav_time, ephemeris_t* ephemerides[]);
00192 
00193 int nav_meas_cmp(const void *a, const void *b);
00194 u8 tdcp_doppler(u8 n_new, navigation_measurement_t *m_new,
00195                 u8 n_old, navigation_measurement_t *m_old,
00196                 navigation_measurement_t *m_corrected);
00197 
00198 #endif /* LIBSWIFTNAV_TRACK_H */
00199 


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:15