Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Discussion Unity vs. Gazebo performance

Discussion in 'Robotics' started by Envilon, Feb 27, 2023.

  1. Envilon

    Envilon

    Joined:
    Aug 8, 2020
    Posts:
    55
    Hi, I'm here with a small discussion for those who tried both Unity and Gazebo. So, I was expecting that Unity would outperform Gazebo. I thought that Gazebo would take a more significant performance hit with more complicated scenes or an increasing number of simulated robots than Unity.

    However, as I tried running a simple scene with only one simulated robotic arm, Unity has a lower framerate than Gazebo. I run it on a laptop without a dedicated graphics card because Gazebo's framerate seems to be limited at ~62 FPS, and if I run the simulations on my PC, I can't compare the performance.

    Do you have any experience or thoughts on this
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,877
    There is a LOT of into needed to say why this can happen.
    In general I'm not too surprised since gazebo is only focused on 1 thing, while Unity is a tool which allows you to make everything you want
     
  3. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,731
    What is your frame rate in the editor?
    However, Unity editor has own overhead.
    But FPS is not utility that you should take measurements, without actually profiling.

    What is the profiling bottleneck.

    What is your hardware?

    What assets you are using?

    Chances are you got slow IK algorithms.

    Also how is the performance in the build.
     
    DevDunk likes this.
  4. ActiveSim

    ActiveSim

    Joined:
    May 10, 2019
    Posts:
    59
    I cannot agree at this point. Unity is running much faster in my application compare to Gazebo. Having large scenes this difference will increase. Two thoughts at this point:
    * Do you comapre Gazebo with the Unity Editor or with a build? A build is running much faster.
    * Having complex szenarios you can do a lot to optimize you application, but this depens on what you are doing exaclty.
     
  5. Envilon

    Envilon

    Joined:
    Aug 8, 2020
    Posts:
    55
    I was comparing Gazebo to both the Unity editor and the build. My scene is very simple. Literally a plane and one custom robotic arm on top of it. I don't use any IK algorithm at the moment. I run a simple controller that subscribes to a topic where it receives a JointTrajectory message and spins up a coroutine that LERPs from the current position to a target position and directly changes targets on the articulation chain.

    I did run this scenario on a laptop with pretty low specs: Intel Core i5-8250 @ 1.6GHz with integrated Intel UHD Graphics 620 and 32 GB of RAM. And the build runs at around 28FPS. Gazebo runs the same scenario at around 62 FPS, and I believe Gazebo somehow limits the framerate.

    From what I read here I suspect my CPU could be the bottleneck here. When I run this on my PC, I naturally get better performance, but Gazebo stays capped at 62 FPS, and thus I cannot directly compare the two.

    What would be a better metric for these experiments?
     
  6. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,731
    Are you familiar with Unity profiler?
    How to work with and measure bottlenecks?

    I do suspect that your issue may be actually hardware.
    While your CPU is not something blazing fast, I think should be sufficient for base scene.
    However, integrated GPU may be an issue here.
    I am not sure, how well Unity or its builds are handled on such hardware.
     
    DevDunk likes this.
  7. Envilon

    Envilon

    Joined:
    Aug 8, 2020
    Posts:
    55
    I can't say I worked with the profiler extensively, so feel free to point me to some good resources if you have some recommendations so that I can get up to speed.

    The hardware might be the problem, I am just surprised that Gazebo was able to use it more effectively. But as @DevDunk pointed out, Unity is a bigger beast. Even though I was running a build of the application.

    However, I found out how to unlock the main camera FPS in Gazebo, so now it should not be a problem to run the experiments on my desktop PC, where I should not run into these issues.
     
  8. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,731
    This is a good starting point for you
    https://docs.unity3d.com/Manual/Profiler.html