Commit Graph
5403 Commits
Author SHA1 Message Date
Carles Fernandez 3fd4e16a3a Merge branch 'fix_cuda_incremental_build' of https://github.com/vladisslav2011/gnss-sdr into vladisslav2011-fix_cuda_incremental_build 2026-09-24 10:02:45 +02:00
Carles Fernandez d067661806 Restore console precision when processing BeiDou B2a signals 2026-09-24 09:59:48 +02:00
Vladislav P 3ce589b0d3 Fix imcremental builds with CUDA
Signed-off-by: Vladislav P <vladisslav2011@gmail.com>
2026-09-23 20:24:11 +03:00
Carles Fernandez fd274fb891 Make acquisition dump readers skip noise-reference columns
With set_doppler_num_bins(), acq_grid holds the Doppler candidate columns
followed by 0, 1 or 2 noise-reference columns placed at doppler_center
+/- the configured doppler_max, outside the linear Doppler axis. Nothing
in the dump said how many columns were candidates, so the readers either
rejected the file (Acquisition_Dump_Reader) or plotted the reference
columns on a wrong Doppler axis (plot_acq_grid.py, plot_acq_grid.m).

Write a new doppler_num_candidates variable to the dump and use it in
the readers to keep only the candidate columns. Dumps without it are
read as before, except that the reference column of older narrowed
dumps is also skipped. The Python and MATLAB scripts plot a
single-candidate (narrowed) grid as a code-delay line instead of an
empty surface.

Add a regression test that reads back a full-grid dump with two
reference columns and a narrowed N = 5 dump.
2026-09-23 12:46:37 +02:00
Carles Fernandez 5dd293ed0e Fix heap overflow in set_doppler_num_bins() for N = full grid - 1
A narrowed search of N < d_num_doppler_bins candidates adds up to two
noise-reference rows, so N = d_num_doppler_bins - 1 needs
d_num_doppler_bins + 1 rows. The step-1 grid buffers were sized to the
full grid's own row count, which has no reference rows when the
peak-ratio statistic is used or the CFAR wraparound distance suffices,
so that request wrote one row past the end of d_grid_doppler_wipeoffs
and d_magnitude_grid.

Size the step-1 buffers (and the CUDA engine) for d_num_doppler_bins + 2
rows, which covers every row count set_doppler_num_bins() can produce,
and add a regression test.
2026-09-23 12:11:27 +02:00
Carles Fernandez 1f4ad73f6f Merge PR #1097 (pcps-doppler-num-bins-unification) into next
Conflict resolution: keep next's CUDA engine hooks, sample-buffer renames
(d_buffer_sample_count) and full_grid_search option; adopt the PR's
set_doppler_num_bins() members. CUDA capacity now uses
d_num_doppler_bins_full_grid_active and update_grid_doppler_wipeoffs()
uploads the unified grid to the GPU.
2026-09-23 09:36:12 +00:00
Carles Fernandez 65cca85178 Fix CUDA acquisition upload ordering and validation
- Order code and carrier uploads on the compute stream and wait before
  returning so callers can safely reuse host buffers.
- Verify CUDA readiness and completed grid counts in adapter tests,
  rejecting unexpected CPU fallback.
- Exercise host-buffer reuse in engine parity tests.
- Correct the Jetson helper's test executable path.
- Use ArgsProduct for compatibility with Google Benchmark 1.9.2–1.9.5.
2026-09-21 17:18:55 +02:00
Carles Fernandez a996687488 Merge branch 'jetson-cuda-acquisition' of https://github.com/phillipvu/gnss-sdr into phillipvu-jetson-cuda-acquisition 2026-09-21 16:03:16 +02:00
Phillip Vu 726cf2c455 Use American spelling and plain punctuation in CUDA docs and comments
Signed-off-by: Phillip Vu <36169227+phillipvu@users.noreply.github.com>
2026-09-21 06:26:40 -07:00
Phillip Vu 3965ab7e16 clang-format
Signed-off-by: Phillip Vu <36169227+phillipvu@users.noreply.github.com>
2026-09-21 06:26:40 -07:00
Phillip Vu 6e7685ae75 CudaPcpsEngine: build the cuFFT plan and warm up when the grid is uploaded
Lazily creating the plan on the first dwell made the first acquisition of
each channel non-deterministically late in non-blocking mode (samples flow
past while the worker waits for cufftPlan1d), which shifted the time to
first fix by one subframe in 2 of 3 receiver runs on the Orin.

Signed-off-by: Phillip Vu <36169227+phillipvu@users.noreply.github.com>
2026-09-21 06:26:40 -07:00
Phillip Vu 388c818e84 cuda_multicorrelator: cudaDeviceProp::deviceOverlap was removed in CUDA 13
Signed-off-by: Phillip Vu <36169227+phillipvu@users.noreply.github.com>
2026-09-21 06:26:39 -07:00
Phillip Vu 06323e59d8 CudaPcpsEngine: drop cuFFT enumerators removed in CUDA 13
Signed-off-by: Phillip Vu <36169227+phillipvu@users.noreply.github.com>
2026-09-21 06:26:39 -07:00
Phillip Vu 5a8e56ed02 CUDA: fix build on modern toolkits/Jetson, add GPU PCPS acquisition engine
Build system:
- Drop hardcoded sm_30 (Kepler) nvcc flags rejected by CUDA >= 11; honour
  CMAKE_CUDA_ARCHITECTURES, auto-detect Jetson SoCs from the device tree
  (Orin 87, Xavier 72, TX2 62, Nano 53) or use "native" with CMake >= 3.24.
- CUDA standard follows the host C++ standard (C++17).
- find_package(CUDAToolkit) and explicit CUDA::cudart / CUDA::cufft links.
- Define CUDA_GPU_ACCEL project-wide; keep -Wno-psabi away from nvcc.

Acquisition:
- New CudaPcpsEngine (acquisition/libs/cuda_pcps_engine.{h,cu}): batched
  cuFFT evaluation of the Doppler x code-phase grid, one stream per block.
- pcps_acquisition::doppler_grid() dispatches to the engine when
  Acquisition_XX.use_cuda=true (or GNSS-SDR.use_cuda_acquisition=true),
  falling back to the CPU loop on any failure. Peak search and statistics
  are unchanged.

Tracking (GPS_L1_CA_DLL_PLL_Tracking_GPU):
- Split the racy single-launch wipe-off + correlator kernel into two
  launches on the same stream.
- cudaHostAllocMapped || cudaHostAllocWriteCombined -> cudaHostAllocMapped.
- No cudaDeviceReset() in the per-channel teardown; do not cudaFree()
  device aliases of host-mapped buffers; const-correct GPU_Complex.

Tests/docs:
- CudaPcpsEngineTest (GPU grid vs CPU reference incl. accumulation,
  bit-transition mode, 4 ms integration) and GpsL1CaPcpsAcquisitionCudaTest
  (full adapter on a real capture, CPU vs GPU estimates).
- benchmark_pcps_grid: CPU baseline vs GPU sweep.
- docs/JETSON.md build/verify/benchmark guide; README, changelog, sample
  config updates.

Signed-off-by: Phillip Vu <36169227+phillipvu@users.noreply.github.com>
2026-09-21 06:26:39 -07:00
Carles Fernandez d68b5599c8 Merge branch 'acquisition-retry-cooldown' of https://github.com/joebre/gnss-sdr into joebre-acquisition-retry-cooldown 2026-09-21 14:36:02 +02:00
Carles Fernandez 940eeea5b6 Fix the secondary-signal status gating of the assisted acquisition
GPS: compare only the three LSBs of the 4-bit term broadcast in page 25
of subframe 4. The MSB is the A-S flag (IS-GPS-200, 20.3.3.5.1.4), so
the former thresholds (>= 10 for L2C, >= 11 for L5) only held with A-S
on: with A-S off, every satellite was blocked for L2C and L5, and so was
a satellite reporting no configuration information with A-S on. Add
named constants for the masks and the configuration codes.

RTKLIB_PVT: an almanac from a channel that has not decoded page 25 yet
no longer erases the AS_status already stored for that satellite, which
made the gating fall back to permissive after each channel reassignment.

GLONASS: look up the health of the tracked satellite instead of the pool
entry matched by frequency channel, which can be another slot.

Galileo: do not gate E5a. E5a_HS is only broadcast in F/NAV on E5a, so it
cannot be learned from E1B, and a stored value could keep a satellite
blocked after it returned to service. E5b remains gated.

Shorten the comments introduced in this branch and remove the claims
that did not match the code.
2026-09-21 13:08:57 +02:00
Carles Fernandez affb9aa4af Merge branch 'gps-galileo-signal-status-fix' of https://github.com/joebre/gnss-sdr into joebre-gps-galileo-signal-status-fix 2026-09-21 12:21:49 +02:00
Carles Fernandez c285e006a8 Fix #1112 in a more GNU Radio scheduler friendly way 2026-09-21 08:35:42 +02:00
Carles Fernandez 65aa3ba21c Fix false frame synchronization in the GPS L1 C/A telemetry decoder 2026-09-20 00:47:40 +02:00
Carles Fernandez 9f9868d86a Make the observables robust to wrong TOWs and size their history
Hybrid_Observables:
- Interpolate only between consecutive tracking samples whose TOW advanced
  as much as the receiver time: after a gap in the valid words of a
  channel, the last sample before it and the first one after it were used
  together, giving a meaningless carrier phase and, if the TOW had stepped,
  a first pseudorange off by up to hundreds of seconds. Fix the TOW
  rollover in the interpolation and in the pseudorange computation, which
  added a week to any travel time longer than 302.4 s.
- Set the receiver time from the largest group of channels agreeing on the
  TOW, and set it again when such a group contradicts it, instead of
  trusting the latest TOW of the first valid epoch. Channels contradicting
  the receiver time do not deliver valid pseudoranges. Make the clock
  correction from the PVT block safe at the TOW rollover.
- Size the tracking history from the receiver clock buffer and the
  observables interval instead of a fixed count, which was too short for
  1 ms symbols (Galileo E6) at long intervals and 4x too large at the
  default one. Find the nearest sample with a binary search.
- Use the mean Doppler of the epoch in the cycle-slip detector: the final
  value raised false slips with high Doppler rates and long intervals.
- Make the static helpers private and remove their unit test.

RTKLIB_PVT: do not count the epochs without enough satellites as solver
errors, and send the reset to the observables once per outage: each reset
emptied the tracking history of every channel every two seconds.
2026-09-19 15:40:30 +02:00
Carles Fernandez 0f64a82ad0 Merge branch 'joebre-fix-observables-history-capacity' of https://github.com/joebre/gnss-sdr into joebre-joebre-fix-observables-history-capacity 2026-09-18 15:47:23 +02:00
Carles Fernandez 6dc1eb2a90 Add LDPC decoder to the BeiDou B2a processing chain
Improve color consistency in console messages
2026-09-18 13:15:21 +02:00
Carles Fernandez 31648f9c44 Prevent stopping an already-idle channel from blocking its subsequent acquisition attempts 2026-09-18 10:39:03 +02:00
Carles Fernandez 092d2aa145 Fix unused private member, rename file_offset by seconds_to_skip, update comments 2026-09-18 10:02:24 +02:00
joebre ee59458c1d Give Evk1029Source a single output port instead of N coupled ones
With role.RF_channels set to N > 1, Evk1029Source declared N separate
GNU-Radio-scheduler-coupled sync_block output ports and copied the same
decoded samples into each of them every work() call, so that N RF bands
sharing one raw capture (e.g. several Freq_Xlating_Fir_Filter instances
at different IFs) would see identical, sample-locked data.

That design has two costs. First, a gr::sync_block's work() cannot even
be called unless every declared output port currently has space -- so
one band's downstream chain running temporarily slower than the others
stalls production on every port at once, not just its own; if anything
downstream depends on one of the OTHER (unrelated) ports to keep making
progress, that coupling can cascade into the whole receiver stalling
with nothing left able to run. Second, N-1 extra full-buffer memcpy
calls happen on every work() call, at up to the raw capture's sample
rate (hundreds of MSps) with large per-call chunks -- real, continuous
CPU and memory-bandwidth cost for pure duplication.

Change Evk1029Source to always declare exactly one real output port.
Multiple RF bands sharing the capture now each get their own connect()
to that same port instead of separate ports -- gnss_flowgraph.cc's
existing generic signal-source-to-conditioner wiring already takes this
path automatically whenever output_signature()->max_streams() == 1,
using GNU Radio's native support for several independent readers on one
producer port. Each reader then advances at its own pace: a temporarily
slow band only delays itself, and the duplicate-copy cost is gone
entirely. This also now matches this project's older EVK10x9_source,
which used the same single-port-plus-independent-readers design.

.enable_throttle_control with RF_channels > 1 is left unsupported (a
single throttle block would itself need the same N-independent-readers
treatment, not implemented here) and continues to be ignored with a
warning; the warning message is updated to describe why.
2026-09-18 10:02:23 +02:00
joebre eda8794b28 Add EVK1029 file_offset config to seek into a raw capture
Evk1029SignalSource.file_offset (seconds, default 0 = disabled) lets a
long capture be jumped straight to a time of interest instead of always
reprocessed from the start. Converted to a byte count using the source's
own sampling frequency, then rounded up to the next 64-bit word boundary
in Evk1029Source before seeking, matching the capture's native packing
(16 OBA samples per little-endian 64-bit word).
2026-09-18 10:02:23 +02:00
Mathieu Favreau 4b6ccdb347 Fix warning 2026-09-18 10:02:22 +02:00
Vladislav P a7ec48b46f channel_fsm: fix rare deadlock
A deadlock may occur when ChannelFsm receives Event_stop_channel when
the non-blocking acquisition is in progress.

The control flow will be the following:

ChannelFsm::Event_stop_channel locks the mutex mx_
ChannelFsm::Event_stop_channel calls stop_acquisition
ChannelFsm::stop_acquisition calls PcpsAcquisitionAdapter::stop_acquisition
PcpsAcquisitionAdapter::stop_acquisition calls pcps_acquisition::set_active
pcps_acquisition::set_active calls pcps_acquisition::wait_if_active
pcps_acquisition::wait_if_active blocks waiting for the background
acquisition thread to finish processing
pcps_acquisition::acquisition_core calls pcps_acquisition::handle_threshold_reached
pcps_acquisition::handle_threshold_reached calls pcps_acquisition::send_positive_acquisition
pcps_acquisition::send_positive_acquisition calls ChannelFsm::Event_valid_acquisition
ChannelFsm::Event_valid_acquisition tries to lock the mutex mx_ for one
more time
Deadlock.

This commit does three things:
 - removes "magic numbers" used to mark different channel states as "magic numbers"
made the first attempt to fix the deadlock fail in a really strange way.
 - Implements a new state FSM_STATE_TERMINATING, used to prevent
unintended effects during FSM transition from tracking/acquisition to
FSM_STATE_IDLE.
 - Unlocks the mutex mx_ during actual attempt to stop
tracking/acquisition.

Signed-off-by: Vladislav P <vladisslav2011@gmail.com>
2026-09-18 02:31:50 +03:00
joebre 03b0cbe514 Fix observables per-channel history too short for fast-producing channels
hybrid_observables_gs::interp_trk_obs() bracket-interpolates each
channel's pseudorange against d_Rx_clock_buffer.front(), a timestamp
deliberately roughly (clock buffer capacity - 1) observable intervals
behind "now" (its own comment: "gives the channels time to compute the
tracking observables"). The per-channel history it interpolates from,
d_gnss_synchro_history, was a fixed 1000-entry capacity regardless of
that channel's own valid-word production rate.

That fixed entry count covers a shrinking time span as a channel's own
rate grows. A channel producing valid words close to its raw tracking
rate can fill all 1000 entries in only a couple of seconds, leaving a
window shorter than the clock buffer's lag -- interp_trk_obs() then
never finds a pair bracketing the target timestamp for that channel, no
matter how healthy its tracking/decoding otherwise is. The channel keeps
reporting via the tracking-only fallback (visible as tracked, correct
CN0/Doppler) but Flag_valid_pseudorange stays permanently false, so it
never contributes a pseudorange and PVT reports it without position/
elevation data.

Bump the capacity 5x. This is a per-channel structure holding a small
struct, so the added memory is negligible; it comfortably covers a
channel whose production rate is close to its raw tracking rate while
leaving slower channels' existing multi-second margin untouched.

Verified against a channel type whose valid-word rate is high enough to
exhaust the old capacity within ~1-1.5s of first becoming valid: with
the fix, its interpolation gap against the clock target dropped from a
mostly-failing ~0.9-1.9s (essentially the whole clock lag) to a stable
sub-millisecond match, sustained over the rest of the run.
2026-09-17 11:21:00 +02:00
Carles Fernandez 96b4921f8c Merge branch 'joebre-freq-error-reduction' into next 2026-09-16 15:21:49 +02:00
Carles Fernandez f2a19005fd Merge branch 'full-grid-search-standalone' of https://github.com/joebre/gnss-sdr into joebre-full-grid-search-standalone 2026-09-16 14:18:14 +02:00
Carles Fernandez 99ce68f07b Merge branch 'next' into joebre-freq-error-reduction 2026-09-16 13:35:48 +02:00
Carles Fernandez 1f91e48e1f Merge commit '5efbfd16c9eed710211f5532d30a0681cc67add2' into joebre-freq-error-reduction 2026-09-16 13:35:35 +02:00
Carles Fernandez e451bd110f Fix compiler warning 2026-09-16 12:39:49 +02:00
Carles Fernandez 6fa2670af3 Fix Galileo almanac health fallback for E5b and E5a signals 2026-09-16 11:41:37 +02:00
Carles Fernandez 199e943b8e Extend the healthy field to more signals 2026-09-16 11:24:37 +02:00
Carles Fernandez 9f5f3b9427 Merge branch 'tracked-satellite-healthy-flag' of https://github.com/joebre/gnss-sdr into joebre-tracked-satellite-healthy-flag 2026-09-16 10:07:43 +02:00
Carles Fernandez c1aa1a24b8 Merge branch 'optimization/improve-acq-sample-copy' of https://github.com/MathieuFavreau/gnss-sdr into MathieuFavreau-optimization/improve-acq-sample-copy 2026-09-16 10:01:23 +02:00
Carles Fernandez 3c81028976 Merge branch 'fix_positive_acquisition_logging' of https://github.com/vladisslav2011/gnss-sdr into vladisslav2011-fix_positive_acquisition_logging 2026-09-16 09:53:28 +02:00
Carles Fernandez d3d236026f Read missing health flag in galileo almanac, remove wrong check 2026-09-16 09:49:52 +02:00
Carles Fernandez 5f83fbead2 Merge branch 'galileo-health-fixes' of https://github.com/joebre/gnss-sdr into joebre-galileo-health-fixes 2026-09-16 09:42:51 +02:00
joebre 88a0deb9e3 Merge remote-tracking branch 'upstream/next' into HEAD
# Conflicts:
#	src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc
#	src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h
#	src/core/interfaces/pvt_interface.h
#	src/core/receiver/gnss_flowgraph.cc
2026-09-16 08:22:13 +02:00
Carles Fernandez 75ae5ce4e4 Allow BeiDou B2a signals in multi-band configurations 2026-09-16 07:47:19 +02:00
Vladislav P 7a5d6ed589 PCPS acquisition: Fix positive acquisition logging
Set result.positive_acq to true before sending positive acquisition.
This makes positive acquisitions being logged as positive instead of
negative.

Signed-off-by: Vladislav P <vladisslav2011@gmail.com>
2026-09-16 02:36:13 +03:00
joebre a12e086443 Merge remote-tracking branch 'upstream/next' into pcps-doppler-num-bins-unification
# Conflicts:
#	src/core/receiver/gnss_flowgraph.cc
2026-09-15 16:45:50 +02:00
joebre 0f049493eb Add a per-signal broadcast health flag to MonitorPvt's tracked satellites
TrackedSatelliteInfo.used only says whether a tracked satellite/signal
contributed to the fix, not why it didn't -- below PVT.elevation_mask,
RAIM FDE, and broadcast-unhealthy are all indistinguishable to a monitor
client. Add a `healthy` field (proto field 8, default true) alongside it.

GPS health comes from the decoded ephemeris's SV_health, falling back to
the almanac (broadcast by every satellite) when no ephemeris has been
decoded yet. Galileo health is resolved per-signal via the existing
get_galileo_signal_health(), with the same almanac fallback when no
ephemeris is available for that signal's service. Other systems default
to healthy=true.
2026-09-15 10:58:17 +02:00
joebre 10aab33302 Fix two Galileo health-check gaps that silently accept unhealthy satellites
Galileo_Ephemeris_Store::combined_view() overwrote a preferred source's
merged entry with the raw ephemeris from that source, discarding the
health/DVS fields the preferred source's message type structurally never
carries (F/NAV never decodes E1B_HS/E1B_DVS/E5b_HS/E5b_DVS, I/NAV never
decodes E5a_HS/E5a_DVS). Those fields default to 0 ("OK"), so an E1+E5a
configuration preferring F/NAV would silently present an I/NAV-flagged
unhealthy satellite as healthy. Now the merge fills in only the fields the
preferred source can't carry, from the secondary source's entry.

select_galileo_ephemeris()'s Reduced CED bootstrap fallback had no health
check at all: Galileo_Reduced_CED carries no health/DVS bits of its own, so
an unhealthy satellite with no full ephemeris decoded yet would still be
accepted via Reduced CED. Cross-check the almanac's E1B_HS instead, which
every other satellite broadcasts as part of the normal almanac rotation.
2026-09-15 10:48:29 +02:00
joebre 5efbfd16c9 Remove time-to-fix breakdown diagnostic
log_time_to_fix_breakdown() and its six supporting state variables
were left-over instrumentation from developing the frequency-error-
reduction feature, not part of its documented behavior -- strip
before this is mergeable.
2026-09-15 10:28:54 +02:00
Mathieu Favreau dd5e76f90d Optimize cshort type 2026-09-14 19:56:00 +00:00
Mathieu Favreau 0e8065b45d Improve acquisition sample copy 2026-09-14 18:51:09 +00:00