30179df8e6
Remove the fixed pseudorange start offset, preserve per-PRN navigation assistance across RF loss and power cycles, and seed coherent navigation measurement phase on reacquisition. Add full LNAV almanac visibility scheduling, power-safe QSPI journaling, RF-domain reset isolation, and PPS Gray CDC hardening with Linux, sanitizer, RTL, and end-to-end coverage.
41 lines
1.1 KiB
C
41 lines
1.1 KiB
C
#include <assert.h>
|
|
#include <math.h>
|
|
#include <stdio.h>
|
|
|
|
#include "gps/gps_visibility.h"
|
|
|
|
static void expect_near(double actual, double expected, double tolerance)
|
|
{
|
|
assert(fabs(actual - expected) <= tolerance);
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
const double earth_radius_m = 6378137.0;
|
|
const double receiver[3] = {earth_radius_m, 0.0, 0.0};
|
|
double elevation = 0.0;
|
|
|
|
const double zenith_satellite[3] = {26560000.0, 0.0, 0.0};
|
|
assert(gps_visibility_elevation_deg(
|
|
receiver, 0.0, 0.0, zenith_satellite, &elevation));
|
|
expect_near(elevation, 90.0, 1.0e-9);
|
|
|
|
const double opposite_hemisphere_satellite[3] =
|
|
{-26560000.0, 0.0, 0.0};
|
|
assert(gps_visibility_elevation_deg(
|
|
receiver, 0.0, 0.0,
|
|
opposite_hemisphere_satellite, &elevation));
|
|
expect_near(elevation, -90.0, 1.0e-9);
|
|
|
|
const double horizon_satellite[3] =
|
|
{earth_radius_m, 26560000.0, 0.0};
|
|
assert(gps_visibility_elevation_deg(
|
|
receiver, 0.0, 0.0, horizon_satellite, &elevation));
|
|
expect_near(elevation, 0.0, 1.0e-9);
|
|
|
|
assert(!gps_visibility_elevation_deg(
|
|
receiver, 100.0, 0.0, zenith_satellite, &elevation));
|
|
puts("gps visibility geometry tests passed");
|
|
return 0;
|
|
}
|