2302_80274807 2024-05-26 09:03 采纳率: 36.4%
浏览 7
已结题

Ubuntu中运行launch文件,想要运行多个节点,输入roslaunch minisnap real.launch

别人发給一个我压缩包,我利用,

cd catkin_ws/src
catkin_create_pkg minisnap roscpp rospy std_msgs

整了个软件包,选择性替换了原本的src,然后进行编译,编译通过,
当我输入roslaunch minisnap real.launch
出现

Resource not found: min_snap
ROS path [0]=/opt/ros/noetic/share/ros
ROS path [1]=/home/lin/catkin_ws/src
ROS path [2]=/opt/ros/noetic/share
ROS path [3]=/home/lin/PX4-Autopilot
ROS path [4]=/home/lin/PX4-Autopilot/Tools/sitl_gazebo
The traceback for the exception was written to the log file

当我i输入rospack depends minisnap,它给我显示[rospack] Error: the rosdep view is empty: call 'sudo rosdep init' and 'rosdep update'
接下来我跟着提示输入sudo rosdep init,
他给我显示

ERROR: cannot download default sources list from:
https://mirrors.tuna.tsinghua.edu.cn/github-raw/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.
<urlopen error <urlopen error [Errno -3] Temporary failure in name resolution> (https://mirrors.tuna.tsinghua.edu.cn/github-raw/ros/rosdistro/master/rosdep/sources.list.d/20-default.list)>

我输入rospack find minisnap,有给我返回路径
该如何解决

Resource not found: min_snap
ROS path [0]=/opt/ros/noetic/share/ros
ROS path [1]=/home/lin/catkin_ws/src
ROS path [2]=/opt/ros/noetic/share
ROS path [3]=/home/lin/PX4-Autopilot
ROS path [4]=/home/lin/PX4-Autopilot/Tools/sitl_gazebo
The traceback for the exception was written to the log file
  • 写回答

3条回答 默认 最新

  • 阿里嘎多学长 2024-05-26 09:03
    关注

    以下内容由CHATGPT及阿里嘎多学长共同生成、有用望采纳:


    根据您提供的信息,您遇到的问题主要有两个方面:

    1. ROS launch文件无法找到min_snap资源
    2. rosdep初始化和更新时出现错误

    解决方法:

    第一个问题:Resource not found: min_snap

    这个问题通常是因为ROS环境没有正确设置或者min_snap包没有正确安装。根据您提供的信息,rospack find minisnap能够返回路径,说明min_snap包是存在的。可能的原因包括:

    • min_snap包没有被正确地添加到ROS_PACKAGE_PATH环境变量中。
    • real.launch文件中可能存在拼写错误或者路径问题。

    解决方案

    • 确保min_snap包的路径已经被添加到ROS_PACKAGE_PATH中。您可以通过在终端运行echo $ROS_PACKAGE_PATH来检查当前的环境变量。
    • 检查real.launch文件,确保其中引用的包名和路径是正确的。

    第二个问题:rosdep初始化和更新错误

    这个问题通常是因为网络问题或者rosdep源列表无法访问导致的。您可以尝试以下步骤来解决:

    解决方案

    • 确保您的网络连接是正常的。
    • 尝试更换rosdep的源列表到国内镜像,例如清华镜像。您可以通过编辑/etc/ros/rosdep/sources.list.d/20-default.list文件,将内容替换为:
      deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu $(lsb_release -cs) main
      
    • 再次运行sudo rosdep initrosdep update

    代码实现:

    以下是一些可能需要执行的命令:

    # 确保ROS环境变量设置正确
    echo $ROS_PACKAGE_PATH
    
    # 初始化rosdep
    sudo rosdep init
    # 更新rosdep
    rosdep update
    
    # 如果需要更换rosdep源为清华镜像
    sudo sh -c 'echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu $(lsb_release -cs) main" > /etc/ros/rosdep/sources.list.d/20-default.list'
    

    参考资料:

    1. 解决ROS国内rosdep init和update的相关问题[^6^]
    2. 运行rosdep update命令遇到的超时问题[^8^]
    3. rosdep update 更新报错:read operation timed out[^9^]

    希望这些信息能帮助您解决问题。如果问题仍然存在,请提供更多的信息,例如real.launch文件的内容,以便进一步分析。

    评论 编辑记录

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 1月14日
  • 创建了问题 5月26日