sudo apt-get install build-essential cmake git pkg-config libboost-dev \libboost-date-time-dev libboost-system-dev libboost-filesystem-dev \libboost-thread-dev libboost-chrono-dev libboost-serialization-dev \libboost-program-options-dev libboost-test-dev liblog4cpp5-dev \libblas-dev liblapack-dev \libarmadillo-dev libgflags-dev libgoogle-glog-dev libhdf5-dev \libgnutls-openssl-dev libmatio-dev libpugixml-dev libpcap-dev \libprotobuf-dev protobuf-compiler libgtest-dev googletest \python3-mako python3-six
git clone https://github.com/gnss-sdr/gnss-sdr
cd gnss-sdr/build
git checkout next
步骤git checkout next是可选的,并设置指向下一个分支的源树,这是最新的开发快照。如果省略此步骤,则默认情况下需要主分支,其中包含最新的稳定版本,也许是一些错误修复。
cmake ..
make
sudo make install
此外,CMake接受了大量构建过程的配置选项。例如,如果要以“调试”模式而不是默认“释放”编译源,则可以键入:
cmake -DCMAKE_BUILD_TYPE=Debug ..
替代工具
Ninja
Ninja是一个小型构建系统,专注于速度,可以被视为替代品。如果参数-gninja传递给cmake,则它会生成ninja构建系统使用的build.ninja文件(而不是makefile)来编译和链接源代码。因此,在克隆存储库之后,构建工作流程是:
cd gnss-sdr/build
git checkout next
cmake -GNinja ..
ninja
sudo ninja install
总的来说,使用Ninja时的编译时间与使用Make进行完整构建时的编译时间相当,尽管它的性能相当依赖于平台。Ninja的目标是在大型项目和增量构建中提高性能,因此它似乎是Make的一个很好的替代品,尤其是对于需要经常重新编译源代码的开发人员。在基于Debian的GNU/Linux发行版中,可以通过以下方式安装:
sudo apt-get install ninja-build
Clang
CLANG是C、C++和其他编程语言的一个编译器前端。它使用LLVM作为后端,并设计为能够替换完整的GNU编译器集合(GCC)。在macOS下,默认情况下使用此编译器。在GNU/Linux中,它可以用来构建GNSS-SDR以取代GCC。
在基于Debian/Ubuntu的发行版中,可以通过以下方式安装Clang:
sudo apt-get install clang
Xcode
Xcode是一个用于macOS的集成开发环境(IDE),包含一套由苹果开发的软件开发工具。
为了使用Xcode构建GNSS-SDR,将以下参数传递给CMake:
cmake -GXcode ..
这将创建一个gnss sdr。可以由Xcode打开的xcodeproj项目(在顶部栏菜单中,单击文件打开…打开gnss-sdr.xcodeproj项目)。
也可以从命令行生成:
xcodebuild
或
xcodebuild -config Release
RUN
第1步:验证GNSS-SDR是否已安装
gnss-sdr --version
您应该看到类似于:
gnss-sdr version 0.0.16
请检查您安装的版本是否为0.0.16(如果您是从源代码快照生成代码的,请检查类似于0.0.16.git-branchname-gitshash的版本)。旧版本无法适用于此处所示的示例。如果您通过sudo apt get install GNSS SDR安装了GNSS-SDR,并且获得了0.0.16之前的版本,请执行sudo apt get remove GNSS SDR并从源代码构建它。
为了利用处理器中存在的SIMD指令集,您需要运行volk和volk_gnsssdr库的Profiler工具(这些操作只需要完成一次,并且可能需要一段时间):
volk_profile
volk_gnsssdr_profile
第2步:下载原始信号文件
现在是时候下载包含GNSS原始信号样本的文件了。这可以直接从终端完成:
mkdir work
cd work
wget https://sourceforge.net/projects/gnss-sdr/files/data/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.tar.gz
tar -zxvf 2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.tar.gz
第3步:配置GNSS-SDR
然后,复制如下所示的GNSS-SDR配置,并将其粘贴到您最喜欢的纯文本编辑器中:
[GNSS-SDR]
;######### GLOBAL OPTIONS ##################
GNSS-SDR.internal_fs_sps=2000000
;######### SIGNAL_SOURCE CONFIG ############
SignalSource.implementation=File_Signal_Source
SignalSource.filename=/home/your-username/work/data/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat
SignalSource.item_type=ishort
SignalSource.sampling_frequency=4000000
SignalSource.samples=0
;######### SIGNAL_CONDITIONER CONFIG ############
SignalConditioner.implementation=Signal_Conditioner
DataTypeAdapter.implementation=Ishort_To_Complex
InputFilter.implementation=Pass_Through
InputFilter.item_type=gr_complex
Resampler.implementation=Direct_Resampler
Resampler.sample_freq_in=4000000
Resampler.sample_freq_out=2000000
Resampler.item_type=gr_complex
;######### CHANNELS GLOBAL CONFIG ############
Channels_1C.count=8
Channels.in_acquisition=8
Channel.signal=1C
;######### ACQUISITION GLOBAL CONFIG ############
Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition
Acquisition_1C.item_type=gr_complex
Acquisition_1C.pfa=0.01
Acquisition_1C.doppler_max=10000
Acquisition_1C.doppler_step=250
Acquisition_1C.blocking=true
;######### TRACKING GLOBAL CONFIG ############
Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking
Tracking_1C.item_type=gr_complex
Tracking_1C.pll_bw_hz=40.0;
Tracking_1C.dll_bw_hz=4.0;
;######### TELEMETRY DECODER GPS CONFIG ############
TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder
;######### OBSERVABLES CONFIG ############
Observables.implementation=Hybrid_Observables
;######### PVT CONFIG ############
PVT.implementation=RTKLIB_PVT
PVT.positioning_mode=Single
PVT.output_rate_ms=100
PVT.display_rate_ms=500
PVT.iono_model=Broadcast
PVT.trop_model=Saastamoinen
PVT.flag_rtcm_server=true
PVT.flag_rtcm_tty_port=false
PVT.rtcm_dump_devname=/dev/pts/1
PVT.rtcm_tcp_port=2101
PVT.rtcm_MT1019_rate_ms=5000
PVT.rtcm_MT1077_rate_ms=1000
PVT.rinex_version=2
注意:检查参数scalesource.filename实际上指向原始数据文件的名称和路径。
将文件保存为my-first-GNSS-SDR-receiver.conf(或您选择的任何其他名称)。
第4步:运行GNSS-SDR
好的,让我们回顾一下。我们有:
- 在我们的系统中安装了GNSS-SDR。
- 信号源:西班牙CTTC的一个名为2013_04_04_GNSS_signal_的文件。包含100秒原始GPS信号样本的dat,由射频前端采集。
- GPS L1 C/A接收器的配置文件,将在西班牙CTTC接收文件2013_04_04_GNSS_SIGNAL_AT_CTTC_SPAIN.dat作为其信号源。
因此,我们已准备好运行我们的软件定义的GPS接收器。在终端中,键入:
gnss-sdr --config_file=./my-first-GNSS-SDR-receiver.conf
注意:通过最近创建的配置文件的实际名称和路径更改./my-first-gnss-receiver.conf。
你应该看到类似的东西:
gnss-sdr --config_file=./my-first-GNSS-SDR-receiver.conf
Initializing GNSS-SDR v0.0.16 ... Please wait.
Logging will be done at "/tmp"
Use gnss-sdr --log_dir=/path/to/log to change that.
Processing file /home/your-username/work/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat, which contains 1600000000 [bytes]
GNSS signal recorded time to be processed: 99.999 [s]
Starting a TCP/IP server of RTCM messages on port 2101
The TCP/IP server of RTCM messages is up and running. Accepting connections ...
...
然后,在几秒钟后检测GPS信号并解码其导航消息的某些帧(至少,来自四颗卫星的子帧1、2和3)…
...
Current receiver time: 14 s
New GPS NAV message received in channel 3: subframe 1 from satellite GPS PRN 20 (Block IIR)
New GPS NAV message received in channel 0: subframe 1 from satellite GPS PRN 01 (Block IIF)
New GPS NAV message received in channel 4: subframe 1 from satellite GPS PRN 32 (Block IIF)
New GPS NAV message received in channel 2: subframe 1 from satellite GPS PRN 17 (Block IIR-M)
Current receiver time: 15 s
Current receiver time: 16 s
Current receiver time: 17 s
Current receiver time: 18 s
Current receiver time: 19 s
Current receiver time: 20 s
New GPS NAV message received in channel 3: subframe 2 from satellite GPS PRN 02 (Block IIR)
New GPS NAV message received in channel 0: subframe 2 from satellite GPS PRN 01 (Block IIF)
New GPS NAV message received in channel 4: subframe 2 from satellite GPS PRN 32 (Block IIF)
New GPS NAV message received in channel 1: subframe 2 from satellite GPS PRN 11 (Block IIR)
New GPS NAV message received in channel 2: subframe 2 from satellite GPS PRN 17 (Block IIR-M)
Current receiver time: 21 s
Current receiver time: 22 s
Current receiver time: 23 s
Current receiver time: 24 s
Current receiver time: 25 s
Current receiver time: 26 s
New GPS NAV message received in channel 3: subframe 3 from satellite GPS PRN 20 (Block IIR)
New GPS NAV message received in channel 0: subframe 3 from satellite GPS PRN 01 (Block IIF)
New GPS NAV message received in channel 4: subframe 3 from satellite GPS PRN 32 (Block IIF)
New GPS NAV message received in channel 2: subframe 3 from satellite GPS PRN 17 (Block IIR-M)
New GPS NAV message received in channel 1: subframe 3 from satellite GPS PRN 11 (Block IIR)
First position fix at 2013-Apr-04 06:23:31.740000 UTC is Lat = 41.2749 [deg], Long = 1.98754 [deg], Height= 100.795 [m]
Position at 2013-Apr-04 06:23:32.000000 UTC using 4 observations is Lat = 41.274888307 [deg], Long = 1.987581872 [deg], Height = 86.928 [m]
Position at 2013-Apr-04 06:23:32.500000 UTC using 4 observations is Lat = 41.274964746 [deg], Long = 1.987510141 [deg], Height = 90.557 [m]
Current receiver time: 27 s
Position at 2013-Apr-04 06:23:33.000000 UTC using 4 observations is Lat = 41.274921885 [deg], Long = 1.987605767 [deg], Height = 73.365 [m]
Position at 2013-Apr-04 06:23:33.500000 UTC using 4 observations is Lat = 41.274866502 [deg], Long = 1.987553835 [deg], Height = 83.313 [m]
Current receiver time: 28 s
Position at 2013-Apr-04 06:23:34.000000 UTC using 4 observations is Lat = 41.274904024 [deg], Long = 1.987612510 [deg], Height = 87.615 [m]
Position at 2013-Apr-04 06:23:34.500000 UTC using 4 observations is Lat = 41.274877911 [deg], Long = 1.987553312 [deg], Height = 81.405 [m]
Current receiver time: 29 s
Position at 2013-Apr-04 06:23:35.000000 UTC using 4 observations is Lat = 41.274916750 [deg], Long = 1.987576650 [deg], Height = 108.288 [m]
Position at 2013-Apr-04 06:23:35.500000 UTC using 4 observations is Lat = 41.274803167 [deg], Long = 1.987562527 [deg], Height = 90.144 [m]
Current receiver time: 30 s
Position at 2013-Apr-04 06:23:36.000000 UTC using 4 observations is Lat = 41.275044618 [deg], Long = 1.987619037 [deg], Height = 102.346 [m]
Position at 2013-Apr-04 06:23:36.500000 UTC using 4 observations is Lat = 41.274878468 [deg], Long = 1.987557377 [deg], Height = 102.764 [m]
Current receiver time: 31 s
Position at 2013-Apr-04 06:23:37.000000 UTC using 4 observations is Lat = 41.274995336 [deg], Long = 1.987554843 [deg], Height = 113.653 [m]
Position at 2013-Apr-04 06:23:37.500000 UTC using 4 observations is Lat = 41.274951615 [deg], Long = 1.987600581 [deg], Height = 92.064 [m]
Current receiver time: 32 s
...
如果你看到类似的东西…耶!您正在使用开源软件定义的GPS接收器获得位置修复!
...
Current receiver time: 1 min 40 s
Position at 2013-Apr-04 06:24:45.500000 UTC using 5 observations is Lat = 41.274821613 [deg], Long = 1.987629659 [deg], Height = 69.292 [m]
Position at 2013-Apr-04 06:24:46.000000 UTC using 5 observations is Lat = 41.274817101 [deg], Long = 1.987576895 [deg], Height = 43.517 [m]
Position at 2013-Apr-04 06:24:46.500000 UTC using 5 observations is Lat = 41.274830209 [deg], Long = 1.987583859 [deg], Height = 54.475 [m]
Stopping GNSS-SDR, please wait!
Total GNSS-SDR run time: 37.106698 [seconds]
GNSS-SDR program ended.
Stopping TCP/IP server on port 2101
$
现在,您可以检查从中调用GNSS-SDR的文件夹中的处理输出:
- A .kml file.
- A .geojson file.
- A .gpx file.
- A .nmea file.
- 观察和导航RINEX文件