By default Elektronik uses google protocol buffers and gRPC. All data is represented as data packages. You can find package specification in protobuf format in file MapTypes.proto.
There are several types of packages:
- Action package
- Image package
Each such package contains:
- Data action:
- add
- update
- remove
- clear
- info
- Timestamp
- Special package flag (special)
- Message
- Connections set
- Data:
- Points
- Observations
- Lines
- Tracked objects
- Infinite planes
There are four actions over data:
- Add. This action adds neccesary objects to a map. Note, that without objects adding, you can't interact with them in a future. If you try to apply anything to unexisted object, then an error will raise in Elektronik.
- Update. This action changes object parameters according to received data. You don't need to send all data when object updated but only it's updated part.
- Remove. Removes an object from a map.
- Clear. Clear a map corresponding an object type.
- Info. Shows additional information in offline mode.
Timestamp is used by the Elektronik offline mode, it is displayed on an actions rewinding slider in the right-bottom corner of a window. Also it will be used to find image form camera for this moment of time. Image file should be called <timestamp>.png.
Online mode doesn't use this information.
Special package flag is used by offline mode, it is intended to skip non interesting actions by clicking rewinding buttons to jump to nearest special package.
A message is displayed for all special packages in the right-top corner of window in offline mode.
A connections set is intended to display lines between objects such as points or observations. A connection is a tuple of two integer values which contain ids of connecting objects. At the moment it is possible to setup connections just between same type objects, e.g. there is no possibility to connect a point with an observation. Note, that a connection will be updated automatically while object updating.
Besides connections, a set also contains an action. It may be one of two following actions:
- Add
- Remove
In both cases an action can be done just over existing objects in a map, but connections have an effect just while objects updating. For example, to add (remove) connections between two points, you should send a package with an "update" action for points and an "add" ("remove") action for connections. Also connections can be added and without actual update for objects, e.g. you can create a package which will contain an empty set of objects and non empty set of connections.
There are several types of data:
- Points
- Observations
- Lines
- Tracked objects
- Infinite planes
Any package must have one set of objects of type above.
Point object contains:
- Point ID.
- Position
- Color
- Message
Observation object contains:
- Point
- Orientation (quaternion)
- Message
- File name of image taken at this observation
- Statistics (not using for now)
- List of points visible from this observation. Based on this information Elektronik will build observation graph.
Lines object contains:
- First connected point
- Second connected point
Tracked objects are any object that has position, orientation and also trajectory. It can be VR-helmet or any other device that taking SLAM-data.
Tracked objects contains:
- Object ID
- Position
- Orientation (quaternion)
- Trajectory color
- Message
Infinite plane object contains:
- Plane ID
- Point on plane
- Normal
- Color
- Message
This type of packages is used for receive images form camera in online mode. It contains byte array of image in PNG or JPEG format.
There can be metainformation at the end of the file. For now it can only be Int32 value - amount of packages. Before metadata always should be special marker 0xDEADBEEF. So now metadata is 8 bytes containing marker and amount of packages;
You can familiar with Elektronik interaction example in the folder Plugins/Protobuf.Tests.Elektronik. The example is implemented as Unit-tests. Before starting tests you should run Elektronik in online mode. After tests was ran, there will be files <TestName>.dat in the executable files directory folder which can be used as Elektronik opportunities presentation in offline mode.
You can familiar with Elektronik interaction example in the folder Examples/cxx at the root of repo. The example is implemented as google tests Unit-tests. To build this example we recommend to use vcpkg.