Compact Spatial Package

CSP Simulator

Interactive simulator for CSP (Compact Spatial Package) — a binary micro-packet format that encodes precise spatial position, context, and confidence in 9–17 bytes.

v0.1 DRAFT

What is CSP?

CSP stands for Compact Spatial Package — a structured binary format designed to answer the question "where is it, what is it, and how sure are you?" in the fewest bytes possible.

A single CSP package encodes three layers of information into a flat byte sequence:

01
Spatial Position
An MGRS grid reference plus a typed offset — raw XYZ delta, structural (building/floor/facade/unit), topological (road segment + parameter), or extended. Precision scales from ~10m down to ~1cm.
02
Semantic Context
Four uint8 fields — event type, entity class, priority, source type — that travel with the position so consumers understand what is at that location, not just where. In v0.1 these are flat enums (~1,440 combinations). But 4 bytes already form a 4D vector — a coordinate in semantic space with far richer expressiveness.
03
Confidence & Control
A uint8 confidence value (0–255) plus header flags that control decoding: offset type, precision tier, semantic presence, and anchor system override. Confidence gates downstream decisions — fire missions require ≥0.85, navigation ≥0.3.

Why CSP?

Most spatial data formats are verbose — GeoJSON, KML, and NMEA sentences measure in hundreds of bytes to kilobytes. CSP compresses the same information into a deterministic binary layout that fits in a single radio burst, a BLE advertisement, or a UDP datagram with room to spare.

Compact 9–17 bytes encodes position + context + confidence
Polymorphic 4 offset types adapt to terrain, buildings, road networks, or custom payloads
Multi-consumer The same bytes project into speech, navigation waypoints, map markers, or fire missions
Degradation-aware Missing overlays or low confidence trigger graceful fallbacks, not crashes

Coordinates All the Way Down

Every layer of CSP is the same operation: bytes encode a coordinate, a reference space (atlas) gives that coordinate meaning. The structure is fractal — the same pattern repeats at every level.

LayerBytesCoordinateAtlasResolution
PositionMGRS + offsetGrid cell + 3D deltaStructure overlay"Building 7, Floor 4, SW window 4"
Semantics4 uint8 fieldsPoint in concept spaceSemantic atlas"HOSTILE WEAPON_SYSTEM" or novel blend
Confidence1 uint8Point on [0, 1]Threshold mapGating decisions per consumer
ConsumerProfile IDPoint in task spaceProjection functionsSpeech / waypoint / marker / fire mission

From enums to coordinates

The semantic layer's four enum fields (eventType, entityClass, priority, sourceType) are already a 4D vector. Named enum values are just labeled points in this space. The space between them is valid — a coordinate at (0.7 × HOSTILE, 0.3 × HAZARD) represents a concept that doesn't need a name to be useful. This turns ~1,440 enum combinations into a continuous manifold.

The ML bridge

Any model that produces a latent vector can quantize it into semantic coordinates. An unknown entity detected by a sensor becomes a point in semantic space. Consumers interpret it by proximity to known regions — no enum extension, no schema migration, no retraining. The same 5 bytes that currently say "HOSTILE" could say "73% hostile, 22% hazard, 5% unknown" as a coordinate.

Physical space
Bytes MGRS + offset (4–8 B)
Resolves via Structure overlay
Known "Building 7, Floor 4, SW facade"
Novel Interpolates between mapped structures
Semantic space
Bytes Semantic fields (1–5 B)
Resolves via Semantic atlas
Known "HOSTILE, WEAPON_SYSTEM"
Novel "between hostile and hazard" — unnamed but interpretable
9–17
Bytes per package
4
Offset types
4
Consumer profiles
4
Precision tiers

Packet Layout

+--------+----------+---------+----------+------+------------+
| HEADER |  ANCHOR? |  MGRS   |  OFFSET  | CONF | SEMANTIC?  |
| 1 byte |  0-1 B   | 3-5 B   | variable | 1 B  | 0-5 bytes  |
+--------+----------+---------+----------+------+------------+

HEADER byte [VV][OO][PP][S][A]
  VV = version (2 bits)        OO = offset type (2 bits)
  PP = precision tier (2 bits) S  = semantic present (1 bit)
  A  = anchor override (1 bit)

OFFSET TYPE        SIZE    FIELDS
  00 Raw           6 B     dx(i16) dy(i16) dz(i16)
  01 Structural    5 B     struct_id(u16) floor(u8) facade|depth(u8) unit(u8)
  02 Topological   5 B     net_id(u8) seg_id(u16) param(u8) lat|vert(u8)
  03 Extended      2+N B   type(u8) length(u8) payload(N)

PRECISION TIER     MGRS    SCALE       CEP
  00 Coarse        3 B     1.0 m/u     ~10m
  01 Operational   4 B     0.1 m/u     ~1m
  02 Precision     5 B     0.01 m/u    ~0.1m
  03 Exact         5 B     0.001 m/u   ~0.01m

Architecture

                    +-------------------+
                    |   CSP ENCODER     |
                    | CspPackage -> u8[]|
                    +---------+---------+
                              |
                              v
            +--------+--------+--------+--------+
            |        |        |        |        |
            v        v        v        v        v
        +-------+ +------+ +-----+ +------+ +--------+
        |HEADER | |ANCHOR| |MGRS | |OFFSET| |SEMANTIC|
        |1 byte | |0-1 B | |3-5B | |var.  | |0-5 B   |
        +-------+ +------+ +-----+ +------+ +--------+
                              |
                              v
                    +-------------------+
                    |   CSP DECODER     |
                    | u8[] -> CspPackage|
                    +---------+---------+
                              |
              +-------+-------+-------+--------+
              v       v       v       v        v
          +------+ +------+ +-----+ +------+
          |AUDIO | | NAV  | | TAC | |FIRES |
          |  TTS | |COORD | | MAP | | FDC  |
          +------+ +------+ +-----+ +------+
              Consumer Profile Projections