Unity-Technologies / Unity-Robotics-Hub

Central repository for tools, tutorials, resources, and documentation for robotics simulation in Unity.
Apache License 2.0
2.05k stars 423 forks source link

TCP connection failed in Unity in Pick and Place Tutorial—part 2 (using docker) #384

Open owlmoo opened 2 years ago

owlmoo commented 2 years ago

Describe the bug I follow the instruction to set up the docker and unity. However, when I hit play, I cannot build the connection. In unity, it reports "Connection to 127.0.0.1:10000 failed" and "The remote host forcibly closed an existing connection".

trouble

“远程主机强迫关闭了一个现有的连接” means "The remote host forcibly closed an existing connection".

To Reproduce In the ros side, I just source the setup.bash and run the part2.launch(roslaunch niryo_moveit part_2.launch). In the unity side, I just follow the instuction and hit play. rossettings unitysettings

Console logs / stack traces

Connection to 127.0.0.1:10000 failed - System.IO.IOException: Unable to write data to the transport connection: 远程主机强迫关闭了一个现有的连接。 UnityEngine.Debug:Log (object) Unity.Robotics.ROSTCPConnector.ROSConnection/<ConnectionThread>d__115:MoveNext () (at Library/PackageCache/com.unity.robotics.ros-tcp-connector@c27f00c6cf/Runtime/TcpConnector/ROSConnection.cs:854) System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()

Environment (please complete the following information, where applicable):

owlmoo commented 2 years ago

I transformed the ros part to another machine(ubuntu 20.04) and everything worked fine, but I still want to run on docker..

sergiosolorzano commented 1 year ago

Hi @owlmoo I could run ubuntu connection on v.18.04 but when I upgraded to 20.04 it fails. (note - I upgraded to 20.04 after seeing you post because in my case Unity doesn't connect)

In the tutorial I enter command: roslaunch niryo_moveit part_2.launch I get: server_endpoint-2] restarting process process[server_endpoint-2]: started with pid [27240] /usr/bin/env: ‘python’: No such file or directory [server_endpoint-2] process has died [pid 27240, exit code 127, cmd /home/sergio/IoT/Unity-Robotics-Hub/tutorials/pick_and_place/ROS/src/ros_tcp_endpoint/src/ros_tcp_endpoint/default_server_endpoint.py --wait __name:=server_endpoint __log:=/home/sergio/.ros/log/9fa2e58c-7e33-11ed-831c-cd67f84396f1/server_endpoint-2.log]. log file: /home/sergio/.ros/log/9fa2e58c-7e33-11ed-831c-cd67f84396f1/server_endpoint-2*.log

Did you have a problem in 20.04 when using python3? I read Ubuntu 20.04 uses python3 and I'm wondering if the ros packages prepared by unity are for python2 and would only run on Ubuntu 18.04.

owlmoo commented 1 year ago

@sergiosolorzano Hi, I have this problem too, ros noetic support python3, and I just re-link the python interpreter using : sudo ln -s /usr/bin/python3 /usr/bin/python