RobotecAI / ros2cs

A C# (.Net) implementation of ros2 client library (rcl), enabling communication between ros2 ecosystem and C#/.Net applications such as Unity3D
Apache License 2.0
91 stars 22 forks source link

ROS2 version in 'ros2cs' metadata doesn't match currently sourced version. This is caused by mixing versions/builds. Plugin might not work correctly. #51

Closed yangming517 closed 1 year ago

yangming517 commented 1 year ago

https://github.com/RobotecAI/ros2-for-unity

I followed the official tutorial ,after achieving topics ''Add ROS2TalkerExample.cs script to the very same game object. Add ROS2ListenerExample.cs script to the very same game object.''

I started the project in Unity, Unity reported several errors as follows,i didn't see two nodes talking with each other in Unity Editor's console 。 微信图片_20230516172400

the main error is ''ROS2 version in 'ros2cs' metadata doesn't match currently sourced version. This is caused by mixing versions/builds. Plugin might not work correctly.''

My ROS2 is humble ,Linux is Ubuntu 22.04.Unity is 2021.6.24f1 personal

pijaro commented 1 year ago

Hello,

It looks like you have ROS 2 sourced in your environment and that version doesn't match the build version of Ros2ForUnity in the editor. Try to run the editor in a clean terminal (make sure the ROS 2 is not sourced) and try again.

yangming517 commented 1 year ago

hello ,I did have ROS2 sourced by adding 'source /opt/ros/humble/setup.bash' in ~/.bashrc. But now I removed this line of code from ~/.bashrc. Then in a clean terminal,I input 'unityhub'.And the Unityhub is opened .And in the unityhub,I start my project. The error still exist. Looking forward to your reply.

yangming517 commented 1 year ago

Hello,

It looks like you have ROS 2 sourced in your environment and that version doesn't match the build version of Ros2ForUnity in the editor. Try to run the editor in a clean terminal (make sure the ROS 2 is not sourced) and try again.

hello ,I did have ROS2 sourced by adding 'source /opt/ros/humble/setup.bash' in ~/.bashrc. But now I removed this line of code from ~/.bashrc. Then in a clean terminal,I input 'unityhub'.And the Unityhub is opened .And in the unityhub,I start my project. The error still exist. Looking forward to your reply.

pijaro commented 1 year ago

Have you built your own binaries or used one of the Ros2ForUnity releases? Also, which version are you using, overlay or standalone?

(I assumed standalone, therefore asked for "clean" terminal. If you are using overlay, then of course you need to source the appropriate version)

You can also try to run the editor from the clean terminal because running the editor from unity hub might also be the cause (change the editor and project path):

~/Unity/Hub/Editor/2021.6.24f1/Editor/Unity -projectPath <PATH_TO_PROJECT>
yangming517 commented 1 year ago

Have you built your own binaries or used one of the Ros2ForUnity releases? Also, which version are you using, overlay or standalone?

(I assumed standalone, therefore asked for "clean" terminal. If you are using overlay, then of course you need to source the appropriate version)

You can also try to run the editor from the clean terminal because running the editor from unity hub might also be the cause (change the editor and project path):

~/Unity/Hub/Editor/2021.6.24f1/Editor/Unity -projectPath <PATH_TO_PROJECT>

I don't know what's the meaning of 'built your own binaries or used one of the Ros2ForUnity releases? But in the section of ROS2cs,there is a test. In the terminal.I run ros2 run ros2cs_examples ros2cs_talker ros2 run ros2cs_examples ros2cs_listener And it seems everything is ok. In the terminal ,It shows
hello world 1 hello world 2 ...... Then the version I use is overlay. At last ,I run the editor from the clean terminal. ~/Unity/Hub/Editor/2021.3.24f1/Editor/Unity -projectPath ~/My project This method is not applicable and the error is still exist ,regardless of whether this sentence 'source /opt/ros/humble/setup.bash' is removed from the '~/.bashrc' or not.

yangming517 commented 1 year ago

It works well after I follow the tutorial in a dual system.I guess there probably is something wrong with the vm‘s Graphics card.