Can't estabilish connection between ROS and Unity

Hi everyone,

I’m trying to estabilish a connection between ROS and unity using GitHub - Unity-Technologies/ROS-TCP-Connector . I’ve followed the tutorial steps in Unity-Robotics-Hub/tutorials/ros_unity_integration/README.md at main · Unity-Technologies/Unity-Robotics-Hub · GitHub but after installing the package ros-tcp-connector package via git url in unity (2021.1.6f1) I’m not able to set UNITY_IP for connection. When I open Robotics → Ros Settings in unity I haven’t option to override/set it.

Attached photo of Robotics → Ros Settings window:
7239527--871697--Captura de pantalla de 2021-06-11 13-50-31.png
For more information I’m trying to connect an urdf charged Baxter Robot in unity and using ROS noetic. Thanks in advance.

Hi!

I’m working on a similar task with the Kuka Iiwa and got similar problems.
Concerning your question: I think that they removed the “Override Unity Address” textfield in version 0.4.0. I’m not sure what exactly it does and why they removed it, I remember that I’ve read about it.

You can try the older one but that didn’t work for me either:
If you already tried the pick&place tutorial, you can find the 0.3.0 version at:

pick_and_place\Unity-Robotics-Hub\tutorials\pick_and_place\PickAndPlaceProject\Library\PackageCache\com.unity.robotics.ros-tcp-connector@8ee9d5c391

You can simply import it with the package manager by selecting “Add package from disk” and selecting the package.json.
It will import the older version where you should find the textfield.

For now I got the pick&place tutorial communicating with my ROS-VM using the 0.3.0 ROS-TCP-Connector, but currently I’m failing to establish a connection in a custom project.
Are you using a virtual machine or are you using docker?

We can stay in conctact, if we get any further

Yes, UNITY_IP and the “Override Unity IP” setting have been removed as of 0.4.0 - they’re no longer necessary, we just use one TCP connection now (from Unity to the ROS endpoint) so we don’t need a separate IP address for Unity to listen on.

I’m not sure what version of the instructions you’re following, but the page you linked to does not mention them. :slight_smile:

If you’re having trouble getting the connection to work, I’d start by making sure your ros-tcp-endpoint and ros-tcp-connector package are both on version 0.4.0. If that’s all ok, please provide more details about your setup and what results you’re getting, hopefully we can help.

First of all, thanks for anwering guys.
As Laurie says, it looks like I don’t have to use the Override Unity IP using the newest version of the package and I think I don’t understand how the connection takes place so. Both packages are in their more recent version.

I’m running unity in the same machine as ROS in Ubuntu 20, without docker. First, I’ve run “roslaunch src/ROS-TCP-Endpoint-main/launch/endpoint.launch” specifyng: ROS_IP: 127.0.0.1 and ROS_TCP_PORT: 10000 for having the ROS-side connection. In Unity the configuration is shown in the first post.

I think I’m losing some small details. Thanks in advance!

Ok, so to fill you in, the connection is just a standard TCP socket connection: the ROS-TCP-Endpoint listens on the specified IP and port, and Unity connects to it.

If they’re both running on the same machine the setup you described sounds like it should work fine. What happens when you press Play in Unity? Do you see the ROS Connection hud in the top left corner of the game window?

The uploaded image shows what I see when I press the play button. In the image you can’t see Baxter robot because it falls down (another error I have to solve next). Endpoint node doesn’t show anything appart from the first message of initialization:
[INFO] [1624108390.486068]: Starting server on 127.0.0.1:10000

@xdavidheredia99 , it looks like you’re missing something in your Unity scene hierarchy that will actually instantiate the ROSConnection, i.e. something that will call ROSConnection.instance. You can view the ROS Publisher example for reference, or the Pick-and-Place demo (Part 2) for more information on this connection setup. Modifying your ROS Settings should create a ROSConnectionPrefab in your project’s Assets/Resources, and calling upon the ROSConnection.instance should instantiate this prefab in your scene on runtime.

1 Like

Thanks for answering Amanda.
You were right, I had to instance the Ros Connection and, for some reason, I thought that It will work without doing it. Now, after the tutorials, I understand how it works. I’ll continue trying to connect baxter and unity.
Thanks again!