RobotecAI / ros2-for-unity

High-performance ROS2 solution for Unity3D
Apache License 2.0
446 stars 58 forks source link

Release 1.2.0 did not work on my PC #64

Open samiamlabs opened 1 year ago

samiamlabs commented 1 year ago

Describe the bug 1.2.0 does not seem to work for me on Linux 22.04 and Unity 2021.3.2 (LTS). It looks like it was an overlay release so I installed humble using apt-get on my computer and started the editor from a terminal where I already sourced ROS2 humble.

To Reproduce Steps to reproduce the behavior:

  1. Start with a computer with Ubuntu 22.04
  2. Make a fresh project in Unity 2021.3.2
  3. Download Ros2ForUnity_humble_ubuntu2204.zip
  4. Open a terminal and run source /opt/ros/humble/setup.bash
  5. Open the Unity editor in the same terminal by writing, for example, Unity/Hub/Editor/2021.3.20f1/Editor
  6. Add a ROS2 Unity Component script to an emtpy GameObject.

Expected behavior No errors

Screenshots image

Desktop (please complete the following information):

pijaro commented 1 year ago

Can you verify that the ROS_DISTRO is set to humble and the /opt/ros/humble/lib is in LD_LIBRARY_PATH after sourcing the ROS 2?

env | grep ROS_DISTRO
env | grep LD_LIBRARY_PATH
samiamlabs commented 1 year ago
sam@sam-blade:~$ env | grep ROS_DISTRO
ROS_DISTRO=humble

sam@sam-blade:~$ env | grep LD_LIBRARY_PATH
LD_LIBRARY_PATH=/opt/ros/humble/opt/rviz_ogre_vendor/lib:/opt/ros/humble/lib/x86_64-linux-gnu:/opt/ros/humble/lib
zp-yang commented 1 year ago

How did you import the .zip package to unity? I tried to renaming it .unitypackage but got an error for couldn't decompress. I tried decompressing the zip and drag the two folders into an empty project still doesn't seem to work.

Edit: Actually nvm I figured it out but I am also have the same problem as @samiamlabs with ros2 humble

adamdbrw commented 1 year ago

As a quick solution, you might look for the check that outputs this message and disable the check. If the check is invalid and not a symptom of some mismatch, this should be enough. We will be looking into it next week.

pijaro commented 1 year ago

As @adamdbrw mentioned, try to check the versions which are detected by Ros2ForUnity by adding debug log to Ros2ForUnity/Scripts/ROS2ForUnity.cs somewhere in the if statement in line 180:

Debug.Log("Sourced: " + ros2SourcedCodename + ". From metadata: " + ros2FromRos2csMetadata);

Logged ROS 2 versions should be the same and not empty. If it is not the case, then there might be an issue with path resolution.

Can you also make sure that Ros2ForUnity folder lives inside project Assets?:

Assets/
└── Ros2ForUnity
    ├── Plugins
    │   └── Linux
    │       └── x86_64
    └── Scripts
        └── Time
rahulswa08 commented 1 year ago

Same happened with me then I tried running the Unity from terminal as shown below and it worked.

https://github.com/RobotecAI/ros2-for-unity/issues/32#issuecomment-1023981776