mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-26 21:17:38 +00:00
Minor changes
This commit is contained in:
@@ -34,10 +34,6 @@
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <glog/logging.h>
|
||||
#include "concurrent_queue.h"
|
||||
#include "gps_cnav_ephemeris.h"
|
||||
#include "gps_almanac.h"
|
||||
#include "gps_cnav_iono.h"
|
||||
#include "gps_cnav_utc_model.h"
|
||||
#include "configuration_interface.h"
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <string>
|
||||
#include "telemetry_decoder_interface.h"
|
||||
#include "gps_l5_telemetry_decoder_cc.h"
|
||||
#include "gnss_satellite.h"
|
||||
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "gnss_synchro.h"
|
||||
#include "gps_l5_telemetry_decoder_cc.h"
|
||||
#include "gps_cnav_ephemeris.h"
|
||||
#include "gps_cnav_iono.h"
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
@@ -70,6 +72,19 @@ gps_l5_telemetry_decoder_cc::gps_l5_telemetry_decoder_cc(
|
||||
|
||||
//initialize the CNAV frame decoder (libswiftcnav)
|
||||
cnav_msg_decoder_init(&d_cnav_decoder);
|
||||
for(int aux = 0; aux < GPS_L5_NH_CODE_LENGTH; aux++)
|
||||
{
|
||||
if(GPS_L5_NH_CODE[aux] == 0)
|
||||
{
|
||||
bits_NH[aux] = -1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bits_NH[aux] = 1.0;
|
||||
}
|
||||
}
|
||||
sync_NH = false;
|
||||
new_sym = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,26 +111,58 @@ int gps_l5_telemetry_decoder_cc::general_work (int noutput_items __attribute__((
|
||||
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
|
||||
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
|
||||
|
||||
// UPDATE GNSS SYNCHRO DATA
|
||||
Gnss_Synchro current_synchro_data; //structure to save the synchronization information and send the output object to the next block
|
||||
//1. Copy the current tracking output
|
||||
current_synchro_data = in[0];
|
||||
consume_each(1); //one by one
|
||||
sym_hist.push_back(in[0].Prompt_I);
|
||||
double symbol_value = 0.0;
|
||||
|
||||
if(sym_hist.size() == GPS_L5_NH_CODE_LENGTH)
|
||||
{
|
||||
std::deque<double>::iterator it;
|
||||
int corr_NH = 0;
|
||||
it = sym_hist.begin();
|
||||
for(int i = 0; i < GPS_L5_NH_CODE_LENGTH; i++)
|
||||
{
|
||||
if((bits_NH[i] * (*it)) > 0.0){corr_NH += 1;}
|
||||
else{corr_NH -= 1;}
|
||||
it++;
|
||||
}
|
||||
if(abs(corr_NH) == GPS_L5_NH_CODE_LENGTH){sync_NH = true;}
|
||||
else
|
||||
{
|
||||
sym_hist.pop_front();
|
||||
sync_NH = false;
|
||||
}
|
||||
if (sync_NH)
|
||||
{
|
||||
new_sym = true;
|
||||
for(it = sym_hist.begin(); it != sym_hist.end(); it++)
|
||||
{
|
||||
symbol_value += (*it);
|
||||
}
|
||||
sym_hist.clear();
|
||||
}
|
||||
}
|
||||
|
||||
bool flag_new_cnav_frame = false;
|
||||
cnav_msg_t msg;
|
||||
u32 delay = 0;
|
||||
|
||||
//add the symbol to the decoder
|
||||
u8 symbol_clip = static_cast<u8>(in[0].Prompt_I > 0) * 255;
|
||||
flag_new_cnav_frame = cnav_msg_decoder_add_symbol(&d_cnav_decoder, symbol_clip, &msg, &delay);
|
||||
|
||||
consume_each(1); //one by one
|
||||
|
||||
// UPDATE GNSS SYNCHRO DATA
|
||||
Gnss_Synchro current_synchro_data; //structure to save the synchronization information and send the output object to the next block
|
||||
|
||||
//1. Copy the current tracking output
|
||||
current_synchro_data = in[0];
|
||||
|
||||
if(new_sym)
|
||||
{
|
||||
u8 symbol_clip = static_cast<u8>(symbol_value > 0.0) * 255;
|
||||
flag_new_cnav_frame = cnav_msg_decoder_add_symbol(&d_cnav_decoder, symbol_clip, &msg, &delay);
|
||||
new_sym = false;
|
||||
}
|
||||
//2. Add the telemetry decoder information
|
||||
//check if new CNAV frame is available
|
||||
if (flag_new_cnav_frame == true)
|
||||
{
|
||||
std::cout << "NEW CNAV FRAME" << std::endl;
|
||||
std::bitset<GPS_L5_CNAV_DATA_PAGE_BITS> raw_bits;
|
||||
//Expand packet bits to bitsets. Notice the reverse order of the bits sequence, required by the CNAV message decoder
|
||||
for (u32 i = 0; i < GPS_L5_CNAV_DATA_PAGE_BITS ; i++)
|
||||
@@ -169,12 +216,6 @@ int gps_l5_telemetry_decoder_cc::general_work (int noutput_items __attribute__((
|
||||
current_synchro_data.TOW_at_current_symbol_s = d_TOW_at_current_symbol;
|
||||
current_synchro_data.Flag_valid_word = d_flag_valid_word;
|
||||
|
||||
// if (flag_PLL_180_deg_phase_locked == true)
|
||||
// {
|
||||
// //correct the accumulated phase for the Costas loop phase shift, if required
|
||||
// current_synchro_data.Carrier_phase_rads += GPS_PI;
|
||||
// }
|
||||
|
||||
if(d_dump == true)
|
||||
{
|
||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||
|
||||
@@ -31,17 +31,15 @@
|
||||
#ifndef GNSS_SDR_GPS_L5_TELEMETRY_DECODER_CC_H
|
||||
#define GNSS_SDR_GPS_L5_TELEMETRY_DECODER_CC_H
|
||||
|
||||
#include <algorithm> // for copy
|
||||
#include <algorithm>
|
||||
#include <deque>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <utility> // for pair
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <gnuradio/block.h>
|
||||
#include "gnss_satellite.h"
|
||||
#include "gps_cnav_navigation_message.h"
|
||||
#include "gps_cnav_ephemeris.h"
|
||||
#include "gps_cnav_iono.h"
|
||||
#include "concurrent_queue.h"
|
||||
|
||||
extern "C" {
|
||||
@@ -99,6 +97,10 @@ private:
|
||||
bool d_flag_valid_word;
|
||||
|
||||
Gps_CNAV_Navigation_Message d_CNAV_Message;
|
||||
double bits_NH[GPS_L5_NH_CODE_LENGTH];
|
||||
std::deque<double> sym_hist;
|
||||
bool sync_NH;
|
||||
bool new_sym;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -49,11 +49,9 @@
|
||||
*/
|
||||
/** Viterbi decoder reversed polynomial A */
|
||||
#define GPS_L2C_V27_POLY_A (0x4F) /* 0b01001111 - reversed 0171*/
|
||||
#define GPS_L5_V27_POLY_A (0x4F) /* 0b01001111 - reversed 0171*/
|
||||
|
||||
/** Viterbi decoder reversed polynomial B */
|
||||
#define GPS_L2C_V27_POLY_B (0x6D) /* 0b01101101 - reversed 0133 */
|
||||
#define GPS_L5_V27_POLY_B (0x6D) /* 0b01101101 - reversed 0133 */
|
||||
/*
|
||||
* GPS L2C message constants.
|
||||
*/
|
||||
|
||||
@@ -49,16 +49,12 @@
|
||||
|
||||
/** Size of the Viterbi decoder history. */
|
||||
#define GPS_L2_V27_HISTORY_LENGTH_BITS 64
|
||||
#define GPS_L5_V27_HISTORY_LENGTH_BITS 64
|
||||
/** Bits to accumulate before decoding starts. */
|
||||
#define GPS_L2C_V27_INIT_BITS (32)
|
||||
#define GPS_L5_V27_INIT_BITS (32)
|
||||
/** Bits to decode at a time. */
|
||||
#define GPS_L2C_V27_DECODE_BITS (32)
|
||||
#define GPS_L5_V27_DECODE_BITS (32)
|
||||
/** Bits in decoder tail. We ignore them. */
|
||||
#define GPS_L2C_V27_DELAY_BITS (32)
|
||||
#define GPS_L5_V27_DELAY_BITS (32)
|
||||
/**
|
||||
* GPS CNAV message container.
|
||||
*
|
||||
@@ -73,15 +69,6 @@ typedef struct
|
||||
u8 raw_msg[GPS_L2C_V27_DECODE_BITS + GPS_L2C_V27_DELAY_BITS]; /**< RAW MSG for GNSS-SDR */
|
||||
} cnav_msg_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 prn; /**< SV PRN. 0..31 */
|
||||
u8 msg_id; /**< Message id. 0..31 */
|
||||
u32 tow; /**< GPS ToW in 6-second units. Multiply to 6 to get seconds. */
|
||||
bool alert; /**< CNAV message alert flag */
|
||||
u8 raw_msg[GPS_L5_V27_DECODE_BITS + GPS_L5_V27_DELAY_BITS]; /**< RAW MSG for GNSS-SDR */
|
||||
} cnav_L5_msg_t;
|
||||
|
||||
/**
|
||||
* GPS CNAV decoder component.
|
||||
* This component controls symbol decoding string.
|
||||
@@ -109,27 +96,6 @@ typedef struct {
|
||||
* do not produce output. */
|
||||
} cnav_v27_part_t;
|
||||
|
||||
typedef struct {
|
||||
v27_t dec; /**< Viterbi block decoder object */
|
||||
v27_decision_t decisions[GPS_L5_V27_HISTORY_LENGTH_BITS];
|
||||
/**< Decision graph */
|
||||
unsigned char symbols[(GPS_L5_V27_INIT_BITS + GPS_L5_V27_DECODE_BITS) * 2];
|
||||
/**< Symbol buffer */
|
||||
size_t n_symbols; /**< Count of symbols in the symbol buffer */
|
||||
unsigned char decoded[GPS_L5_V27_DECODE_BITS + GPS_L5_V27_DELAY_BITS];
|
||||
/**< Decode buffer */
|
||||
size_t n_decoded; /**< Number of bits in the decode buffer */
|
||||
bool preamble_seen; /**< When true, the decode buffer is aligned on
|
||||
* preamble. */
|
||||
bool invert; /**< When true, indicates the bits are inverted */
|
||||
bool message_lock; /**< When true, indicates the message boundary
|
||||
* is found. */
|
||||
bool crc_ok; /**< Flag that the last message had good CRC */
|
||||
size_t n_crc_fail; /**< Counter for CRC failures */
|
||||
bool init; /**< Initial state flag. When true, initial bits
|
||||
* do not produce output. */
|
||||
} cnav_L5_v27_part_t;
|
||||
|
||||
/**
|
||||
* GPS CNAV message lock and decoder object.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user