In this second part, I will share how the data between several Realsense devices are merged. First, an overview on how the devices are connected together.
The data flow is as follows
The layout of devices is stored as JSON file on all PCs. The JSON structure is as follows.
The members are
- PC 1 and PC 2 gathers detection data from the devices attached to them.
- PC 2 has another process that merges the data and sends them to PC 3.
- All PCs have knowledge of the device layout and transformation Matrix to transform coordinates into Unity coordinates.* A little more on this later.
- PC 2 transfers the transformed coordinates to PC 3 through TCP/IP connection.
As mentioned above, the devices need to know its position in the layout and transforms it detection results into the larger area axes as shown in the figure below.
Each dotted rectangle denotes the view of one Realsense depth camera. Each camera is assigned an identifier (a, b) that reflects its position in the layout.
Both PC 1 and PC 2 holds a settings file that tells them which devices are attached to each PC, mapped to the Realsense device ID, which is unique. With this information, the detected positions from PC 1 and PC 2 are transformed to the top left axes of the total area.
The layout of devices is stored as JSON file on all PCs. The JSON structure is as follows.
{"devices": [{"serial_number": "747612060144","pos_x": 0,"pos_y": 2,"max_limit_x": 640,"max_limit_y": 720,"min_limit_x": 300,"min_limit_y": 300,"overlap_x": 0,"overlap_y": 0},{"serial_number": "811112060489","pos_x": 1,"pos_y": 0,"max_limit_x": 1280,"max_limit_y": 720,"min_limit_x": 0,"min_limit_y": 0,"overlap_x": 0,"overlap_y": 0}]}
The members are
- serial_number. This is the device's unique serial number as returned by dev.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER)
- pos_x and pos_y are the layout identifiers as shown on the device layout figure above.
- max_limit and min_limit denotes the active areas to perform detection.
- overlap is currently not used but I plan to consider the case where the devices are not perfectly adjacent.
This concludes the data sharing part. In the next entry, I will share how we use Google's Protocol Buffer to package the detection data when sharing and transmitting from and to the three PCs.
Comments
Post a Comment