-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improving the efficiency of the ROS side read_message #89
Comments
Tagging @peifeng-unity and @LaurieCheers-unity on this one since I think they've both looked into this before. Getting more efficient with image read/writes are definitely high-value improvements right now, but I'm not sure what's already been tried and what the low-hanging fruit might be. |
I can say on the Unity side I've tried:
On the ROS connection side, it seems in some cases I'm generating too much data in Unity for the connection to handle (On the low powered machine anyway), but yeah, I'm always keen to hear about your experience and anything you've found to improve performance with image simulation! |
Yeah, we have seen similar performance limitations. Improving this further hasn't been our priority so far (we're focussing on feature work right now, since we're already getting speeds up to 100x faster than Ros Sharp for large messages) but we'd be very interested in whatever you find; I'd definitely start by just seeing what happens if you change that 1024 constant in the Ros-Tcp-Endpoint, it seems like an obvious starting point to see how much the buffer size matters. One other idea to try: to my surprise, some users have reported speedups when they simply used more than one TCP connection talking to more than one Endpoint. (Just place two RosConnections in your scene, and send different topics via different connections. Presumably you'd get similar results if you sent images to alternate connections). It's not obvious what bottleneck that technique is overcoming, but I'd love to know. Possibly it's doing exactly what you wanted to try with the multi-threaded publisher. From your description it's not 100% clear what your setup is, but I think you're saying you have one native Ubuntu box (well, two separate boxes for two separate tests) that's running both Unity and Ros-TCP-Endpoint connected to each other, and no other ROS stuff going on? |
So some good news, I finally got around to trying this and there was a quick and easy way to improve performance substantially. |
Is your feature request related to a problem? Please describe.
As part of the changes in Unity-Technologies/ROS-TCP-Connector#152 I've been testing scenarios where the queue fills and messages are dropped.
So I've tested the code on two machines with Unity running two 720p stereo pairs as fast as it can (This is typical of one of the robots I'm aiming to simulate and If I could get it efficient enough, I am aiming for possibly multiple robots simultaneously). This would roughly equate to a 1440p resolution every frame (Currently 30-40fps). The data is being published to the ROS network over loopback (localhost / 127.0.0.1).
PC1 can handle full frame rate, and PC2 drops messages as the queue fills up.
I added some timing logs to the output of the ROS-TCP-Endpoint for more information and it revealed that on the older less powerful machine, it was taking too long to read the data which surprised me this is running on loopback.
I was thinking about ways to mitigate this issue and was considering:
Anyhow, I'm considering implementing the second option as it is by far the easier to implement, but I thought I'd ask about the first option. What are the thoughts on the dev team about having a separate thread for each publisher? Have you considered implementing this? Also if you had any other suggestions, I'm all ears!
The text was updated successfully, but these errors were encountered: