Commit 5aae0a1b authored by Manolis Surligas's avatar Manolis Surligas 🚀

Add block for parsing the FOX slow speed telemetry frames

parent 7e09a383
......@@ -3015,6 +3015,45 @@ max_modulation_freq = 3000</value>
<value>0</value>
</param>
</block>
<block>
<key>satnogs_fox_telem_mm</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(535, 759)</value>
</param>
<param>
<key>_rotation</key>
<value>180</value>
</param>
<param>
<key>id</key>
<value>satnogs_fox_telem_mm_0</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
</block>
<block>
<key>satnogs_frame_file_sink</key>
<param>
......@@ -3035,7 +3074,7 @@ max_modulation_freq = 3000</value>
</param>
<param>
<key>_coordinate</key>
<value>(622, 761)</value>
<value>(279, 779)</value>
</param>
<param>
<key>_rotation</key>
......@@ -3428,9 +3467,9 @@ max_modulation_freq = 3000</value>
</connection>
<connection>
<source_block_id>satnogs_ccsds_rs_decoder_mm_0</source_block_id>
<sink_block_id>satnogs_frame_file_sink_0_1_0</sink_block_id>
<sink_block_id>satnogs_fox_telem_mm_0</sink_block_id>
<source_key>pdu</source_key>
<sink_key>frame</sink_key>
<sink_key>in</sink_key>
</connection>
<connection>
<source_block_id>satnogs_coarse_doppler_correction_cc_0</source_block_id>
......@@ -3444,6 +3483,12 @@ max_modulation_freq = 3000</value>
<source_key>pdu</source_key>
<sink_key>in</sink_key>
</connection>
<connection>
<source_block_id>satnogs_fox_telem_mm_0</source_block_id>
<sink_block_id>satnogs_frame_file_sink_0_1_0</sink_block_id>
<source_key>raw</source_key>
<sink_key>frame</sink_key>
</connection>
<connection>
<source_block_id>satnogs_quad_demod_filter_ff_0</source_block_id>
<sink_block_id>digital_binary_slicer_fb_0_0</sink_block_id>
......
......@@ -5,7 +5,7 @@
# Title: AMSAT FOX DUV Decoder
# Author: Thanos Giolias (agiolias@csd.uoc.gr), Nikos Karamolegos (karamolegkos.n@gmail.com), Manolis Surligas (surligas@gmail.com)
# Description: A DUV Decoder for the AMSAT FOX satellites
# Generated: Wed Jan 31 22:50:39 2018
# Generated: Fri Feb 2 11:24:35 2018
##################################################
from gnuradio import analog
......@@ -69,6 +69,7 @@ class satnogs_amsat_fox_duv_decoder(gr.top_block):
self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(file_path, audio_samp_rate, 1.0)
self.satnogs_iq_sink_0 = satnogs.iq_sink(32767, iq_file_path, False, enable_iq_dump)
self.satnogs_frame_file_sink_0_1_0 = satnogs.frame_file_sink(decoded_data_file_path, 1)
self.satnogs_fox_telem_mm_0 = satnogs.fox_telem_mm()
self.satnogs_decoder_8b10b_0 = satnogs.decoder_8b10b('0011111010', 960)
self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(rx_freq, samp_rate_rx)
......@@ -107,8 +108,9 @@ class satnogs_amsat_fox_duv_decoder(gr.top_block):
##################################################
# Connections
##################################################
self.msg_connect((self.satnogs_ccsds_rs_decoder_mm_0, 'pdu'), (self.satnogs_frame_file_sink_0_1_0, 'frame'))
self.msg_connect((self.satnogs_ccsds_rs_decoder_mm_0, 'pdu'), (self.satnogs_fox_telem_mm_0, 'in'))
self.msg_connect((self.satnogs_decoder_8b10b_0, 'pdu'), (self.satnogs_ccsds_rs_decoder_mm_0, 'in'))
self.msg_connect((self.satnogs_fox_telem_mm_0, 'raw'), (self.satnogs_frame_file_sink_0_1_0, 'frame'))
self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'), (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
self.connect((self.analog_quadrature_demod_cf_0, 0), (self.low_pass_filter_1, 0))
self.connect((self.analog_quadrature_demod_cf_0, 0), (self.satnogs_ogg_encoder_0, 0))
......
......@@ -54,5 +54,6 @@ install(FILES
${enabled_blocks}
satnogs_quad_demod_filter_ff.xml
satnogs_decoder_8b10b.xml
satnogs_ccsds_rs_decoder_mm.xml DESTINATION share/gnuradio/grc/blocks
satnogs_ccsds_rs_decoder_mm.xml
satnogs_fox_telem_mm.xml DESTINATION share/gnuradio/grc/blocks
)
......@@ -13,6 +13,10 @@
<block>satnogs_upsat_transmitter</block>
<block>satnogs_qb50_deframer</block>
</cat>
<cat>
<name>AMSAT FOX</name>
<block>satnogs_fox_telem_mm</block>
</cat>
</cat>
<block>satnogs_cw_matched_filter_ff</block>
<block>satnogs_morse_decoder</block>
......
<?xml version="1.0"?>
<block>
<name>FOX telemetry processor</name>
<key>satnogs_fox_telem_mm</key>
<import>import satnogs</import>
<make>satnogs.fox_telem_mm()</make>
<sink>
<name>in</name>
<type>message</type>
</sink>
<source>
<name>raw</name>
<type>message</type>
</source>
</block>
......@@ -69,5 +69,6 @@ install(FILES
${HEADER_FILES}
quad_demod_filter_ff.h
decoder_8b10b.h
ccsds_rs_decoder_mm.h DESTINATION include/satnogs
ccsds_rs_decoder_mm.h
fox_telem_mm.h DESTINATION include/satnogs
)
\ No newline at end of file
/* -*- c++ -*- */
/*
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
*
* Copyright (C) 2018, 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_FOX_TELEM_MM_H
#define INCLUDED_SATNOGS_FOX_TELEM_MM_H
#include <satnogs/api.h>
#include <gnuradio/block.h>
namespace gr
{
namespace satnogs
{
/*!
* \brief This block takes a AMSAT FOX telemetry frame from the CCSDS
* RS decoder, discards the pad bytes, checks if the frame is originating
* from a valid spacecraft and outputs the data to another message port.
* \ingroup satnogs
*
*/
class SATNOGS_API fox_telem_mm : virtual public gr::block
{
public:
typedef boost::shared_ptr<fox_telem_mm> sptr;
/*!
* \brief This block takes a AMSAT FOX telemetry frame from the CCSDS
* RS decoder, discards the pad bytes, checks if the frame is originating
* from a valid spacecraft and outputs the data to another message port.
*/
static sptr
make ();
};
} // namespace satnogs
} // namespace gr
#endif /* INCLUDED_SATNOGS_FOX_TELEM_MM_H */
......@@ -68,7 +68,8 @@ list(APPEND satnogs_sources
iq_sink_impl.cc
quad_demod_filter_ff_impl.cc
decoder_8b10b_impl.cc
ccsds_rs_decoder_mm_impl.cc)
ccsds_rs_decoder_mm_impl.cc
fox_telem_mm_impl.cc)
if(${INCLUDE_DEBUG_BLOCKS})
list(APPEND satnogs_sources ${satnogs_debug_sources})
......
/* -*- c++ -*- */
/*
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
*
* Copyright (C) 2018, 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 "fox_telem_mm_impl.h"
#include <satnogs/log.h>
namespace gr {
namespace satnogs {
/**
* AMSAT FOX spacecraft IDs
*/
const uint8_t fox_telem_mm_impl::fox_id[] = {0x1, 0x2, 0x3};
fox_telem_mm::sptr
fox_telem_mm::make()
{
return gnuradio::get_initial_sptr
(new fox_telem_mm_impl());
}
/*
* The private constructor
*/
fox_telem_mm_impl::fox_telem_mm_impl()
: gr::block("fox_telem_mm",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(0, 0, 0)),
/* 6 header, 58 payload */
d_frame_size (6 + 58)
{
message_port_register_in (pmt::mp ("in"));
message_port_register_out (pmt::mp ("raw"));
set_msg_handler (
pmt::mp ("in"),
boost::bind (&fox_telem_mm_impl::process_frame, this, _1));
}
static inline bool
is_spacecraft_valid(uint8_t id)
{
for (size_t i = 0; i < sizeof(fox_telem_mm_impl::fox_id); i++) {
if (fox_telem_mm_impl::fox_id[i] == id) {
return true;
}
}
return false;
}
void
fox_telem_mm_impl::process_frame (pmt::pmt_t msg)
{
uint8_t fox_id;
const uint8_t *data = (const uint8_t *) pmt::blob_data(msg);
size_t data_len = pmt::blob_length(msg);
if(data_len != 223) {
LOG_ERROR("Invalid message");
}
/* Check the spacecraft ID */
fox_id = data[0] & 0x3;
if(!is_spacecraft_valid(fox_id)) {
return;
}
message_port_pub(pmt::mp("raw"), pmt::make_blob(data, d_frame_size));
}
/*
* Our virtual destructor.
*/
fox_telem_mm_impl::~fox_telem_mm_impl()
{
}
} /* namespace satnogs */
} /* namespace gr */
/* -*- c++ -*- */
/*
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
*
* Copyright (C) 2018, 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_FOX_TELEM_MM_IMPL_H
#define INCLUDED_SATNOGS_FOX_TELEM_MM_IMPL_H
#include <satnogs/fox_telem_mm.h>
namespace gr
{
namespace satnogs
{
class fox_telem_mm_impl : public fox_telem_mm
{
private:
const size_t d_frame_size;
void
process_frame (pmt::pmt_t msg);
public:
static const uint8_t fox_id[];
fox_telem_mm_impl ();
~fox_telem_mm_impl ();
};
} // namespace satnogs
} // namespace gr
#endif /* INCLUDED_SATNOGS_FOX_TELEM_MM_IMPL_H */
......@@ -34,6 +34,7 @@
#include "satnogs/quad_demod_filter_ff.h"
#include "satnogs/decoder_8b10b.h"
#include "satnogs/ccsds_rs_decoder_mm.h"
#include "satnogs/fox_telem_mm.h"
%}
......@@ -109,3 +110,6 @@ GR_SWIG_BLOCK_MAGIC2(satnogs, decoder_8b10b);
%include "satnogs/ccsds_rs_decoder_mm.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, ccsds_rs_decoder_mm);
%include "satnogs/fox_telem_mm.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, fox_telem_mm);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment