Example JSON

{
  "map": {
    "mapId": 11,
    "type": "STABLE",
    "width": 4,
    "height": 1,
    "resolution": 0.05,
    "docking": [1, 0],
    "pixels": "᭠ᠭᰩ䘨掊庀֢嫠嵀 ",
    "rooms": [
      {
        "roomId": 0,
        "cleaningSequence": 0,
        "sweepingTimes": 1,
        "moppingTimes": 0,
        "name": "Room 1"
      }
    ]
  },
  "zones": {
    "virtualWalls": [
      {
        "id": 0,
        "coordinates": [
          [52, -19],
          [103, -24]
        ]
      }
    ],
    "forbiddenZones": [
      {
        "id": 0,
        "mode": "ALL_FORBIDDEN",
        "coordinates": [
          [60, -50],
          [90, -50],
          [90, -30],
          [60, -30],
        ],
        "name": ""
      }
    ]
  }
}

Attributes

mapId unique map ID
type STABLE = map is finished, virtual zones etc can be used
UNSTABLE = map is not yet finished
width map width in pixels
height map height in pixels
resolution map resolution, e.g. 1 pixel equals 1 cm
docking Docking station coordinates (x, y)
pixels see below
rooms detected rooms and their properties:
roomId = unique room ID
cleaningSequence = cleaning sequence position
sweepingTimes = how often the room should be swept
moppingTimes = how often the room should be mopped
name = room name
zones virtualWalls:
id: unique wall ID
coordinates: array of coordinates (x, y)
forbiddenZones:
id: unique room ID
mode: ALL_FORBIDDEN, SWEEP_FORBIDDEN, MOPPING_FORBIDDEN
coordinates: array of coordinates
name: zone name

Pixels

The format of the pixels attribute is the following:

  1. Based on Pixel array (e.g. x, y and type) the data needs to be compressed to the following format similar to this:

    x, y, length, type
    
    length = the amount of following horizontal pixels  
    type = the type of the pixel: 
    	1 => unkown area
    	2 => border (e.g. wall)
    	3 => door
    	10...49 => obstacle
    	50...99 => room ID
    
    Example:
    [x, y, t, x, y, t, ...] 
    [
    	0, 0, 1,
    	1, 0, 1, 
    	2, 0, 2,
    	3, 0, 2,
    	4, 0, 1
    ]
    =>
    [x, y, l, t, x, y, l, t, ...]
    [
    	0, 0, 2, 1,
    	2, 0, 2, 2,
    	4, 0, 1, 1
    ]
    
  2. The resulting compressed pixel array needs to be compressed using LZString Compression (UTF16)

[0,0,2,1,2,0,2,2,4,0,1,1]
=> 
᭠ᠭᰩ䘨掊庀֢嫠嵀 

https://codepen.io/Jonas-Bark/pen/MWRORbx