gpsd-knowledge-patch
gpsd changes since training cutoff (latest: latest) — altHAE/altMSL, ECEF/NED fields, TOFF/PPS timing, gps_mainloop(), shared-memory API. Load before working with gpsd.
What this skill does
# gpsd Knowledge Patch
Covers gpsd JSON protocol fields, libgps C client API, and timing interfaces. Claude knows gpsd daemon basics, gpspipe, cgps, and JSON protocol fundamentals, but is **unaware** of the specific field semantics, deprecations, and API patterns below.
## Index
| Topic | Reference | Key content |
|---|---|---|
| TPV message fields | [references/tpv-message.md](references/tpv-message.md) | altHAE/altMSL, status codes, ECEF/NED, float validity |
| Timing & PPS | [references/timing-pps.md](references/timing-pps.md) | TOFF/PPS reports, sawtooth correction, NTP integration |
| Client API (libgps) | [references/client-api.md](references/client-api.md) | gps_mainloop(), shared-memory interface, usage patterns |
---
## Essential Quick Reference
### ECEF and NED Velocity/Position Fields
TPV can include ECEF (Earth-Centered, Earth-Fixed) coordinates and NED (North-East-Down) components:
```json
{
"class": "TPV",
"ecefx": 3981234.56,
"ecefy": 123456.78,
"ecefz": 4966789.01,
"ecefpAcc": 2.5,
"ecefvx": 0.12,
"ecefvy": -0.05,
"ecefvz": 0.03,
"ecefvAcc": 0.1,
"velN": 0.12,
"velE": -0.05,
"velD": -0.03,
"relN": 1.234,
"relE": -0.567,
"relD": 0.089
}
```
`relN`/`relE`/`relD` are RTK baseline vectors relative to a base station (meters). Only populated when the receiver reports RTK baseline data.
### TPV Key Fields
| Field | Type | Unit | Description |
|-------|------|------|-------------|
| `altHAE` | float | meters | Height Above Ellipsoid (WGS84) — raw GPS altitude |
| `altMSL` | float | meters | Mean Sea Level altitude — what maps show |
| `geoidSep` | float | meters | Geoid separation: `altHAE - altMSL` |
| `status` | int | — | Fix quality: 2=DGPS, 3=RTK Fixed, 4=RTK Float, 5=DR |
| `ecefx/y/z` | float | meters | ECEF position from Earth center |
| `ecefpAcc` | float | meters | ECEF 3D position accuracy |
| `velN/E/D` | float | m/s | North/East/Down velocity components |
| `relN/E/D` | float | meters | RTK baseline relative to base station |
### Altitude — "alt" Is Deprecated
The `alt` field in TPV is **deprecated and undefined**. Always use `altHAE` or `altMSL`:
```json
{
"class": "TPV",
"altHAE": 120.345,
"altMSL": 85.678,
"geoidSep": 34.667
}
```
`altMSL` is what most users want (matches map elevations). `altHAE` is the raw GPS measurement.
### Float Validity — Use isfinite(), Not isnan()
Unknown/invalid floats in gpsd are NaN. **Always** check with `isfinite()`:
```c
// WRONG: misses infinity
if (!isnan(gpsdata->fix.speed)) { ... }
// CORRECT: catches NaN AND infinity
if (isfinite(gpsdata->fix.speed)) { ... }
```
### TPV Status Field Values
The `status` field modifies `mode` (not a replacement). Values 0 (Unknown) and 1 (Normal) are **omitted from JSON output** — if absent, assume Normal:
| Value | Meaning | Accuracy |
|-------|---------|----------|
| 2 | DGPS | Sub-meter |
| 3 | RTK Fixed | Centimeter |
| 4 | RTK Floating | Decimeter |
| 5 | DR | Dead Reckoning |
| 6 | GNSSDR | GNSS + DR combined |
| 7 | Time (surveyed) | Time-only mode |
| 8 | Simulated | Test data |
| 9 | P(Y) | Military code |
---
## Timing — Enable TOFF/PPS
```json
?WATCH={"enable":true,"json":true,"pps":true}
```
Both TOFF and PPS carry `real_sec`/`real_nsec` (GPS time) and `clock_sec`/`clock_nsec` (system time).
| Report | Source | Precision | Extra fields |
|--------|--------|-----------|--------------|
| TOFF | Serial data stream | ~1–10 ms | — |
| PPS | Hardware 1PPS pulse | ~0.1–1 µs | `precision`, `shm`, `qErr` |
PPS `qErr` is the sawtooth correction in **picoseconds** — subtract from measured offset for higher accuracy.
---
## Client API Patterns
### gps_mainloop() — Simple Event Loop
```c
int gps_mainloop(struct gps_data_t *gpsdata, int timeout,
void (*hook)(struct gps_data_t *gpsdata));
```
`timeout` is in **microseconds**. Returns -1 on timeout or error. Calls `hook` on each data arrival.
```c
#include <gps.h>
#include <math.h>
void on_gps(struct gps_data_t *gpsdata) {
if (gpsdata->fix.mode >= MODE_2D && isfinite(gpsdata->fix.latitude))
printf("%.6f, %.6f\n", gpsdata->fix.latitude, gpsdata->fix.longitude);
}
int main(void) {
struct gps_data_t gpsdata;
gps_open("localhost", "2947", &gpsdata);
gps_stream(&gpsdata, WATCH_ENABLE | WATCH_JSON, NULL);
gps_mainloop(&gpsdata, 5000000, on_gps); /* 5s timeout */
gps_stream(&gpsdata, WATCH_DISABLE, NULL);
gps_close(&gpsdata);
}
```
### Shared-Memory Interface
Pass `GPSD_SHARED_MEMORY` as host for fast local-only access. **Cannot** use `gps_stream()`, `gps_send()`, `gps_waiting()`, or `gps_data()`. `gps_read()` always returns current snapshot; `gps_fd` is always -1.
```c
struct gps_data_t gpsdata;
gps_open(GPSD_SHARED_MEMORY, NULL, &gpsdata);
if (gps_read(&gpsdata, NULL, 0) > 0) {
if (isfinite(gpsdata.fix.latitude))
printf("%.6f, %.6f\n", gpsdata.fix.latitude, gpsdata.fix.longitude);
}
gps_close(&gpsdata);
```
**Use for:** embedded systems, simple pollers, monitoring scripts (local only).
**Avoid when:** you need streaming (`gps_stream`), device filtering, `gps_waiting()`, or remote access.
### Shared Memory vs TCP Socket
| Feature | TCP Socket | Shared Memory |
|---------|-----------|---------------|
| `gps_stream()` | Yes | **No** |
| `gps_send()` | Yes | **No** |
| `gps_waiting()` | Yes | **No** |
| Device filtering | Yes | **No** |
| `gps_read()` behavior | Blocks for new data | Returns current snapshot |
| `gps_fd` | Socket fd | Always -1 |
| Remote access | Yes | **No** (local only) |
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.