Skip to content

2.2 Data & Interfaces

papo edited this page Feb 29, 2024 · 2 revisions

Communication & interfaces

(Author: Patrick Pogscheba, date: 12/2023)

All communication between systems is done via JSON datagrams. Each module deifines the proper models for (de)serializing. Communication is done between inner Cube-Components (inside cubes communication) and between Cubes and Server which can be cube to cube, cube to server and vice versa and between server and clientside webapps for system and game control (outside communication).

Inside Cubes

USB (Sensorboard to Backend-Service)

  • Sensor events
    • different IMU data
    • Motion
    • Neighbourhood
  • Messages (bidirectinal (currently not used)

ZeroMQ/0MQ (Backend-Service to Apps)

  • Cube Controls
  • Notifications

Outside

MQTT

  • CubeState
  • App Data
  • App State
  • POses
    • Tmp pose
  • Neighbourhood (unvalidated side to side connections between cubes)
  • App Specific events
  • Validated Connections (validated side to side connections between cubes)

REST

  • Neighbourhood Configuration
  • Tracking area (offset, center) -> make oit app specicifc ?
  • Appspecific configurations (e.g. media)

ConnectionPair (Base)

Trigger-Events:

*

Kommunikation: MQTT

Sender: backend server

Empfänger: cubes & apps ??

Topic: ???

  • puzzleCubes/neighbourhood/connection

Json


    
  {   // connection object
      "pair": [
      {
          "id": "<CUBE_ID>",
          "edge": "<FORWARD|BACKWARD|LEFT|RIGHT>"
      },
      {
          "id": "<CUBE_ID>",
          "edge": "<FORWARD|BACKWARD|LEFT|RIGHT>"
      }],
      "connected": <true|false> 
  }
        
    


Javascript


Examples

{
  "version": "0.1",
  "timestamp": "2023-07-11T12:22:08.810164",
  "connected": true,
  "pair": [
    {
      "id": "cube01",
      "edge": "LEFT"
    },
    {
      "id": "cube02",
      "edge": "FORWARD"
    }
  ]
}

Valid Connection (APP)

Kommunikation: MQTT

Publisher: Gamemaster App

Subscriber: Cube Apps

Topic: puzzleCubes/{cubeId}/app/connection

JSON


    {
        "edge": "<FORWARD|BACKWARD|LEFT|RIGHT>"
        "valid": <true|false>
        "connectedTo": 
            {
                "id": ?
                "edge" ...
            }

    }

Poses

Publisher: Backend App

Subscriber: Cube Apps

Topic: puzzleCubes/poses

[{
    "version": "0.1",
    "timestamp": "2023-08-30T10:46:41.448264",
    "position": {
      "x": 0,
      "y": 0
    },
    "orientation": 111.98558044432,
    "relativeMotion": {
      "x": 0,
      "y": 0
    },
    "relativeDirection": "NONE",
    "id": "<CUBE_ID>",
    "distances": {}
  },
   ...
]


Clone this wiki locally