Error : Dot indexing is not supported for variables of this type. 【MATLAB ROS Unity】
4 次查看(过去 30 天)
显示 更早的评论
Hello. I’m trying to do this tutorial for MATLAB Unity communication.
But I got an error when I run this script.
helperConnectROSUnity;
Error message is below
Dot indexing is not supported for variables of this type.
Error in helperConnectROSUnity (line 16)
installPath = reg.getServiceInfo('unity_robotics_demo_msgs/SetModelConfiguration').installDir;
==Development environment==
OS:Windows10
MATLAB:R2022b
I cant find any solutions.
Any kind of help will be appreciated. Thank you.
0 个评论
采纳的回答
Hari Krishna Kakarla
2023-10-25
编辑:Walter Roberson
2023-10-25
Hi MAKOTO,
Thanks for reaching out to us. To establish the connection between MATLAB and Unity, Instead of running the script helperConnectROSUnity, I suggest you to please run the following commands in MATLAB command window:
pyFile = ['"' fullfile(matlabroot,'sys','ros1',computer('arch'),...
'ros1','lib','site-packages','ros_tcp_endpoint','default_server_endpoint.py') '"'];
pathToShellOrBATFile = ['"' fullfile(pwd,'unity_setup.bat') '"'];
execCmd = ['title ' 'UnitySetup' ' && ' pathToShellOrBATFile ' ' installPath ' ' pyFile '&'];
[status,msg] = ros.internal.runroscmd(execCmd);
The error message that you are getting currently is complaining about a custom message being not present. Creation of that custom messages is listed in the above steps in the example. But those all things may not be required for your case.
So, please just execute the above commands as I gave you above. That should work fine. Please let me know if you have any questions.
Thanks
Hari
更多回答(1 个)
Walter Roberson
2023-10-20
reg.getServiceInfo('unity_robotics_demo_msgs/SetModelConfiguration') is returning empty -- you either did not involve the ROS support package or it did not get installed correctly.
2 个评论
Walter Roberson
2023-10-20
It appears that there are a number of Unity related steps to set up as well. I am not willing to do those on my systems (not interested in getting an account with them for example.)
Meanwhile when I tried running the example, I got
Error using ros.internal.ROSEnvironment/createVenv
Unable to create Python virtual environment. System command returned: zsh:1: no matches found: /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python*-config
.
Error in ros.internal.ROSEnvironment/checkAndCreateVenv (line 139)
createVenv(obj,pythonExe,venvRoot,rosVersion,...
Error in ros.internal.createOrGetLocalPython (line 52)
checkAndCreateVenv(rosEnv,'ros1',forceRecreateVenv);
Error in rosgenmsg (line 197)
ros.internal.createOrGetLocalPython(); %ensure python is available
and sure enough, there are no python*config files anywhere relevant under my /Library directory (MacOS) (There is one under /Library/Frameworks/Maple.framework which is for a different software package.)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Publishers and Subscribers 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!