MATLAB2020b/ROS interface - Unrecognized function or variable 'pythonPkgSrc'

4 visualizaciones (últimos 30 días)
Hi,
I am running a MATLAB2020b on my Ubuntu 18.04 and I am trying to get started on a matlab/ros interface. I am using the Melodic ROS package.
When I run "rosinit" the first time on a freshly installed matlab I get the expected result:
The value of the ROS_MASTER_URI environment variable, http://localhost:11311, will be used to connect to the ROS master.
Launching ROS Core...
Creating a Python virtual environment...Done.
Adding required Python packages to virtual environment....Done.
...................................................Done in 1.9581 seconds.
Initializing ROS master on http://10.0.2.15:11311.
Initializing global node /matlab_global_node_25466 with NodeURI http://juheon-VB:38603/
However, when I try to run "rosgenmsg", I get the following message:
Identifying message files in folder '/home/juheon/catkin_float/src'..Done.
Adding required Python packages to virtual environment..Done.
Unrecognized function or variable 'pythonPkgSrc'.
Error in ros.internal.createOrGetLocalPython (line 204)
cmd2ToRun = ['bash -c ''PATH=$PATH:' fileparts(pyexec) ' ; ' replace(activatePath,' ','\ ') ' ; '
libpathadd ' ' replace(localPythonPath,' ','\ ') ' -m pip install --no-index --force-reinstall
--find-links=' replace(pythonPkgSrc,' ','\ ') packagesToInstall ' netifaces'''];
Error in rosgenmsg (line 86)
ros.internal.createOrGetLocalPython(); %ensure python is available
Error in rosgenmsg_test (line 2)
rosgenmsg(dir)
And then, if I try to run "rosinit" again:
The value of the ROS_MASTER_URI environment variable, http://localhost:11311, will be used to connect to the ROS master.
Launching ROS Core...
Adding required Python packages to virtual environment..Done.
Unrecognized function or variable 'pythonPkgSrc'.
I've tried multiple reinstalls but the problem persists.
I've narrowed the problem down to matlab or python missing "catkin_pkg", but even after I installed it with "sudo apt" or "pip" the error does not go away.
I am literally at the end of my ropes with this problem and I would approciate any help.

Respuestas (6)

Stefan Kubica
Stefan Kubica el 21 de Oct. de 2020
Hello all,
I have also the same problem with Matlab2020b on a Windows 10 System.
Any help would be very appreciated, too ;-)
Thanks a lot!
SK
pyenv
ans =
PythonEnvironment with properties:
Version: "2.7"
Executable: "C:\Python27\python.EXE"
Library: "C:\Windows\system32\python27.dll"
Home: "C:\Python27"
Status: NotLoaded
ExecutionMode: InProcess
>> rosgenmsg(folderpath)
Identifying message files in folder 'C:/Users/XXX/OneDrive/Dokumente/MATLAB/custom_msgs/packages'..Done.
Adding required Python packages to virtual environment..Done.
Unrecognized function or variable 'pythonPkgSrc'.
Error in ros.internal.createOrGetLocalPython (line 193)
cmd2ToRun = ['"' activatePath '" && "' localPythonPath '" -m pip install --no-index --force-reinstall
--find-links="' pythonPkgSrc '"' packagesToInstall];
Error in rosgenmsg (line 86)
ros.internal.createOrGetLocalPython(); %ensure python is available

Miguel Pimentel
Miguel Pimentel el 13 de Oct. de 2020
Editada: Miguel Pimentel el 13 de Oct. de 2020
Hello,
I have the same problem. I installed the R2020b version because the 'rosgenmsg' function was finally incorporated into ROS toolbox. However, after running 'rosgenmsg' I started having the same output error and now I can't even start a ROS master from matlab. I checked that I have the correct python version '2.7' , as showed below.
I am also using Ubuntu 18.04 with ROS Melodic and Gazebo 9.
Any help would be very appreciated.
Thank you!
>> rosinit
Launching ROS Core...
Adding required Python packages to virtual environment..Done.
Unrecognized function or variable 'pythonPkgSrc'.
>> pyenv
ans =
PythonEnvironment with properties:
Version: "2.7"
Executable: "/usr/bin/python"
Library: "libpython2.7.so.1.0"
Home: "/usr"
Status: NotLoaded
ExecutionMode: InProcess

Gabriel Laupre
Gabriel Laupre el 22 de Oct. de 2020
Editada: Gabriel Laupre el 22 de Oct. de 2020
I have exactly the same error..
help please, I'm stuck here..
> rosgenmsg
Identifying message files in folder '/home/...mavros_msgs/msg'..Done.
Adding required Python packages to virtual environment..Done.
Unrecognized function or variable 'pythonPkgSrc'.
Error in ros.internal.createOrGetLocalPython (line 204)
cmd2ToRun = ['bash -c ''PATH=$PATH:' fileparts(pyexec) ' ; ' replace(activatePath,' ','\ ') ' ; ' libpathadd ' ' replace(localPythonPath,' ','\ ') ' -m pip install --no-index
--force-reinstall --find-links=' replace(pythonPkgSrc,' ','\ ') packagesToInstall ' netifaces'''];
Error in rosgenmsg (line 86)
ros.internal.createOrGetLocalPython(); %ensure python is available

Stefanie Schwarz
Stefanie Schwarz el 5 de Nov. de 2020
Editada: Stefanie Schwarz el 5 de Nov. de 2020
MathWorks is aware of this bug, please bear with us while we are creating an official bug report and try to ship a fix for this ASAP.
  1 comentario
Chude Qian
Chude Qian el 7 de Nov. de 2020
To fix the issue:
tested on Ubuntu 16.04, edit the following file as sudoer:
/usr/local/MATLAB/R2020b/toolbox/ros/mlroscpp/util/+ros/+internal/createOrGetLocalPython.m
Note at about line 182, before line
if ~foundCatkin
add
pythonPkgSrc = fullfile(matlabroot,'sys','ros1','share','python');
then restart matlab, it should work.
To developer: The issue is that the variable pythonPkgSrc is only declared in the scope of venv, not everywhere. which leads the issue. It seems that we are trying to use a specific wheel for netifaces not sure why...

Iniciar sesión para comentar.


Cam Salzberger
Cam Salzberger el 17 de Nov. de 2020
Hello all,
Here is the bug report published for this issue. This issue is fixed in R2020b Update 2, so installing that or later versions should resolve the issue.
-Cam
  1 comentario
Anton Deguet
Anton Deguet el 23 de Nov. de 2020
I have mixed feelings about the fix. On one hand it seems the variable pythonPkgSrc is properly defined but now the script to generate custom messages requires CMake 3.15.5. I expect most users of ROS 1 will stick to LTS Ubuntu including 18.04 and maybe be even 16.04. To note, on 18.04, the default CMake is 3.10.2. If there was a true dependency to 3.15.5, I would understand why I would have to force users to install a new version of CMake but I'm not convinced older versions of CMake wouldn't work fine.
As a quick test, I edited the file toolbox/ros/mlroscpp/+ros/+internal/+CatkinBuilder.m and changed the minimum CMake version required to 3.10.0. I was then able to use the command rosgenmsg without any issue.
Bottom line, if possible, it would be nice to lower the minimum CMake requirements so users don't have to go through extra steps.

Iniciar sesión para comentar.


Anton Deguet
Anton Deguet el 28 de Oct. de 2020
Same issue on me end, both rosinit and rosgenmesg fail with Ubuntu 2020b on Ubuntu 18.04 with ROS Melodic installed.
The following configurations work:
  • 2020a with Ubuntu 18.04 and ROS Melodic
  • 2020b with Ubuntu 20.04 and ROS Noetic
See some notes I saved for rosgenmsg:

Categorías

Más información sobre Publishers and Subscribers en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by