How do I configure ROS2 for MATLAB R2020a on Ubuntu 18.04?
4 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2020-8-19
编辑: MathWorks Support Team
2024-2-29
I want to be able to work with ROS2 and custom messages in ROS Toolbox R2020a running on Ubuntu 18.04. How do I set this up exactly?
采纳的回答
MathWorks Support Team
2024-2-29
编辑:MathWorks Support Team
2024-2-29
Installation
The following instructions are based on an Ubuntu 18.04 standard desktop installation if you have a 'server' or 'minimal' installation you may need to install additional dependencies manually.
First, install ROS2 Dashing according to the instructions on the ROS website:
This should install most of the ROS2 tools and dependencies that you need.
Secondly, ROS Toolbox R2020a requires Python 3.7 (for custom message support), this will not have been installed by the previous step. To install Python 3.7 and the packages we require execute:
sudo apt install python3.7 python3.7-venv libpython3.7
Further, ROS Toolbox by default assumes the Python 3.7 libraries will have been installed in /usr/lib but the Ubuntu 18.04 packages will install them in /usr/lib/x86_64-linux-gnu. To allow MATLAB to find the correct libraries create the following two symlinks:
sudo ln -s /usr/lib/x86_64-linux-gnu/libpython3.7m.so.1 /usr/lib/libpython3.7m.so.1
sudo ln -s /usr/lib/x86_64-linux-gnu/libpython3.7m.so.1.0 /usr/lib/libpython3.7m.so.1.0
Troubleshooting
1. If you tried using functions like "ros2genmsg" before your environment had been configured entirely you may need to delete the partial virtual environment which has been created, otherwise, you may keep running into issues, even after installing the missing dependencies. For example, you might keep receiving:
Error using ros.ros2.internal.createOrGetLocalPython (line 128)
chmod: cannot access '/home/user/.matlab/R2020a/ros2/python_venv/bin/activate': No such file or directory
Error in ros2genmsg (line 53)
ros.ros2.internal.createOrGetLocalPython(); %ensure python is available
if you tried using ROS Toolbox functionality before having installed python3.7-venv, even after you then later did install this package. To delete the partial virtual environment use:
rm -rf ~/.matlab/R2020a/ros2
2. If you receive the following error:
Error using ros.ros2.internal.createOrGetLocalPython (line 186)
Unknown error occurred.
Error in ros2genmsg (line 53)
ros.ros2.internal.createOrGetLocalPython(); %ensure python is available
as a first step please double-check whether you have correctly created the two symlinks mentioned above. If these have been created and are valid and you still receive this error, please contact support.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Custom Message Support 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!