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.

채택된 답변

Hari Krishna Kakarla
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
MAKOTO
MAKOTO 2023년 10월 25일
Thank you!
That work fine.
I just changed installPath such as.
'unity_robotics_demo_msgs/SetModelConfiguration'

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
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
MAKOTO
MAKOTO 2023년 10월 20일
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 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 CenterFile Exchange에서 Publishers and Subscribers에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by