augcog / ISAACS_Interface

Virtual Reality Interface for Multi-UAV Teleoperation, Version 2
Apache License 2.0
13 stars 6 forks source link

LiDAR Mesh Efficiency #55

Closed erwang01 closed 4 years ago

erwang01 commented 4 years ago

Speed up the LiDAR mesh rendering

erwang01 commented 4 years ago

A lot of time seems to be spent parsing the JSON message. In fact, message generation often takes longer than generating the mesh itself especially as the messages get larger.

On average messages take on the order of 1-2 seconds to generate but each block itself only takes 1-2 milliseconds to generate on average. (It will be worth looking at statistics such as medians, highs and lows because there may be a lot of empty messages as suggested by a significant amount of "not enough faces" messages).

erwang01 commented 4 years ago

Furthermore, we may want to investigate the not enough faces threshold as sometimes blocks are cleared so we should probably put that threshold for creating a new game object but updating existing objects should be exempt.

Creating a new issue for this. #59

erwang01 commented 4 years ago

@PeruDayani Should the mesh streaming be a separate thread by itself or should we put the entire ROSBridge connection off in a separate thread?

Also do you think its possible / beneficial to give each ros topic its own thread?

erwang01 commented 4 years ago

At around 80 seconds through the bag, we have around 1.5 seconds between messages on the conservative side, 2-3 seconds if we take the average.

erwang01 commented 4 years ago

LiDAR meshmsg parsing is now on a separate thread. The meshes can be streamed with reasonable speed resulting in no backlog.

Unfortunately, there is still a noticeable lag when the Mesh is being generated as the Main thread is halted for up to half a second or so. Attempting to resolve this by generating the mesh off the main thread as well. However this causes problems as game objects cannot be generated off the main thread. As such we can only generate all the auxillary arrays and feed them into the main thread for final mesh generation. See branch mesh-2 for progress on this.

erwang01 commented 4 years ago

mesh-2 implementation is now complete ready for PR into mesh.

The Mesh generation still blocks the main thread for 0.2 ish seconds.

erwang01 commented 4 years ago

I think the different bag timings are negligible. Its hard to tell because they all range quite widely but set mesh (the main thread blocking operation) is below 50 ms for all 3 types of bags (16 voxel, 32 voxel gpsl and codedap