Error in building custom ros messages

17 ビュー (過去 30 日間)
Mustafa Sezer
Mustafa Sezer 2022 年 4 月 7 日
コメント済み: Cristian Chitiva 2022 年 5 月 4 日
Hello, i am trying to communicate with ros by using my custom messages. I'm currently using ROS1 Melodic. I saw that there is a function called rosgenmsgs and i tried to build my custom messages with
rosgenmsg("/home/msezer/catkin_ws/src/cust_msgs")
However, i got the following error,
Error using ros.internal.createOrGetLocalPython
Could not find Python version 3.9 on your system. Use pyenv function to set the path to the Python 3.9 executable.
Then i installed the Python 3.9 and gave the executable path by using
pyenv('Version','/usr/bin/python3.9')
After calling the function rosgenmsg, i get the following error.
Error using ros.internal.createOrGetLocalPython
chmod: cannot access '/home/msezer/.matlab/R2022a/ros1/glnxa64/venv/bin/activate': No such file or directory
Error in rosgenmsg (line 88)
ros.internal.createOrGetLocalPython(); %ensure python is available
I've already check the path and there is no activate folder or file. I use Ubuntu 18.04. What could be the reason for this problem?
Thank you

採用された回答

Alexandre Lamarre
Alexandre Lamarre 2022 年 4 月 7 日
編集済み: Alexandre Lamarre 2022 年 4 月 7 日
I had the same problem since I update Matlab to 2022a. It seem that you have to create a Python venv environment in your ‘/home/msezer/.matlab/R2022a/ros1/glnxa64/venv/’ folder.
To achieve that, navigate to your ‘/home/msezer/.matlab/R2022a/ros1/glnxa64/venv/’ folder and delete everything in it. Then in a terminal, create a python venv environment with the following command:
$ python3 -m venv [Directory of your venv folder]
It will create the environment and you should be able to generate yours custom ROS message. It worked for me.
Regard,
Alexandre
  3 件のコメント
Pin-Hsuan Huang
Pin-Hsuan Huang 2022 年 4 月 11 日
Hello Mustafa Sezer, thank you for your answer. I had the same problem and it is solved just as you suggested. Thank you very much!
Cristian Chitiva
Cristian Chitiva 2022 年 5 月 4 日
thank you, also works for me

サインインしてコメントする。

その他の回答 (1 件)

Josh Chen
Josh Chen 2022 年 4 月 7 日
Hello Mustafa,
Looking at the error message, it seems that the python virtual environment was not been created properly. Could you please try to create the python virtual environment again with the following command and see if that works?
>> ros.internal.createOrGetLocalPython(true);
Thanks,
Josh
  1 件のコメント
Mustafa Sezer
Mustafa Sezer 2022 年 4 月 11 日
I tried it but i still got an error. I could solve my issue with the solution above. Thank you for your time

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCustom Message Support についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by