小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
如何使用roslaunch 调用不同工作空间的功能包?
-
@空白 目前我所知道比较好的办法就是你提到的这两个,当然还有其他办法,比如讲某个常用但是不需要更改的功能包安装到系统的目录——/opt/ros。
使用指令
sudo colcon build --merge-install --install-base /opt/ros/humble/
- 加sudo增加管理员权限
--merge-install
用于合并安装,不让一个包在一个单独目录--install-base /opt/ros/humble/
将安装地址从install修改到系统的ros目录下
测试步骤
fishros@DESKTOP-5RDMRLE:/mnt/d/Code/GitHub/yolov5_ws$ sudo colcon build --merge-install --install-base /opt/ros/humble/ Starting >>> yolov5_ros2 [0.339s] WARNING:colcon.colcon_ros.task.ament_python.build:Package 'yolov5_ros2' doesn't explicitly install a marker in the package index (colcon-ros currently does it implicitly but that fallback will be removed in the future) --- stderr: yolov5_ros2 /usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( --- Finished <<< yolov5_ros2 [0.92s] Summary: 1 package finished [1.03s] 1 package had stderr output: yolov5_ros2 fishros@DESKTOP-5RDMRLE:/mnt/d/Code/GitHub/yolov5_ws$ ros2 pkg list | grep yolo yolov5_ros2 fishros@DESKTOP-5RDMRLE:/mnt/d/Code/GitHub/yolov5_ws$ ros2 pkg prefix yolov5_ros2 /opt/ros/humble fishros@DESKTOP-5RDMRLE:/mnt/d/Code/GitHub/yolov
-
@小鱼 我在想用第一个方法如果安装的功能包太多,放在bashrc里面,要是多的功能包都安装了同一个附属功能包,那会不会出问题?感觉很多时候像是下载的功能包需要用rosdepc安装依赖时,可能会安装相同的?
-
@小鱼 刚刚尝试这样安装在/opt/ros/humble/下,然后又出现了一个新的问题
not found: "/opt/ros/humble/share/moveit_common/local_setup.bash" not found: "/opt/ros/humble/share/moveit_resources_fanuc_description/local_setup.bash" not found: "/opt/ros/humble/share/moveit_resources_fanuc_moveit_config/local_setup.bash" not found: "/opt/ros/humble/share/moveit_resources_panda_description/local_setup.bash" not found: "/opt/ros/humble/share/moveit_resources_panda_moveit_config/local_setup.bash" not found: "/opt/ros/humble/share/moveit_resources_pr2_description/local_setup.bash" not found: "/opt/ros/humble/share/moveit_resources/local_setup.bash" not found: "/opt/ros/humble/share/moveit_resources_prbt_support/local_setup.bash" not found: "/opt/ros/humble/share/moveit_task_constructor_msgs/local_setup.bash" not found: "/opt/ros/humble/share/rosparam_shortcuts/local_setup.bash" not found: "/opt/ros/humble/share/rviz_marker_tools/local_setup.bash" not found: "/opt/ros/humble/share/srdfdom/local_setup.bash" not found: "/opt/ros/humble/share/moveit_core/local_setup.bash" not found: "/opt/ros/humble/share/chomp_motion_planner/local_setup.bash" not found: "/opt/ros/humble/share/moveit_chomp_optimizer_adapter/local_setup.bash" not found: "/opt/ros/humble/share/moveit_kinematics/local_setup.bash" not found: "/opt/ros/humble/share/moveit_planners_chomp/local_setup.bash" not found: "/opt/ros/humble/share/moveit_resources_prbt_ikfast_manipulator_plugin/local_setup.bash" not found: "/opt/ros/humble/share/moveit_ros_occupancy_map_monitor/local_setup.bash" not found: "/opt/ros/humble/share/moveit_ros_planning/local_setup.bash" not found: "/opt/ros/humble/share/moveit_planners_ompl/local_setup.bash" not found: "/opt/ros/humble/share/moveit_ros_move_group/local_setup.bash" not found: "/opt/ros/humble/share/moveit_resources_prbt_moveit_config/local_setup.bash" not found: "/opt/ros/humble/share/moveit_resources_prbt_pg70_support/local_setup.bash" not found: "/opt/ros/humble/share/moveit_ros_perception/local_setup.bash" not found: "/opt/ros/humble/share/moveit_ros_robot_interaction/local_setup.bash" not found: "/opt/ros/humble/share/moveit_ros_warehouse/local_setup.bash" not found: "/opt/ros/humble/share/moveit_ros_benchmarks/local_setup.bash" not found: "/opt/ros/humble/share/moveit_ros_planning_interface/local_setup.bash" not found: "/opt/ros/humble/share/moveit_hybrid_planning/local_setup.bash" not found: "/opt/ros/humble/share/moveit_ros_visualization/local_setup.bash" not found: "/opt/ros/humble/share/moveit_ros/local_setup.bash" not found: "/opt/ros/humble/share/moveit_servo/local_setup.bash" not found: "/opt/ros/humble/share/moveit_setup_framework/local_setup.bash" not found: "/opt/ros/humble/share/moveit_setup_app_plugins/local_setup.bash" not found: "/opt/ros/humble/share/moveit_setup_controllers/local_setup.bash" not found: "/opt/ros/humble/share/moveit_setup_core_plugins/local_setup.bash" not found: "/opt/ros/humble/share/moveit_setup_srdf_plugins/local_setup.bash" not found: "/opt/ros/humble/share/moveit_setup_assistant/local_setup.bash" not found: "/opt/ros/humble/share/moveit_simple_controller_manager/local_setup.bash" not found: "/opt/ros/humble/share/moveit_plugins/local_setup.bash" not found: "/opt/ros/humble/share/moveit_ros_control_interface/local_setup.bash" not found: "/opt/ros/humble/share/moveit_task_constructor_core/local_setup.bash" not found: "/opt/ros/humble/share/moveit_task_constructor_capabilities/local_setup.bash" not found: "/opt/ros/humble/share/moveit_task_constructor_demo/local_setup.bash" not found: "/opt/ros/humble/share/moveit_task_constructor_visualization/local_setup.bash" not found: "/opt/ros/humble/share/moveit_visual_tools/local_setup.bash" not found: "/opt/ros/humble/share/hello_moveit/local_setup.bash" not found: "/opt/ros/humble/share/pilz_industrial_motion_planner/local_setup.bash" not found: "/opt/ros/humble/share/moveit_planners/local_setup.bash" not found: "/opt/ros/humble/share/moveit/local_setup.bash" not found: "/opt/ros/humble/share/moveit2_tutorials/local_setup.bash" not found: "/opt/ros/humble/share/moveit_runtime/local_setup.bash" not found: "/opt/ros/humble/share/pilz_industrial_motion_planner_testutils/local_setup.bash"
它的setup文件好像没有附带安装过去,应该怎么办
-
@空白 是在什么情况下出现的,我确认了下,这样安装确实会导致没有local_setup.bash,但是依然可以正常在其他空间运行
eg:ros2 run yolov5_ros2 yolo_detect_2d
-
@空白 不同工作空间相互调用直接将各自工作空间的激活命令放到~/.bashrc文件中,这样打开terminal后,直接激活了多个工作空间,就能找到对应的包了
-
@Lorry 这个方法我尝试过,也成功了,当时觉得可能会出现功能包冲突(比如说命名重复啥的)就试了下小鱼的方法,然后环境好像出问题了
-
@空白 命名重复的话智能修改包名称了
-
@Lorry 嗯嗯,目前来看这个方法算比较简单的
-
@小鱼 我在我包含moveit的工作空间
~/ws_moveit2$ sudo colcon build --merge-install --install-base /opt/ros/humble/
然后编译通过了,在/opt/ros/humble/share 里面也可以找到相应的名字
内容和/home/xxx/ws_moveit2/install/moveit_configs_utils/share里面内容一样
(本来share里面好像就没有local_setup.bash),只在/home/xxx/ws_moveit2/install
里面看到了
然后出现的现象如上图所示,尝试有:
1.在原ws_moveit2空间使用sudo colcon build --merge-install --install-base /opt/ros/humble/
可以继续编译成功,但是使用colcon build会出现
[0.605s] ERROR:colcon.colcon_core.environment:Exception in shell extension 'dsv': [Errno 13] Permission denied: '/home/pan/ws_moveit2/install/moveit_resources_panda_description/share/moveit_resources_panda_description/package.dsv' Traceback (most recent call last): File "/usr/lib/python3/dist-packages/colcon_core/environment/__init__.py", line 131, in create_environment_scripts_only retval = extension.create_package_script( File "/usr/lib/python3/dist-packages/colcon_core/shell/dsv.py", line 30, in create_package_script expand_template( File "/usr/lib/python3/dist-packages/colcon_core/shell/template/__init__.py", line 54, in expand_template with destination_path.open('w') as h: File "/usr/lib/python3.10/pathlib.py", line 1119, in open return self._accessor.open(self, mode, buffering, encoding, errors, PermissionError: [Errno 13] Permission denied: '/home/pan/ws_moveit2/install/moveit_resources_panda_description/share/moveit_resources_panda_description/package.dsv' --- stderr: moveit_resources_panda_description CMake Error at cmake_install.cmake:86 (file): file INSTALL cannot set permissions on "/home/pan/ws_moveit2/install/moveit_resources_panda_description/share/moveit_resources_panda_description/package.dsv": Operation not permitted. --- Failed <<< moveit_resources_panda_description [0.24s, exited with code 1] Aborted <<< moveit_resources_pr2_description [0.22s] Aborted <<< moveit_resources_prbt_support [0.22s] Aborted <<< moveit_common [0.24s] Aborted <<< moveit_resources_fanuc_description [0.23s] Aborted <<< srdfdom [0.24s] Aborted <<< rviz_marker_tools [0.22s] Aborted <<< rosparam_shortcuts [0.22s] Aborted <<< moveit_task_constructor_msgs [0.34s] Aborted <<< launch_param_builder [0.35s] Summary: 0 packages finished [0.61s] 1 package failed: moveit_resources_panda_description 9 packages aborted: launch_param_builder moveit_common moveit_resources_fanuc_description moveit_resources_pr2_description moveit_resources_prbt_support moveit_task_constructor_msgs rosparam_shortcuts rviz_marker_tools srdfdom 5 packages had stderr output: moveit_common moveit_resources_fanuc_description moveit_resources_panda_description moveit_resources_pr2_description moveit_resources_prbt_support 46 packages not processed
2.除直接通过Ctrl+Alt+T会出现上述现象外,在其他没有改动的工作空间下面采用
source install/setup.bash
也会出现相同的错误
目前想到的尝试方法有:
1.是否可以通过在/opt/ros/humble/ 里面colcon build 尝试会不会改变这个底层空间的setup.bash从而解决办法
2.如果实在不行应该如何还原?是直接像二进制那样autoremove moveit相关就可,还是只能把这些全删掉重新搞? -
@空白 这个是因为之前安装用了sudo导致权限变了的原因,你可以后续编译都用sudo来进行,或者将原有编译出来的文件删除重新编译即可。
另外就是你之前是否有加到.bashrc下的关于功能包的配置,有的话可以删掉。
-
@小鱼 原有编译删掉是指将/opt/ros/humble/share里面多出来的功能包删掉即可吗?
-
@空白 是你工作空间下的,因为采用sudo编译,导致build和log文件夹权限被修改成root用户了,后续直接使用colcon会没有权限。
-
@小鱼 .bashrc里面没有其他工作空间配置,只有source /opt/ros/humble/setup.bash
-
@小鱼 刚刚试了下,在ws_moveit工作空间采用colcon build 和source install/setup.bash没有问题了,但是打开终端还是会显示
not found: "/opt/ros/humble/share/moveit_planners_chomp/local_setup.bash"
这类错误 -
@空白 直接删掉工作空间下install即可,如果不需要将这些功能包安装到系统,也可以直接删掉系统/opt/目录下的相关功能包文件。
-
@空白 不确定moveit功能包和我这边测试的是否有什么不同之处导致这一问题,你可以先把系统的功能包删掉,我抽空再次测试一下比较复杂的工程安装到系统的方法。
-
@小鱼 嗯嗯,为将系统的share里面功能包删除后就不会出问题了,然后用第一种方法完成了,效果来看目前没有问题
-
-