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.
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.
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.
- 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.
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>
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>
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.
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.
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.
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).
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>
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.
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>
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.
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.
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.