gnuradio companion(grc)でbpsk flowgraphを作成しましたが正常に動作しています。現時点では、gnuradioクラスを使用して同じプログラムと同等のC++を作成しています。まずファイルからI/Qデータを読み、すべてのbpsk変調AX.25フレームを取得できました。今、私はリアルタイムでI/Qデータを読み取ることができるように、ファイルソースブロックをUHDファイルブロックに置き換えようとしています。 makeはエラーを報告する "uhd 'への参照はあいまいです"。フルメイク出力は、ここでGNUラジオメイクエラー: "uhd 'への参照があいまいです。"
$ make
[ 50%] Building CXX object CMakeFiles/bpsk.dir/bpsk.cc.o
/home/mbkitine/Dropbox/Lulea/GRC/SSC/PSK/bpsk/RX_C++/bpsk.cc: In function ‘int main(int, char**)’:
/home/mbkitine/Dropbox/Lulea/GRC/SSC/PSK/bpsk/RX_C++/bpsk.cc:85:78: error: reference to ‘uhd’ is ambiguous
gr::uhd::usrp_source::sptr uhd_source = gr::uhd::usrp_source::make(address,uhd::stream_args_t("fc32"));
^
In file included from /usr/local/include/uhd/types/metadata.hpp:22:0,
from /usr/local/include/uhd/stream.hpp:22,
from /usr/local/include/uhd/device.hpp:22,
from /usr/local/include/uhd/usrp/multi_usrp.hpp:37,
from /usr/local/include/gnuradio/uhd/usrp_block.h:28,
from /usr/local/include/gnuradio/uhd/usrp_source.h:26,
from /home/mbkitine/Dropbox/Lulea/GRC/SSC/PSK/bpsk/RX_C++/bpsk.cc:56:
/usr/local/include/uhd/types/time_spec.hpp:25:14: note: candidates are: namespace uhd { }
namespace uhd{
^
In file included from /usr/local/include/gnuradio/uhd/usrp_source.h:26:0,
from /home/mbkitine/Dropbox/Lulea/GRC/SSC/PSK/bpsk/RX_C++/bpsk.cc:56:
/usr/local/include/gnuradio/uhd/usrp_block.h:31:17: note: namespace gr::uhd { }
namespace uhd {
^
CMakeFiles/bpsk.dir/build.make:62: recipe for target 'CMakeFiles/bpsk.dir/bpsk.cc.o' failed
make[2]: *** [CMakeFiles/bpsk.dir/bpsk.cc.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/bpsk.dir/all' failed
make[1]: *** [CMakeFiles/bpsk.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
の下に示されている私のbpsk.ccコード
// Include header files for each block used in flowgraph
#include <gnuradio/top_block.h>
#include <gnuradio/analog/sig_source_f.h>
#include <gnuradio/analog/agc2_cc.h>
#include <gnuradio/digital/fll_band_edge_cc.h>
#include <gnuradio/digital/pfb_clock_sync_ccf.h>
#include <gnuradio/filter/firdes.h>
#include <gnuradio/digital/cma_equalizer_cc.h>
#include <gnuradio/digital/costas_loop_cc.h>
#include <gnuradio/blocks/api.h>
#include <gnuradio/sync_block.h>
#include <gnuradio/digital/binary_slicer_fb.h>
#include <gnuradio/digital/diff_decoder_bb.h>
#include <gnuradio/digital/hdlc_deframer_bp.h>
#include <gnuradio/blocks/message_debug.h>
#include <gnuradio/audio/sink.h>
#include <gnuradio/blocks/file_source.h>
#include <gnuradio/uhd/usrp_source.h>
#include <ais/invert.h>
#include <gnuradio/blocks/complex_to_real.h>
#include <iostream>
#include <string>
using namespace gr;
int main(int argc, char **argv)
{
//Extracting variables from the menu
char* filename = argv[1];
//UHD Default parameters
double samp_rate = 1000000;
double baud_rate = 250000;
double fc = 100e6;
int sps = int(samp_rate/baud_rate);
//Receiver parameters
int dec = 10;
float loop_bw = 2 * 3.14/100;
// Construct a top block that will contain flowgraph blocks. Alternatively,
// one may create a derived class from top_block and hold instantiated blocks
// as member data for later manipulation.
top_block_sptr tb = make_top_block("bpsk");
//UHD block
std::string address = "192.168.10.2";
gr::uhd::usrp_source::sptr uhd_source = gr::uhd::usrp_source::make(address,uhd::stream_args_t("fc32"));
uhd_source->set_samp_rate(samp_rate);
uhd_source->set_center_freq(fc);
//Reading bpsk signal from file
//blocks::file_source::sptr file = blocks::file_source::make(sizeof(gr_complex),filename,false);
//Automatic gain controller
analog::agc2_cc::sptr agc = analog::agc2_cc::make(1e-1, 1e-2, 1.0, 1.0);
//FLL band edge filter
digital::fll_band_edge_cc::sptr fll = digital::fll_band_edge_cc::make(sps, 0.5, 44, loop_bw);
//PFB symbol time recovery
const int nfilts = 32;
std::vector<float> rrc_taps = filter::firdes::root_raised_cosine(nfilts, nfilts, 1.0/float(sps), 0.35, 11*sps*nfilts);
digital::pfb_clock_sync_ccf::sptr pfb = digital::pfb_clock_sync_ccf::make(sps,loop_bw,rrc_taps,nfilts,0,1.5,2);
//CMA equalization
digital::cma_equalizer_cc::sptr cma = digital::cma_equalizer_cc::make(15,1,0.01,2);
//Costas loop
digital::costas_loop_cc::sptr costas = digital::costas_loop_cc::make(loop_bw,2);
//Taking the real part
gr::blocks::complex_to_real::sptr comp_to_real = blocks::complex_to_real::make(1);
//Binary slicer
digital::binary_slicer_fb::sptr slicer = digital::binary_slicer_fb::make();
//Differential decoder
digital::diff_decoder_bb::sptr differential_decoder = digital::diff_decoder_bb::make(2);
//Inverting bit values
//invert::sptr inverter = ais::invert::make();
//HDLC Deframer
digital::hdlc_deframer_bp::sptr deframer = digital::hdlc_deframer_bp::make(32,500);
//Output data
gr::blocks::message_debug::sptr msg = gr::blocks::message_debug::make();
std::cout << "Blocks declared successfully " << std::endl;
//Connections
tb->connect(uhd_source,0,agc,0);
tb->connect(agc,0,fll,0);
tb->connect(fll,0,pfb,0);
tb->connect(pfb,0,cma,0);
tb->connect(cma,0,costas,0);
tb->connect(costas,0,comp_to_real,0);
tb->connect(comp_to_real,0,slicer,0);
tb->connect(slicer,0,differential_decoder,0);
tb->connect(differential_decoder,0,deframer,0);
//tb->connect(inverter,0,deframer,0);
tb->msg_connect(deframer,"out",msg,"print_pdu");
tb->run();
std::cout << "The GNU Radio Thread is Running " << std::endl;
// Exit normally.
return 0;
}
そして最後に、私のCMakelists.txtファイルです。私は基本的に、元のダイヤルトーンCからこのファイル++ {YOUR_GNURADIO_DIRECTORY}に見出すことができる変形例/ GR-オーディオ/例/ C任意の助けが高く評価される++
cmake_minimum_required(VERSION 2.6)
project(bpsk CXX)
find_package(Boost "1.35" COMPONENTS system)
set(GR_REQUIRED_COMPONENTS RUNTIME ANALOG AUDIO BLOCKS FILTER DIGITAL UHD)
find_package(Gnuradio "3.7.2" REQUIRED)
include_directories(${GNURADIO_ALL_INCLUDE_DIRS})
add_executable(bpsk bpsk.cc)
target_link_libraries(bpsk ${Boost_LIBRARIES} ${GNURADIO_ALL_LIBRARIES})
。
ありがとうございます。
モーゼスです。