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

1 回表示 (過去 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 Center および File ExchangePublishers and Subscribers についてさらに検索

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by