Planet Handler - Messages

Basics

This handler is used for planet communicative messages on each node the explorer (robot) reaches. For each login, there is a specific set of topics the account has access permissions to.

Correct topics:

planet/<PLANET>/<ID>
planet-dev/<PLANET>/<ID>

Message Types

Type pathSelect

Request:

{
  "from": "client",
  "type": "pathSelect",
  "payload": {
    "startX": 0,
    "startY": 0,
    "startDirection": 0
  }
}

Response:

Only sent if controller forces explorer (robot) into specific direction, else omitted

{
  "from": "server",
  "type": "pathSelect",
  "payload": {
    "startDirection": 0
  }
}

Error Response:

Please note, that error messages will be sent to explorer/<ID> and not the planet topic

{
  "from": "debug",
  "type": "error",
  "payload": {
    "message": "Expected integer values for either 'startX' or 'startY' but found null"
  }
}

Type path

Request:

{
  "from": "client",
  "type": "path",
  "payload": {
    "startX": 0,
    "startY": 0,
    "startDirection": 0,
    "endX": 0,
    "endY": 0,
    "endDirection": 0,
    "pathStatus": "free|blocked"
  }
}

Response:

{
  "from": "server",
  "type": "path",
  "payload": {
    "startX": 0,
    "startY": 0,
    "startDirection": 0,
    "endX": 0,
    "endY": 0,
    "endDirection": 0,
    "pathStatus": "free|blocked",
    "pathWeight": 1
  }
}

Adjust Response:

{
  "from": "debug",
  "type": "adjust",
  "payload": {
    "startX": 0,
    "startY": 0,
    "startDirection": 0,
    "endX": 0,
    "endY": 0,
    "endDirection": 0
  }
}

Error Response:

Please note, that error messages will be sent to explorer/<ID> and not the planet topic

Field message is always a string and one of the following items from the (examples) list in the code snippet

{
  "from": "debug",
  "type": "error",
  "payload": {
    "message": [
      "Invalid message format: <ERROR>",
      "Path not found",
      "Start coordinate does not match last visited node",
      "Start and End coordinates not identical for blocked path",
      "Path is not blocked"
    ],
    "debug": ""
  }
}

Type pathUnveiled

These messages are sent by the controller after path message was processed successfully

Response:

{
  "from": "server",
  "type": "pathUnveiled",
  "payload": {
    "startX": 0,
    "startY": 0,
    "startDirection": 0,
    "endX": 0,
    "endY": 0,
    "endDirection": 0,
    "pathStatus": "free|blocked",
    "pathWeight": 1
  }
}

Type target

These messages are sent by the controller after path message was processed successfully

Response:

{
  "from": "server",
  "type": "target",
  "payload": {
    "targetX": 0,
    "targetY": 0
  }
}