Error : Dot indexing is not supported for variables of this type. 【MATLAB ROS Unity】

4 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

Hari Krishna Kakarla
Hari Krishna Kakarla am 25 Okt. 2023
Bearbeitet: Walter Roberson am 25 Okt. 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

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 20 Okt. 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 Kommentare
MAKOTO
MAKOTO am 20 Okt. 2023
Thanks for your answer.
Isn’t it enough to install these three toolboxes?
  • Robotics System Toolbox
  • Stateflow
  • ROS Toolbox
I just want to make sure helperConnectROSUnity; can be done.
Is there anything I should do?
Walter Roberson
Walter Roberson am 20 Okt. 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.)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Publishers and Subscribers finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by