Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Recommended image transport method (performance)

Discussion in 'Robotics' started by edvart-ros, Feb 12, 2024.

  1. edvart-ros


    Aug 15, 2023
    What's the recommended way to transport images from Unity to ROS? Currently I'm getting significant performance hits when doing the publishing the straight-forward way. I read some threads on the github where someone recommended just *not* streaming images from Unity to ROS directly, someone mentioned using an http protocol instead. Is there any general advice on this? Real-time video feedback is pretty crucial for a lot of ROS/robotics systems. Here's essentially what I'm doing now, btw:

    Code (CSharp):
    1.     void SendImageCompressed()
    2.     {
    3.         var oldRT =;
    4. = sensorCamera.targetTexture;
    5.         sensorCamera.Render();
    7.         camText.ReadPixels(rectangle, 0, 0);
    8.         camText.Apply();
    9. = oldRT;
    11.         msg = camText.ToCompressedImageMsg_JPG(headerMsg);
    12.         ros.Publish(topicName, msg);
    13.     }
    14. }