ROS2 For Unity

Robotec.ai has just released ROS2 For Unity, a solution to connect Unity3D simulations with ROS2 ecosystem. It is now open-source under Apache 2.0 license. You can read about it in our blog post.

While there are some other bridging solutions available, ROS2 For Unity is meant for users who care about performance and high-speed simulation , especially with large data throughputs which are usual in automotive simulations.

It runs on Ubuntu 20.04 and Windows 10 and we tested it with Unity 2021.1.7f1. Both Foxy and Galactic are supported. You can start with one of our prepared releases, which can be easily imported as a Unity Asset.

For Windows 10, you have all the dependencies included so it will work on a machine without ros2 installation (e.g. in a distributed simulation - stack architecture).

14 Likes

This is cool. Can you provide a Dockerfile for Ubuntu users?
:robot:

1 Like

We do not have a dockerfile yet, but it should be easy enough to cook up following the instructions in readme (already there as a batch of commands):

This is of course for building it yourself. Using a released package on Ubuntu with ros2 installation is straightforward.

4 Likes

Thanks for adding an issue for it.

1 Like

Very nice. I myself use Vortex DDS from Advantech with Unity3D to communicate with ROS. I am in the process of releasing this open source too.

Question: Do you support ROS services and actions too from within Unity3D? I browsed a bit through your code but could not see examples of that, only of pub and sub of topics (mind you, it is 0:50 already, I might have missed it )

1 Like

Not yet, though services are rather straightforward and it is a matter of hitting our first use case that needs them. I didn’t look into actions yet.

1 Like

Thank you! This looks great!
I’m seeing recently a lot of interest in Unity simulations for robotics.

Have you been in contact with Unity people? Will this new ROS 2 client library replace the ROS TCP connector approach they currently provide? GitHub - Unity-Technologies/ROS-TCP-Connector

1 Like

US Air Force and Immersive Wisdom do Unity immersive 360° teleop of ROS 2 Galactic robots via 4G LTE using zenoh-plugin-dds and zenoh-c#. This setup can also be used with Unity simulation, I think it would be appropriate if the ROS 2 and Unity are in different locations. If both are on the same fast wired network then definitely use @adamdbrw Robotec.ai ros2-for-unity. Eclipse Zenoh is sister project of Eclipse Cyclone DDS (report here). Zenoh also works with the other OMG DDS implementations. ROS 2 with Zenoh how to is here. ROS 2 with Zenoh for bandwidth constrained wireless in Indy Autonomous Challenge racecars how to is here. Chat with developers and users on zenoh gitter. fyi the US Air Force application is passive inspection, safety & security.

1 Like

ROS 2 with @adamdbrw’s ros2-for-unity gives a very large performance improvement (latency, throughput) to the SVL Simulator used by the Indy Autonomous Challenge university teams compared to its default ROS 2 bridge.

3 Likes

Dockerfile PR is merged (Docker by pijaro · Pull Request #16 · RobotecAI/ros2-for-unity · GitHub)

We had several calls with Unity team but in the end I believe they cared about going with their solution for various reasons. These are not all clear to me, I would not like to misrepresent them here. I believe Unity was also interested in providing some support for our Ros2 For Unity in the future. On our side, we are open to various developments, especially when we could get more users to benefit from R2FU.

Good points! Since R2FU uses ros2 (rcl) under the hood, it has both shortcomings (e.g. current state of wifi communication) and advantages of ros2. As such, it will also improve as ros2 improves.

Hello,

Are you planning on implementing messages of the type gps_common? Can you recommend some sort of approach for personal implementation of these types of messages?

Many thanks in advance!

So now that LG has EOL’d the SVL simulator, is there any life left in ROS2 for Unity? Should we fall back to the Unity-authored ROS TCP Endpoint?

ROS2 For Unrty does not depends on LGSVL simulator.
It is only depends Unity.

@CryptoHypnos ROS2 For Unity comes with support for all ROS2 messages. In our releases, we include only a few, the most commonly used. You can include any custom messages by adding them to the ros2_for_unity_custom_messages.repos file (or putting them directly in src/ros2cs/custom_messages/<package_name>) and then build the project.

Is adding support for services and actions still on the roadmap?

@cloudconstable-mike Services and actions are still on the roadmap. We are not using services at this moment so there is less drive to make it done quickly. There are no technical difficulties in the way and it should be around a couple days of work for services.

Thanks Adam! At this time, we’re using neither services nor actions, but we are anticipating a need to use actions somewhat soon. Given that implementing actions requires first implementing services anyway, is the plan to add complete Action support after services are available, and can you please clarify if these roadmap items are at all likely to be completed by fall 2022?

I believe they are, I had someone interested in contributing services implementation some time ago, I will check with him. Otherwise I believe we could do that within Robotec team, at least with services for now.