CI: gps test hackrf support (#26364)

* first ignore

* init gps test

* make LimeGPS git clone

* revert ignore

* .

* remove prebuilt bins

* gps test v1

* add static signal gen script

* update readme

* remove LD_PRELOAD by using rpath, update values after testing

* .

* remove LD_PRELOAD

* .

* fix README

* .

* .

* .

* gps test v1

* cleanUp

* init

* update fuzzy tests

* .

* finalize qcom gps tests

* .

* .

* .

* add downloader

* finalize unit tests

* .

* .

* inc limeGPS startup time

* tmp

* loosen init time

* .

* .

* .

* add ublox warmstart test

* .

* improve location tests

* .

* .

* .

* .

* .

* .

* .

* .

* last cleanUp

* .

* .

* add hackrf support

* hackrf support

* .

* .

* .

* .

* .

* .

Co-authored-by: Kurt Nistelberger <kurt.nistelberger@gmail.com>
pull/26616/head
Kurt Nistelberger 2 years ago committed by GitHub
parent 12ecc7b4bc
commit a48ec655ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      tools/gpstest/.gitignore
  2. 44
      tools/gpstest/patches/hackrf.patch
  3. 21
      tools/gpstest/setup_hackrf.sh
  4. 110
      tools/gpstest/simulate_gps_signal.py

@ -1,2 +1,4 @@
LimeGPS/
LimeSuite/
LimeSuite/
hackrf/
gps-sdr-sim/

@ -0,0 +1,44 @@
diff --git a/host/hackrf-tools/src/CMakeLists.txt b/host/hackrf-tools/src/CMakeLists.txt
index 7115151c..a51388ba 100644
--- a/host/hackrf-tools/src/CMakeLists.txt
+++ b/host/hackrf-tools/src/CMakeLists.txt
@@ -23,20 +23,20 @@
set(INSTALL_DEFAULT_BINDIR "bin" CACHE STRING "Appended to CMAKE_INSTALL_PREFIX")
-find_package(FFTW REQUIRED)
-include_directories(${FFTW_INCLUDES})
-get_filename_component(FFTW_LIBRARY_DIRS ${FFTW_LIBRARIES} DIRECTORY)
-link_directories(${FFTW_LIBRARY_DIRS})
+#find_package(FFTW REQUIRED)
+#include_directories(${FFTW_INCLUDES})
+#get_filename_component(FFTW_LIBRARY_DIRS ${FFTW_LIBRARIES} DIRECTORY)
+#link_directories(${FFTW_LIBRARY_DIRS})
SET(TOOLS
hackrf_transfer
- hackrf_spiflash
- hackrf_cpldjtag
+ #hackrf_spiflash
+ #hackrf_cpldjtag
hackrf_info
- hackrf_debug
- hackrf_clock
- hackrf_sweep
- hackrf_operacake
+ #hackrf_debug
+ #hackrf_clock
+ #hackrf_sweep
+ #hackrf_operacake
)
if(MSVC)
@@ -45,7 +45,7 @@ if(MSVC)
)
LIST(APPEND TOOLS_LINK_LIBS ${FFTW_LIBRARIES})
else()
- LIST(APPEND TOOLS_LINK_LIBS m fftw3f)
+ LIST(APPEND TOOLS_LINK_LIBS m)# fftw3f)
endif()
if(NOT libhackrf_SOURCE_DIR)

@ -0,0 +1,21 @@
#!/bin/bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
cd $DIR
if [ ! -d gps-sdr-sim ]; then
git clone https://github.com/osqzss/gps-sdr-sim.git
cd gps-sdr-sim
make
cd ..
fi
if [ ! -d hackrf ]; then
git clone https://github.com/greatscottgadgets/hackrf.git
cd hackrf/host
git apply ../../patches/hackrf.patch
cmake .
make
fi

@ -36,38 +36,7 @@ def get_random_coords(lat, lon) -> Tuple[int, int]:
# jump around the world
return get_coords(lat, lon, 20, 20, 10, 20)
def check_availability() -> bool:
cmd = ["LimeSuite/builddir/LimeUtil/LimeUtil", "--find"]
output = sp.check_output(cmd)
if output.strip() == b"":
return False
print(f"Device: {output.strip().decode('utf-8')}")
return True
def main(lat, lon, jump_sim, contin_sim):
if not os.path.exists('LimeGPS'):
print("LimeGPS not found run 'setup.sh' first")
return
if not os.path.exists('LimeSuite'):
print("LimeSuite not found run 'setup.sh' first")
return
if not check_availability():
print("No limeSDR device found!")
return
rinex_file = download_rinex()
if lat == 0 and lon == 0:
lat, lon = get_random_coords(47.2020, 15.7403)
timeout = None
if jump_sim:
timeout = 30
def run_limeSDR_loop(lat, lon, contin_sim, rinex_file, timeout):
while True:
try:
print(f"starting LimeGPS, Location: {lat},{lon}")
@ -86,17 +55,92 @@ def main(lat, lon, jump_sim, contin_sim):
print(f"LimeGPS crashed: {str(e)}")
print(f"stderr:\n{e.stderr.decode('utf-8')}")# pylint:disable=no-member
return
if contin_sim:
lat, lon = get_continuous_coords(lat, lon)
else:
lat, lon = get_random_coords(lat, lon)
def run_hackRF_loop(lat, lon, rinex_file, timeout):
if timeout is not None:
print("no jump mode for hackrf!")
return
try:
print(f"starting gps-sdr-sim, Location: {lat},{lon}")
# create 30second file and replay with hackrf endless
cmd = ["gps-sdr-sim/gps-sdr-sim", "-e", rinex_file, "-l", f"{lat},{lon},100", "-d", "30"]
sp.check_output(cmd, stderr=sp.PIPE, timeout=timeout)
# created in current working directory
except Exception:
print("Failed to generate gpssim.bin")
try:
print("starting hackrf_transfer")
# create 30second file and replay with hackrf endless
cmd = ["hackrf/host/hackrf-tools/src/hackrf_transfer", "-t", "gpssim.bin",
"-f", "1575420000", "-s", "2600000", "-a", "1", "-R"]
sp.check_output(cmd, stderr=sp.PIPE, timeout=timeout)
except KeyboardInterrupt:
print("stopping hackrf_transfer")
return
except Exception as e:
print(f"hackrf_transfer crashed:{str(e)}")
def main(lat, lon, jump_sim, contin_sim, hackrf_mode):
if hackrf_mode:
if not os.path.exists('hackrf'):
print("hackrf not found run 'setup_hackrf.sh' first")
return
if not os.path.exists('gps-sdr-sim'):
print("gps-sdr-sim not found run 'setup_hackrf.sh' first")
return
output = sp.check_output(["hackrf/host/hackrf-tools/src/hackrf_info"])
if output.strip() == b"" or b"No HackRF boards found." in output:
print("No HackRF boards found!")
return
else:
if not os.path.exists('LimeGPS'):
print("LimeGPS not found run 'setup.sh' first")
return
if not os.path.exists('LimeSuite'):
print("LimeSuite not found run 'setup.sh' first")
return
output = sp.check_output(["LimeSuite/builddir/LimeUtil/LimeUtil", "--find"])
if output.strip() == b"":
print("No LimeSDR device found!")
return
print(f"Device: {output.strip().decode('utf-8')}")
if lat == 0 and lon == 0:
lat, lon = get_random_coords(47.2020, 15.7403)
rinex_file = download_rinex()
timeout = None
if jump_sim:
timeout = 30
if not hackrf_mode:
run_limeSDR_loop(lat, lon, contin_sim, rinex_file, timeout)
else:
run_hackRF_loop(lat, lon, rinex_file, timeout)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Simulate static [or random jumping] GPS signal.")
parser.add_argument("lat", type=float, nargs='?', default=0)
parser.add_argument("lon", type=float, nargs='?', default=0)
parser.add_argument("--jump", action="store_true", help="signal that jumps around the world")
parser.add_argument("--contin", action="store_true", help="continuously/slowly moving around the world")
parser.add_argument("--hackrf", action="store_true", help="hackrf mode (DEFAULT: LimeSDR)")
args = parser.parse_args()
main(args.lat, args.lon, args.jump, args.contin)
main(args.lat, args.lon, args.jump, args.contin, args.hackrf)

Loading…
Cancel
Save