Error : Dot indexing is not supported for variables of this type. 【MATLAB ROS Unity】
4 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Hari Krishna Kakarla
on 25 Oct 2023
Edited: Walter Roberson
on 25 Oct 2023
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
More Answers (1)
Walter Roberson
on 20 Oct 2023
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 Comments
Walter Roberson
on 20 Oct 2023
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.)
See Also
Categories
Find more on Publishers and Subscribers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!