在JetsonNX 中使用ROS错误集(持续更新...)

1. 运行rosmsg show 后缺少模块Crytodome

nx@nx-desktop:~$ rosmsg show std_msgs/String
Traceback (most recent call last):
  File "/opt/ros/melodic/bin/rosmsg", line 35, in <module>
    rosmsg.rosmsgmain()
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rosmsg/__init__.py", line 7                                54, in rosmsgmain
    sys.exit(rosmsg_cmd_show(ext, full, command))
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rosmsg/__init__.py", line 5                                82, in rosmsg_cmd_show
    import rosbag
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/__init__.py", line 3                                3, in <module>
    from .bag import Bag, Compression, ROSBagException, ROSBagFormatException, R                                OSBagUnindexedException
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbag/bag.py", line 53, in                                 <module>
    from Cryptodome.Cipher import AES
ModuleNotFoundError: No module named 'Cryptodome'

解决:安装模块 Cryptodome
pip install pycryptodome

2. 调用PaddleHub时报错

这是由于Paddle 必须运行在Pathon3里,而Ros默认的Python版本是2,导致运行报错,必须 把系统的版本设置为python3.
参考:Ubuntu16.04下完美切换Python版本

使用 update-alternatives 来为整个系统更改Python 版本,先用语句把python版本加到列表中

# update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in auto mode
# update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2
update-alternatives: using /usr/bin/python3.4 to provide /usr/bin/python (python) in auto mode

接下来,我们再次列出可用的 Python 替代版本。

# update-alternatives --list python
/usr/bin/python2.7
/usr/bin/python3.5

现在开始,我们就可以使用下方的命令随时在列出的 Python 替代版本中任意切换了。

# update-alternatives --config python

接下来,我们再次列出可用的 Python 替代版本。

# update-alternatives --list python
/usr/bin/python2.7
/usr/bin/python3.5

现在开始,我们就可以使用下方的命令随时在列出的 Python 替代版本中任意切换了。

3.引用cv_bridge时提示没有 ‘/usr/include/opencv’

-- +++ processing catkin package: 'classifier_scene'
-- ==> add_subdirectory(classifier_scene)
CMake Error at /opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake:113 (message):
  Project 'cv_bridge' specifies '/usr/include/opencv' as an include dir,
  which is not found.  It does neither exist as an absolute directory nor in
  '${{prefix}}//usr/include/opencv'.  Check the issue tracker
  'https://github.com/ros-perception/vision_opencv/issues' and consider
  creating a ticket if the problem has not been reported yet.

由于我安装的是opencv4,目录 为 /usr/include/opencv4
所以只能修改cv_bridgeConfig.cmake文件里的路径 ,

sudo vim /opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake

把94行的路径修改下:

if(NOT "include;/usr/include;/usr/include/opencv4 " STREQUAL " ")
  set(cv_bridge_INCLUDE_DIRS "")
  set(_include_dirs "include;/usr/include;/usr/include/opencv4")
  if(NOT "https://github.com/ros-perception/vision_opencv/issues " STREQUAL " ")

你可能感兴趣的:(ROS,机器学习)