Skip to main content

Data Model

The map component presents a data model that can be explored using the Live Data Viewer. It consists of services and telemetry streams.

In the topics below, the first element is the name of the map component (map unless changed with the name setting). Services which belong to a dynamic map are found under dynamicMaps/<dynamicMapName>, where <dynamicMapName> is the name given to the dynamic map in the settings; for example /map/dynamicMaps/ros/nodes/get.

Dynamic Maps​

Telemetry​

  • dynamicMaps: This telemetry stream contains information about the dynamic maps that are currently being used by the map component. It includes the name of each running dynamic map and number of nodes and edges in it.
  • dynamicMaps/<dynamicMapName>: This telemetry stream contains the live updates for each dynamic map running, showing updates such as nodes and edges added, removed, or updated.

Map Services​

These services are found under dynamicMaps/<dynamicMapName>.

  • get: Gets the dynamic map. Takes an optional mode parameter which selects what is returned:

    • progressive returns the map in chunks. This is the default.
    • monolithic returns the entire map in one message.
    • nodesByID, edgesByID, nodesByType and edgesByType return only the matching nodes or edges.
  • clear: Clears the dynamic map.

  • restart: Clears the dynamic map, then makes its adapters repeat their startup behaviour; for example, a static-map adapter loads or merges its map again. Use this to return a map to the state it had when the map component started, without restarting the component. It takes no parameters and blocks until every adapter has finished, so cancelling the request abandons any adapter still waiting. Adapters which do nothing at startup beyond following their source are not restarted. Adapters are restarted one at a time, with those which replace the whole map (static maps in load mode) before those which add to it (static maps in merge mode). If an adapter fails, the others are still restarted, because the map has already been cleared. The response lists the outcome for each restarted adapter, and the request fails if any of them failed:

    {
    "adapters": {
    "uniqueAdapterName": { "ok": true },
    "otherAdapter": { "ok": false, "error": "..." }
    }
    }
  • transact: Applies several changes to the map as a single transaction. Takes an operations array, in which each item has a type, such as addNode, addEdge, removeNode, removeEdge, setNodeData, setEdgeData or clear, and the details of the change.

Node Services​

These services are found under dynamicMaps/<dynamicMapName>/nodes.

  • getTypes: Returns an array of the string node types present in the dynamic map.
  • get: Takes an array of node ids and returns the corresponding nodes. The reportData boolean specifies whether the node data should be included in the response, and reportEdges whether the node's edges should be.
  • get/byType: Takes an array of node types and returns all nodes of those types. It also takes reportData and reportEdges.
  • add: Adds a node, given its id, type and data. It fails if a node with that ID already exists.
  • upsert: Adds a node, or if a node with that ID and type already exists, merges the data into it.
  • add/transformable and upsert/transformable: Like add and upsert, but also attach a transform edge, so that the node is positioned in the map. The frame is the node the transform is relative to, and translation and rotation give the transform.
  • add/colocated and upsert/colocated: Like add and upsert, but the node is placed at the same position as the existing node named in relatesTo. The nodeType and nodeData describe the node, and the edgeType and edgeData describe the edge which joins them.
  • add/currentPosition: Adds a node at the current position of the robot. The id can be a template, which defaults to waypoint-${i}, so that a new node is created each time. This needs a position adapter.
  • delete: Deletes the node with the given id.
  • get/data/byKey, set/data/byKey and set/data/fromMap: Read the data of a node (id and key), set one key (id, key and value), or set several keys from an object (id and value).
  • get/externalData/byKey and set/externalData/byKey: Read or set the external data of a node, which is data held in a file, such as voxels or an image.

Edge Services​

These services are found under dynamicMaps/<dynamicMapName>/edges.

  • getTypes: Returns an array of the string edge types present in the dynamic map.
  • get: Takes an array of edge ids and returns the corresponding edges. The reportData boolean specifies whether the edge data should be included in the response.
  • get/byType: Takes an array of edge types and returns all edges of those types. It also takes reportData.
  • add: Adds an edge between the nodes from and to, given its id, type and data. It fails if an edge with that ID already exists.
  • upsert: Adds an edge, or if an edge with that ID and type already exists, merges the data into it.
  • delete: Deletes the edge with the given id.
  • get/data/byKey, set/data/byKey, set/data/fromMap, get/externalData/byKey and set/externalData/byKey: As for nodes, but for an edge.

Path Services​

A path, or polygon, is an ordered set of nodes. These services are found under dynamicMaps/<dynamicMapName>/paths.

  • list: Lists the paths in the map. The closed boolean restricts the list to polygons (closed) or open paths, and the types array to certain types.
  • get: Returns the path with the given id.
  • append: Adds the nodes named in members to the end of the path with the given id, creating the path if it does not exist. The closed boolean makes it a polygon, and data is stored with the path.
  • append/currentPosition: Creates a node at the current position of the robot and adds it to the end of the path pathId. The nodeId, nodeType and nodeData describe the node.
  • delete: Deletes the path with the given id, without deleting the nodes in it.

Raster Services​

These services are found under dynamicMaps/<dynamicMapName>/raster, and work with raster nodes.

  • set/config: Sets the configuration, such as the resolution, bounds and pixel format, of the raster with the given id.
  • get/pixel and set/pixel: Read or set the pixel at px, py of the raster id. A pixel value is a colour with r, g, b and a components.
  • get/projection and set/projection: Read or set the pixel of the raster rasterId which the position of the node targetNode projects onto.

Traversal Services​

Dynamic map traversal services are found under dynamicMaps/<dynamicMapName>/traversal/spatial, and are outlined here.

Static Maps​

Telemetry​

  • staticMaps: This telemetry stream contains information about the static maps that are currently stored on the agent disk. For each map it gives the hash, the cloud ID if it was deployed from the cloud, the time, the number of nodes and edges, and whether the map is ready to be loaded or merged. A map deployed from the cloud is not ready until its download is complete.

Services​

These services are found under staticMaps.

  • export: Exports the static map with specified hash to a .tgz file at the specified filePath.
  • import: Imports a static map from a .tgz file at the specified filePath.
  • get: Returns the content of the static map specified by hash.
  • load: Loads a static map into the dynamic map dynamicMapId. The dynamic map is cleared first. The static map is given as either a sourceHash or a sourceId (the cloud ID of a deployed map, which resolves to the latest deployed version).
  • load/whenReady: Like load, but waits for the map to be ready instead of failing if it is not, for example because it is still being downloaded or has not yet been deployed. A sourceId is looked up again each time it checks, so the latest deployed version is used. The dynamicMapId is optional; if it is left out the service just waits for the map and returns its hash. It keeps waiting until it is cancelled, so a caller that no longer wants to wait should cancel the request.
  • merge: Merges a static map into the dynamic map dynamicMapId. This differs from the load service in that it does not clear the dynamic map before loading the static map. So the content of the static map will be merged with the existing dynamic map, according to the rules described in Loading and Merging.
  • merge/whenReady: Like merge, but waits for the map to be ready in the same way as load/whenReady. The dynamicMapId is required.
  • remove: Removes the static map specified by hash.
  • save: Saves the content currently in the dynamic map dynamicMapId to a static map. The hash of the static map is returned.

Position​

  • position/get: Returns the current position of the robot, found from the link maintained by the position adapter. If the fixed frame is the WGS84 ellipsoid, the position is given as latitude, longitude and altitude, with the orientation as yaw, pitch and roll. It fails if no dynamic map has a position adapter.