mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-04-12 22:03:20 +00:00
Fixed bug that prevented the code to compile in Mac OS. Documentation added
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@189 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
parent
0319b180c6
commit
3533a08330
@ -1,6 +1,7 @@
|
||||
/*!
|
||||
* \file cordic.cc
|
||||
* \brief Implementation of the CORDIC (COordinate Rotation DIgital Computer) algorithm
|
||||
* \brief Implementation of the CORDIC (COordinate Rotation DIgital Computer) algorithm.
|
||||
* This implementation is NOT OPTIMIZED, only for demonstration purposes
|
||||
* \author Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es
|
||||
*
|
||||
* This is a modified implementation of the one found at
|
||||
|
@ -1,10 +1,8 @@
|
||||
/*!
|
||||
* \file cordic.h
|
||||
* \brief Interface of the CORDIC (COordinate Rotation DIgital Computer) algorithm
|
||||
* \brief Interface of the CORDIC (COordinate Rotation DIgital Computer) algorithm.
|
||||
* \author Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es
|
||||
*
|
||||
* This is a modified implementation of the one found at
|
||||
* http://www.dspguru.com/dsp/faqs/cordic
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
@ -42,6 +40,11 @@ typedef struct tagCORDIC_TABLE {
|
||||
double phase_rads;
|
||||
} CORDIC_TABLE;
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Implementation of the CORDIC (COordinate Rotation DIgital Computer) algorithm.
|
||||
* This implementation is NOT OPTIMIZED, only for demonstration purposes
|
||||
*/
|
||||
class Cordic
|
||||
{
|
||||
public:
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*!
|
||||
* \file tcp_communication.h
|
||||
* \brief Library with the definition of the TCP communication class
|
||||
* \file tcp_communication.cc
|
||||
* \brief Implementation of the TCP communication class
|
||||
* \author David Pubill, 2011. dpubill(at)cttc.es
|
||||
*
|
||||
*
|
||||
@ -38,78 +38,86 @@
|
||||
#define NUM_TX_VARIABLES 7
|
||||
#define NUM_RX_VARIABLES 3
|
||||
|
||||
tcp_communication::tcp_communication() : tcp_socket_(io_service_){
|
||||
}
|
||||
|
||||
tcp_communication::~tcp_communication(){
|
||||
}
|
||||
tcp_communication::tcp_communication() : tcp_socket_(io_service_)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
tcp_communication::~tcp_communication()
|
||||
{}
|
||||
|
||||
|
||||
|
||||
int tcp_communication::listen_tcp_connection(size_t d_port_)
|
||||
{
|
||||
try
|
||||
{
|
||||
//! Specify IP type and port
|
||||
boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), d_port_);
|
||||
boost::asio::ip::tcp::acceptor acceptor(io_service_, endpoint);
|
||||
try
|
||||
{
|
||||
// Specify IP type and port
|
||||
boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), d_port_);
|
||||
boost::asio::ip::tcp::acceptor acceptor(io_service_, endpoint);
|
||||
|
||||
//! Reuse the IP address for each connection
|
||||
acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
|
||||
// Reuse the IP address for each connection
|
||||
acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
|
||||
|
||||
std::cout << "Server ready on port " << d_port_ << std::endl;
|
||||
std::cout << "Server ready on port " << d_port_ << std::endl;
|
||||
|
||||
//! Listen for a connection and accept it
|
||||
acceptor.listen(12);
|
||||
acceptor.accept(tcp_socket_);
|
||||
// Listen for a connection and accept it
|
||||
acceptor.listen(12);
|
||||
acceptor.accept(tcp_socket_);
|
||||
|
||||
std::cout << "Socket accepted on port " << d_port_ << std::endl;
|
||||
}
|
||||
std::cout << "Socket accepted on port " << d_port_ << std::endl;
|
||||
}
|
||||
|
||||
catch(std::exception& e)
|
||||
{
|
||||
std::cerr << "Exception: " << e.what() << std::endl;
|
||||
}
|
||||
catch(std::exception& e)
|
||||
{
|
||||
std::cerr << "Exception: " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void tcp_communication::send_receive_tcp_packet(boost::array<float, NUM_TX_VARIABLES> buf, tcp_packet_data *tcp_data_)
|
||||
{
|
||||
int controlc = 0;
|
||||
boost::array<float, NUM_RX_VARIABLES> readbuf;
|
||||
float d_control_id_ = buf.data()[6];
|
||||
int controlc = 0;
|
||||
boost::array<float, NUM_RX_VARIABLES> readbuf;
|
||||
float d_control_id_ = buf.data()[6];
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
//! Send a TCP packet
|
||||
tcp_socket_.write_some(boost::asio::buffer(buf));
|
||||
// Send a TCP packet
|
||||
tcp_socket_.write_some(boost::asio::buffer(buf));
|
||||
|
||||
//! Read the received TCP packet
|
||||
tcp_socket_.read_some(boost::asio::buffer(readbuf));
|
||||
// Read the received TCP packet
|
||||
tcp_socket_.read_some(boost::asio::buffer(readbuf));
|
||||
|
||||
//! Recover the variables received
|
||||
tcp_data_->proc_pack_code_error = readbuf.data()[0];
|
||||
tcp_data_->proc_pack_carr_error = readbuf.data()[1];
|
||||
// Recover the variables received
|
||||
tcp_data_->proc_pack_code_error = readbuf.data()[0];
|
||||
tcp_data_->proc_pack_carr_error = readbuf.data()[1];
|
||||
|
||||
//! Control. The GNSS-SDR program ends if an error in a TCP packet is detected.
|
||||
if (d_control_id_ != readbuf.data()[2])
|
||||
{
|
||||
throw "Packet error!";
|
||||
}
|
||||
// Control. The GNSS-SDR program ends if an error in a TCP packet is detected.
|
||||
if (d_control_id_ != readbuf.data()[2])
|
||||
{
|
||||
throw "Packet error!";
|
||||
}
|
||||
}
|
||||
|
||||
catch(std::exception& e)
|
||||
{
|
||||
std::cerr << "Exception: " << e.what() << ". Please press Ctrl+C to end the program." << std::endl;
|
||||
std::cin >> controlc;
|
||||
}
|
||||
catch(std::exception& e)
|
||||
{
|
||||
std::cerr << "Exception: " << e.what() << ". Please press Ctrl+C to end the program." << std::endl;
|
||||
std::cin >> controlc;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void tcp_communication::close_tcp_connection(size_t d_port_)
|
||||
{
|
||||
//! Close the TCP connection
|
||||
tcp_socket_.close();
|
||||
std::cout << "Socket closed on port " << d_port_ << std::endl;
|
||||
|
||||
return;
|
||||
// Close the TCP connection
|
||||
tcp_socket_.close();
|
||||
std::cout << "Socket closed on port " << d_port_ << std::endl;
|
||||
return;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*!
|
||||
* \file tcp_communication.h
|
||||
* \brief Library with the definition of the TCP communication class
|
||||
* \brief Interface of the TCP communication class
|
||||
* \author David Pubill, 2011. dpubill(at)cttc.es
|
||||
*
|
||||
*
|
||||
@ -29,26 +29,28 @@
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef TCP_COMMUNICATION_H_
|
||||
#define TCP_COMMUNICATION_H_
|
||||
#ifndef GNSS_SDR_TCP_COMMUNICATION_H_
|
||||
#define GNSS_SDR_TCP_COMMUNICATION_H_
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include "tcp_packet_data.h"
|
||||
|
||||
|
||||
class tcp_communication
|
||||
{
|
||||
public:
|
||||
|
||||
tcp_communication();
|
||||
~tcp_communication();
|
||||
tcp_communication();
|
||||
~tcp_communication();
|
||||
|
||||
int listen_tcp_connection(size_t d_port_);
|
||||
void send_receive_tcp_packet(boost::array<float, 7> buf, tcp_packet_data *tcp_data_);
|
||||
void close_tcp_connection(size_t d_port_);
|
||||
int listen_tcp_connection(size_t d_port_);
|
||||
void send_receive_tcp_packet(boost::array<float,7> buf, tcp_packet_data *tcp_data_);
|
||||
void close_tcp_connection(size_t d_port_);
|
||||
|
||||
private:
|
||||
boost::asio::io_service io_service_;
|
||||
boost::asio::ip::tcp::socket tcp_socket_;
|
||||
boost::asio::io_service io_service_;
|
||||
boost::asio::ip::tcp::socket tcp_socket_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*!
|
||||
* \file tcp_packet_data.h
|
||||
* \brief Library with the definition of the TCP packet data class
|
||||
* \brief Interface of the TCP packet data class
|
||||
* \author David Pubill, 2011. dpubill(at)cttc.es
|
||||
*
|
||||
*
|
||||
@ -29,18 +29,16 @@
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef TCP_PACKET_DATA_H_
|
||||
#define TCP_PACKET_DATA_H_
|
||||
#ifndef GNSS_SDR_TCP_PACKET_DATA_H_
|
||||
#define GNSS_SDR_TCP_PACKET_DATA_H_
|
||||
|
||||
class tcp_packet_data
|
||||
{
|
||||
public:
|
||||
tcp_packet_data();
|
||||
|
||||
float proc_pack_code_error;
|
||||
float proc_pack_carr_error;
|
||||
|
||||
tcp_packet_data();
|
||||
~tcp_packet_data();
|
||||
float proc_pack_code_error;
|
||||
float proc_pack_carr_error;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -11,7 +11,7 @@
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
@ -41,7 +41,8 @@
|
||||
* \brief This class implements a 2nd order DLL filter for code tracking loop.
|
||||
*
|
||||
* The algorithm is described in:
|
||||
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S. H. Jensen, A Software-Defined GPS and Galileo Receiver. A Single-Frequency Approach,
|
||||
* K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S. H. Jensen, A Software-Defined GPS
|
||||
* and Galileo Receiver. A Single-Frequency Approach,
|
||||
* Birkhauser, 2007, Applied and Numerical Harmonic Analysis.
|
||||
*/
|
||||
class Tracking_2nd_DLL_filter
|
||||
@ -53,18 +54,16 @@ private:
|
||||
float d_pdi_code;
|
||||
float d_dllnoisebandwidth;
|
||||
float d_dlldampingratio;
|
||||
|
||||
float d_old_code_error;
|
||||
float d_old_code_nco;
|
||||
|
||||
void calculate_lopp_coef(float* tau1,float* tau2, float lbw, float zeta, float k);
|
||||
|
||||
public:
|
||||
void set_DLL_BW(float dll_bw_hz); //! Set DLL loop bandwidth [Hz]
|
||||
void initialize(float d_acq_code_phase_samples);
|
||||
float get_code_nco(float DLL_discriminator);
|
||||
Tracking_2nd_DLL_filter();
|
||||
~Tracking_2nd_DLL_filter();
|
||||
void set_DLL_BW(float dll_bw_hz); //! Set DLL filter bandwidth [Hz]
|
||||
void initialize(float d_acq_code_phase_samples); //! Start tracking with acquisition information
|
||||
float get_code_nco(float DLL_discriminator); //! Numerically controlled oscillator
|
||||
Tracking_2nd_DLL_filter();
|
||||
~Tracking_2nd_DLL_filter();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user