Closed lpacademy0712 closed 2 years ago
![Uploading 2022-01-27 00-09-13屏幕截图.png…]()
![Uploading 2022-01-27 00-09-13屏幕截图.png…]()
Hello, thank you for using ros2-for-unity
!
Did you include source /opt/ROS/foxy/setup.bash
line in ~/.profile
file? If yes - did you restart ubuntu?
If you did not use profile
file, then how did you launch the editor? If you run source /opt/ROS/foxy/setup.bash
in a console then you have to run the editor within the same console or it won't use the sourced variables. To launch editor in console window:
<PATH_TO_UNITY_EDITOR> -projectPath <PATH_TO_PROJECT>
Unity Editor is most commonly installed in ~/Unity/Hub/Editor/<VERSION>/Editor/Unity
.
Also please make sure to restart UnityHub since it holds env variables which were set at the time it was started.
@lpacademy0712 did any of our advice help?
@lpacademy0712 a friendly bump, do you still have issue with this?
Good evening, I'm not the original poster but I'm having a similar problem.
After sourcing ~/ros2_foxy/install/setup.bash
and running the editor from command line and adding an empty object for the Ros2UnityComponent and dragging the Listener and Talker to the Camera and Light objects I do not get anymore the Ros2 sourcing error but instead: Running with a support ROS2 version: foxy
but the talker and listener nodes throw a:
NullReferenceException: object reference not set to an instance of an object: ROS2.ROS2TalkerExample.Update () (at Assets/Ros2ForUnity/Scripts/Ros2TalkerExample.cs:38)
Could you kindly help me out?
Thanks a lot for the code and the help!
@giorgiozannini I'm looking into it :+1:
Thanks a lot!!!
@giorgiozannini Current example scripts require ROS2UnityComponent
to be in the same game object. We can see that this is definitely not optimal, we will change it in a near future.
And indeed, this isn't obvious with the current version of the readme. We will address it. Meanwhile please try to move ROS2UnityComponent
to a game object with examples script (or move them all to one script).
It works! thanks a lot for your help, I wish you a wonderful rest of the day! Giorgio
Glad I could help :smiley:
Closing since the issue is resolved.
I have strictly followed the instructions in readme, and there are no errors reported during the period. However, "no ROS environment sourced." appeared during the initial test Problems. I'm sure I've run "source / opt / ROS / foxy / setup. bash" in the command window. Who can tell me how to operate to avoid such mistakes? I'm a novice, please give me a detailed operation description, thank you!