Started the AFSK decoder.

The clock recovery mechanism of GNU Radio is considered
an overkill for the needs of AFSK. So the afsk_decoder
will focus on a frequency domain approach.
This commit is contained in:
Manolis Surligas 2016-02-09 18:59:40 +02:00
parent d07fd19285
commit 27c597a874
8 changed files with 269 additions and 3 deletions

View File

@ -21,5 +21,6 @@ install(FILES
satnogs_morse_decoder.xml
satnogs_morse_debug_source.xml
satnogs_clear_text_msg_sink.xml
satnogs_cw_to_symbol.xml DESTINATION share/gnuradio/grc/blocks
satnogs_cw_to_symbol.xml
satnogs_afsk_decoder.xml DESTINATION share/gnuradio/grc/blocks
)

View File

@ -0,0 +1,38 @@
<?xml version="1.0"?>
<block>
<name>afsk_decoder</name>
<key>satnogs_afsk_decoder</key>
<category>satnogs</category>
<import>import satnogs</import>
<make>satnogs.afsk_decoder($sampling_rate, $baudrate, $fft_size)</make>
<!-- Make one 'param' node for every Parameter you want settable from the GUI.
Sub-nodes:
* name
* key (makes the value accessible as $keyname, e.g. in the make node)
* type -->
<param>
<name>...</name>
<key>...</key>
<type>...</type>
</param>
<!-- Make one 'sink' node per input. Sub-nodes:
* name (an identifier for the GUI)
* type
* vlen
* optional (set to 1 for optional inputs) -->
<sink>
<name>in</name>
<type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
</sink>
<!-- Make one 'source' node per output. Sub-nodes:
* name (an identifier for the GUI)
* type
* vlen
* optional (set to 1 for optional inputs) -->
<source>
<name>out</name>
<type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
</source>
</block>

View File

@ -30,5 +30,6 @@ install(FILES
morse_decoder.h
morse_debug_source.h
clear_text_msg_sink.h
cw_to_symbol.h DESTINATION include/satnogs
cw_to_symbol.h
afsk_decoder.h DESTINATION include/satnogs
)

View File

@ -0,0 +1,63 @@
/* -*- c++ -*- */
/*
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
*
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INCLUDED_SATNOGS_AFSK_DECODER_H
#define INCLUDED_SATNOGS_AFSK_DECODER_H
#include <satnogs/api.h>
#include <gnuradio/block.h>
namespace gr {
namespace satnogs {
/*!
* \brief AFSK decoder. This particular decoder uses a Frequency Domain
* approach to retrieve the message.
* \ingroup satnogs
*
*/
class SATNOGS_API afsk_decoder : virtual public gr::block
{
public:
typedef boost::shared_ptr<afsk_decoder> sptr;
/*!
* An AFSK decoder.
* @param sampling_rate the input sampling rate
* @param baudrate the baudrate (symbols per second)
* @param fft_size the FFT size that the decoder will use.
* @param auto_carrier_tracking if set to yes, the decoder will try
* to automatically find the mark and space frequencies
* @param mark_freq the frequency of the mark (1)
* @param mark_space the frequency of the space (0)
*/
static sptr make(double sampling_rate, size_t baudrate = 1200,
size_t fft_size = 128,
bool auto_carrier_tracking = false,
double mark_freq = 2400.0,
double space_freq = 1200.0);
};
} // namespace satnogs
} // namespace gr
#endif /* INCLUDED_SATNOGS_AFSK_DECODER_H */

View File

@ -30,7 +30,8 @@ list(APPEND satnogs_sources
morse_decoder_impl.cc
morse_debug_source_impl.cc
clear_text_msg_sink_impl.cc
cw_to_symbol_impl.cc )
cw_to_symbol_impl.cc
afsk_decoder_impl.cc )
set(satnogs_sources "${satnogs_sources}" PARENT_SCOPE)
if(NOT satnogs_sources)

97
lib/afsk_decoder_impl.cc Normal file
View File

@ -0,0 +1,97 @@
/* -*- c++ -*- */
/*
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
*
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gnuradio/io_signature.h>
#include "afsk_decoder_impl.h"
namespace gr
{
namespace satnogs
{
afsk_decoder::sptr
afsk_decoder::make (double sampling_rate, size_t samples_per_sym,
size_t fft_size,
bool auto_carrier_tracking,
double mark_freq,
double space_freq)
{
return gnuradio::get_initial_sptr (
new afsk_decoder_impl (sampling_rate, samples_per_sym, fft_size,
auto_carrier_tracking,
mark_freq, space_freq));
}
/*
* The private constructor
*/
afsk_decoder_impl::afsk_decoder_impl (double sampling_rate, size_t samples_per_sym,
size_t fft_size,
bool auto_carrier_tracking,
double mark_freq, double space_freq) :
gr::block ("afsk_decoder",
gr::io_signature::make (1, 1, fft_size * sizeof(float)),
gr::io_signature::make (1, 1, sizeof(char))),
d_samp_rate(sampling_rate),
d_samples_per_sym(samples_per_sym),
d_fft_size(fft_size),
d_carriers_found(!auto_carrier_tracking),
d_mark_freq(mark_freq),
d_space_freq(space_freq)
{
if(auto_carrier_tracking){
d_mark_freq = d_space_freq = 0.0;
}
}
/*
* Our virtual destructor.
*/
afsk_decoder_impl::~afsk_decoder_impl ()
{
}
void
afsk_decoder_impl::forecast (int noutput_items,
gr_vector_int &ninput_items_required)
{
ninput_items_required[0] = noutput_items;
}
int
afsk_decoder_impl::general_work (int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const float *in = (const float *) input_items[0];
consume_each (noutput_items);
// Tell runtime system how many output items we produced.
return noutput_items;
}
} /* namespace satnogs */
} /* namespace gr */

62
lib/afsk_decoder_impl.h Normal file
View File

@ -0,0 +1,62 @@
/* -*- c++ -*- */
/*
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
*
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INCLUDED_SATNOGS_AFSK_DECODER_IMPL_H
#define INCLUDED_SATNOGS_AFSK_DECODER_IMPL_H
#include <satnogs/afsk_decoder.h>
namespace gr
{
namespace satnogs
{
class afsk_decoder_impl : public afsk_decoder
{
private:
const double d_samp_rate;
const size_t d_samples_per_sym;
const size_t d_fft_size;
bool d_carriers_found;
double d_mark_freq;
double d_space_freq;
public:
afsk_decoder_impl (double sampling_rate, size_t baudrate, size_t fft_size,
bool auto_carrier_tracking, double mark_freq,
double space_freq);
~afsk_decoder_impl ();
// Where all the action really happens
void
forecast (int noutput_items, gr_vector_int &ninput_items_required);
int
general_work (int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
} // namespace satnogs
} // namespace gr
#endif /* INCLUDED_SATNOGS_AFSK_DECODER_IMPL_H */

View File

@ -14,6 +14,7 @@
#include "satnogs/morse_debug_source.h"
#include "satnogs/clear_text_msg_sink.h"
#include "satnogs/cw_to_symbol.h"
#include "satnogs/afsk_decoder.h"
%}
%include "satnogs/cw_matched_filter_ff.h"
@ -27,3 +28,5 @@ GR_SWIG_BLOCK_MAGIC2(satnogs, morse_debug_source);
GR_SWIG_BLOCK_MAGIC2(satnogs, clear_text_msg_sink);
%include "satnogs/cw_to_symbol.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, cw_to_symbol);
%include "satnogs/afsk_decoder.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, afsk_decoder);