MAPS websocket interface: Difference between revisions

From Anemos wiki
No edit summary
(→‎Device output: Adding control modes)
Line 24: Line 24:


===Messages===
===Messages===
In this section we will supply a list of most common messages that the MAPS device can receive and send
In this section we will supply a list of most common messages that the MAPS device can receive and send.


====Device output====
====Device output====
Line 34: Line 34:
     time: 'day/mo/year hh:mm:ss.usec'
     time: 'day/mo/year hh:mm:ss.usec'
}
}
</syntaxhighlight>
</syntaxhighlight>According to the operation mode of the device, output results can arrive automatically, or on demand as a response to a request.
 
==== Control messages ====
Control messages are the commands that the connected application can send to the device for ordering it to perform specific operations. The usable control messages and the corresponding responses of the device are listed below.
 
===== ping =====
 
===== strobe =====
 
===== datarx =====
 
===== calibrate =====
 
===== setcapturemode =====
 
===== hwpulse =====
 
===== paramrx =====
 
===== logout =====
 
===== shutdown =====

Revision as of 12:46, 7 December 2023

MAPS devices can be operated in a mode where the device is returning data and can be controller over websocket connection.

In websocket mode, the user can connect to the device with any application over using the websocket protocol. The device is by default listening for connection on port 9002, but port number can vary in devices. Please refer to the information card supplied with your devices for more specific information.

Upon connection the device communicates by sending and receiving data and commands in a json format. For example:

{
    type: "output",
    msg: "position",
    data: "[00001024], ...",
    time: "07/12/2023 14:20:15.123456"
}

The above example shows a position output of the MAPS device.

Message structure

The messages have some common and variable fields. Most common fields are:

  • type: Type of the message. Value is usually , "output" or "info".
    • "control" messages denote commands that influence the operation of the device or messages that indicate information about the status of the device.
    • "output" type messages contain intended output of the device, i.e., some variant of position information.
    • "info" type messages hold some kind of information about the device, or a notification for an event that happened.
  • "msg" is the usually the message itself, or some kind of further information about the content of the message.
  • "data" is a larges chink of embedded data, in case the message. In the example it is the position data from the device.
  • "time" is the timestamp of the sender at the exact time of sending the message. Time information is in a [day]/[month]/[year] [hour]:[min]:[sec].[microsec] format.

Messages

In this section we will supply a list of most common messages that the MAPS device can receive and send.

Device output

By default, the device provides output in the following structure:

{
    type: 'output',
    msg: 'position',
    data: '[index], X, Y, Z, aX, aY, aZ, "good"/"bad", "*****", capture_timestamp, sensore_timestamp, monotonic_timestamp',
    time: 'day/mo/year hh:mm:ss.usec'
}

According to the operation mode of the device, output results can arrive automatically, or on demand as a response to a request.

Control messages

Control messages are the commands that the connected application can send to the device for ordering it to perform specific operations. The usable control messages and the corresponding responses of the device are listed below.

ping
strobe
datarx
calibrate
setcapturemode
hwpulse
paramrx
logout
shutdown