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.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Resolved Problem importing custom ROS msgs

Discussion in 'Robotics' started by d_pepley, Feb 3, 2022.

  1. d_pepley


    Oct 2, 2020

    I am having issues with important customer msgs and srvs for ROS2. This issue only appeared recently. Basically, I go through the process outlined in

    In my xml file I have the package named ros_test. So everything appears fine at first. I get a RosMessage folder that contains RosTest/srv and RosTest/msg. The files are also recognized by my C# scripts for when I go to use the new msg types.

    However, when I go to actually run the simulation I get the following error:
    SysCommand.publish - Unknown message class 'ros_test/Vector3'
    UnityEngine.Debug:LogError (object)
    Unity.Robotics.ROSTCPConnector.ROSConnection:ReceiveSysCommand (string,string) (at Library/PackageCache/com.unity.robotics.ros-tcp-connector@c27f00c6cf/Runtime/TcpConnector/ROSConnection.cs:680)
    Unity.Robotics.ROSTCPConnector.ROSConnection:Update () (at Library/PackageCache/com.unity.robotics.ros-tcp-connector@c27f00c6cf/Runtime/TcpConnector/ROSConnection.cs:587)

    I was not getting this error when I did testing with this a month ago. It seems to be looking for a class called ros_test, that it can't find.

    Can anyone help with this? It's become a major issue for me.
    I also attempted to upgrade to ROSTCPConnector and Ednpoint 0.7 from 0.6. Had the issue in both versions.
  2. d_pepley


    Oct 2, 2020
    So I have found a solution to this error. It actually has to do with the ROS2 module, not Unity. Basically, the msg I was trying to create was left out of my CMakeBuild list. So as a result, the Ros2Endpoint server was not able to find this message type.

    So steps to fix if you receive the error in Unity "unknown message class '<your class name'" is
    Go you your ROS2 package, double check that you have included your message in the CMakeList
    Rebuild the package with colcon build.
    Resource the package.
    Now run your Ros2endpoint and things should be working properly
    cpereira and panserzap like this.