Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. 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

Question Delay problem of subscribing image topic from ROS in Unity

Discussion in 'Robotics' started by wy7711, Aug 16, 2022.

  1. wy7711


    Jan 23, 2020
    Hi, I tried to publish a sensor_msgs/Image from ROS to visualize in Unity. I installed ROS-TCP-Connector and Unity Robotics Visualization packages. My image size is 480*640. When my publishing frequency is 30 Hz in ROS, the image visualized in the HUB is like slow motion, and the delay increase as time goes by. I check the time interval of each message callback function, which is around 0.06s (Not fixed frequency). So I reduce the publishing frequency to 5 Hz in ROS, then the delay problem in Unity disappears.

    So I am wondering how to change the subscription frequency in Unity to enhance the performance.

    - Unity version: 2021.3.4 f1
    - ROS TCP Connector: 0.7.0
    - Unity Robotics Visualizations: 0.7.0
  2. LaurieUnity


    Unity Technologies

    Oct 23, 2020
  3. Muhammad_Faiq_Malik


    Sep 27, 2022
    i am having the same lag problem when subscribing to an image topic send over to unity by ROS can u suggest a solution.
  4. Haastregt


    Feb 25, 2019
    I have the same issue. I have to put my image resolution to 200x200 pixels if I want to avoid increasing latency at 20Hz.

    From the Unity Robotics Hub repo:
    So what would be the expected subscribe time for a 1036x1698 image? 0.6 minus 0.012 seconds? (So basically 0.6 seconds) I do get about 0.6 seconds for this resolution with the TCP Connector and Endpoint, so does this mean this is an expected limitation?

    In any case, shouldn't frames be dropped if Unity can't keep up? Why do we keep receiving the messages later on with ever increasing latency?
    Last edited: Jan 16, 2024