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

Cannot connect to roscore.

Discussion in 'Robotics' started by EvilGia, Mar 28, 2023.

  1. EvilGia

    EvilGia

    Joined:
    Jul 4, 2012
    Posts:
    4
    Hi,

    Relatively New to ROS.
    Im trying to connect to my roscore through unity but i keep getting::

    Connection to 192.168.50.3:11311 failed - System.IO.IOException: Unable to write data to the transport connection: An established connection was aborted by the software in your host machine.

    I was able to connect before using localhost but after changing my ip address I could not. Worse reverting back to localhost cause the same issue.

    I am currently running in windows and able to run
    c:\catkin_ws\devel\setup.bat && roslaunch ros_tcp_endpoint endpoint.launch
    successfully and able to see Unity connect to it before.

    Not sure where I have gone wrong but im sure its a stupid mistake I make somewhere.

    Thanks in advance
     
    Last edited: Mar 28, 2023
  2. Envilon

    Envilon

    Joined:
    Aug 8, 2020
    Posts:
    55
    Hi there! Although I don't know what the problem might be at the moment, here are some questions that might help me understand your problem. :)

    How do you run ROS? Are you running it directly in Windows, from docker, or on a Virtual Machine?
    Are you trying to use ROS 1 or ROS 2?
    Is the exception from ROS TCP Connector in Unity?
    Where did the IP address come from?
    Did you change the setup somehow before switching from localhost to that IP address?
     
  3. EvilGia

    EvilGia

    Joined:
    Jul 4, 2012
    Posts:
    4
    Hi Thanks for replying

    How do you run ROS? Are you running it directly in Windows, from docker, or on a Virtual Machine?
    Are you trying to use ROS 1 or ROS 2?

    • Im running directly from Windows noetic ROS1 .

    Is the exception from ROS TCP Connector in Unity?

    • Yes. I got the error from Unity.

    Where did the IP address come from?

    • The IP address is set in the IPV4 Settings for my Ethernet Port. I set the ROS_IP = 192.168.50.3 and ROS_MASTER_URI to be http://192.168.50.3:11311. Also in Unity I set the ROS IP Address to be 192.168.50.3 and ROS Port to be 11311. ROSCOMPA is set to 192.168.50.3 in my host file.
    UNity ROS Setup.png
    Did you change the setup somehow before switching from localhost to that IP address?

    • I only change the IP Address after i confirm localHost is working first and connecting to my switch.
    Also I installed XAMPP Client and check that only python.exe has the address and port. Also disabled all firewalls to ensure that it is not a factor.

    Appreciate that you take the time to look into my problem.

    UNity Error Msg.png
     
    Last edited: Mar 29, 2023
  4. EvilGia

    EvilGia

    Joined:
    Jul 4, 2012
    Posts:
    4
    [Solved]
    Hi All,

    Solve my problem.

    I was misled by this statement::

    Note, By default, the server_endpoint will listen on ip 0.0.0.0 (i.e. allowing all incoming addresses) and port 10000, but these settings are configurable. To override them, you can change the command to roslaunch ros_tcp_endpoint endpoint.launch tcp_ip:=127.0.0.1 tcp_port:=10000 (obviously replacing 127.0.0.1 with your desired IP and 10000 with your desired port number.)

    It is necessary to specify the tcp_ip and tcp_port in order for the connection to work else U will get the above error.
     
    Envilon likes this.