Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Connection version error for empty handshake.

Discussion in 'Robotics' started by Quique-Martinez, Mar 20, 2023.

  1. Quique-Martinez


    Oct 1, 2013
    Hi all, I run ROS on windows and connect with TCP endpoint v7.0.0, ROS 1.15.9, and Unity 2021.3.12
    Everything was going fine, but suddenly I began to have this error.
    The same setup works perfectly on another PC. I've found that the content of the handshake on line 879 of ROSConnection is empty and the script interprets there is a version error.

    Code (CSharp):
    1.         static async Task ReaderThread(int readerIdx, NetworkStream networkStream, ConcurrentQueue<Tuple<string, byte[]>> queue, int sleepMilliseconds, CancellationToken token)
    2.         {
    3.             // First message should be the handshake
    4.             Tuple<string, byte[]> handshakeContent = await ReadMessageContents(networkStream, sleepMilliseconds, token);
    6.             if (handshakeContent.Item1 == SysCommand.k_SysCommand_Handshake)
    7.             {
    8.                 ROSConnection.m_HasConnectionError = false;
    9.                 queue.Enqueue(handshakeContent);
    10.             }
    11.             else
    12.             {
    13.                 Debug.LogError($"Invalid ROS-TCP-Endpoint version detected: 0.6.0 or older. Expected: {k_Version}.");
    14.             }
    Actually, if I comment these lines as if the handshake was correct, I can send and receive the messages. Is it a known issue? I haven't found info about it.

  2. ActiveSim


    May 10, 2019
    Yes your Unity-ROS-bridge has not the same version as the ROS-TCP endpoint you are using in the editor. Did you made an update on any side?
  3. Quique-Martinez


    Oct 1, 2013
    As I mentioned, the empty handshake content is triggering this error, but the version is the right one on both sides. The same code works perfectly on another machine.
    Btw, despite this error, I receive messages from the TCP endpoint in Unity, but I cannot send them.