小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
wsl2一键安装ros2,显示安装成功后 运行demo报错
-
root@LAPTOP-T519TJGF:~# wget http://fishros.com/install -O fishros && . fishros
--2024-06-12 22:10:20-- http://fishros.com/install
Resolving fishros.com (fishros.com)... 47.119.165.169
Connecting to fishros.com (fishros.com)|47.119.165.169|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://fishros.com/install/ [following]
--2024-06-12 22:10:20-- http://fishros.com/install/
Reusing existing connection to fishros.com:80.
HTTP request sent, awaiting response... 200 OK
Length: 579 [application/octet-stream]
Saving to: ‘fishros’fishros 100%[====================================================>] 579 --.-KB/s in 0s
2024-06-12 22:10:20 (145 MB/s) - ‘fishros’ saved [579/579]
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
sudo is already the newest version (1.9.9-1ubuntu2.4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-distro is already the newest version (1.7.0-1).
python3-yaml is already the newest version (5.4.1-1ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
--2024-06-12 22:10:21-- http://mirror.fishros.com/install/tools/base.py
Resolving mirror.fishros.com (mirror.fishros.com)... 47.119.165.169
Connecting to mirror.fishros.com (mirror.fishros.com)|47.119.165.169|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 44650 (44K) [application/octet-stream]
Saving to: ‘/tmp/fishinstall/tools/base.py’/tmp/fishinstall/tools/base.py 100%[====================================================>] 43.60K --.-KB/s in 0.07s
2024-06-12 22:10:21 (593 KB/s) - ‘/tmp/fishinstall/tools/base.py’ saved [44650/44650]
Run CMD Task:[dpkg --print-architecture]
[-]Result:successRun CMD Task:[wget https://fishros.org.cn/forum/topic/1733 -O /tmp/t1733 -q && rm -rf /tmp/t1733]
[-]Result:success基础检查通过...
======欢迎使用一键安装工具,人生苦短,三省吾身,省时省力省心!=======
======一键安装已开源,请放心使用:https://github.com/fishros/install =======.-~~~~~~~~~-._ _.-~~~~~~~~~-. __.' ~. .~ `.__ .'// 开卷有益 \./ 书山有路 \ `. .'// 可以多看看小鱼的文章 | 关注公众号鱼香ROS \ `. .'// .-~~~~~~~~~~~~~~-._ | _,-~~~~~~~~~~~. \`. .'//.-" `-. | .-' "-.\`. .'//______.============-.. \ | / ..-============.______\`. .'______________________________\|/______________________________` ----------------------------------------------------------------------
RUN Choose Task:[请输入括号内的数字]
---众多工具,等君来用---
ROS相关:
[1]:一键安装(推荐):ROS(支持ROS/ROS2,树莓派Jetson)
[3]:一键安装:rosdep(小鱼的rosdepc,又快又好用)
[4]:一键配置:ROS环境(快速更新ROS环境设置,自动生成环境选择)
[9]:一键安装:Cartographer(18 20测试通过,16未测. updateTime 20240125)
[11]:一键安装:ROS Docker版(支持所有版本ROS/ROS2)
[16]:一键安装:系统自带ROS (!!警告!!仅供特殊情况下使用)常用软件:
[2]:一键安装:github桌面版(小鱼常用的github客户端)
[6]:一键安装:NodeJS环境
[7]:一键安装:VsCode开发工具
[8]:一键安装:Docker
[10]:一键安装:微信(可以在Linux上使用的微信)
[12]:一键安装:PlateformIO MicroROS开发环境(支持Fishbot)
[14]:一键安装:科学上网代理工具
[15]:一键安装:QQ for Linux配置工具:
[5]:一键配置:系统源(更换系统源,支持全版本Ubuntu系统)
[13]:一键配置:python国内源请输入[]内的数字以选择:1
--2024-06-12 22:10:30-- http://mirror.fishros.com/install/tools/tool_install_ros.py
Resolving mirror.fishros.com (mirror.fishros.com)... 47.119.165.169
Connecting to mirror.fishros.com (mirror.fishros.com)|47.119.165.169|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19723 (19K) [application/octet-stream]
Saving to: ‘/tmp/fishinstall/tools/tool_install_ros.py’/tmp/fishinstall/tools/tool_in 100%[====================================================>] 19.26K --.-KB/s in 0.04s
2024-06-12 22:10:30 (502 KB/s) - ‘/tmp/fishinstall/tools/tool_install_ros.py’ saved [19723/19723]
--2024-06-12 22:10:30-- http://mirror.fishros.com/install/tools/tool_config_rosenv.py
Resolving mirror.fishros.com (mirror.fishros.com)... 47.119.165.169
Connecting to mirror.fishros.com (mirror.fishros.com)|47.119.165.169|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2455 (2.4K) [application/octet-stream]
Saving to: ‘/tmp/fishinstall/tools/tool_config_rosenv.py’/tmp/fishinstall/tools/tool_co 100%[====================================================>] 2.40K --.-KB/s in 0s
2024-06-12 22:10:30 (509 MB/s) - ‘/tmp/fishinstall/tools/tool_config_rosenv.py’ saved [2455/2455]
--2024-06-12 22:10:30-- http://mirror.fishros.com/install/tools/tool_config_system_source.py
Resolving mirror.fishros.com (mirror.fishros.com)... 47.119.165.169
Connecting to mirror.fishros.com (mirror.fishros.com)|47.119.165.169|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7738 (7.6K) [application/octet-stream]
Saving to: ‘/tmp/fishinstall/tools/tool_config_system_source.py’/tmp/fishinstall/tools/tool_co 100%[====================================================>] 7.56K --.-KB/s in 0s
2024-06-12 22:10:31 (1.26 GB/s) - ‘/tmp/fishinstall/tools/tool_config_system_source.py’ saved [7738/7738]
欢迎使用一键安装ROS和ROS2,支持树莓派Jetson,本工具由作者小鱼提供
欢迎使用ROS开箱子工具,本工具由[鱼香ROS]小鱼贡献..
小鱼:检测当前系统ubuntu22.04:jammy 支持一键安装ROS
=========接下来这一步很很很很重要,如果不知道怎么选请选择1========
RUN Choose Task:[请输入括号内的数字]
新手或首次安装一定要一定要一定要换源并清理三方源,换源!!!系统默认国外源容易失败!!
[1]:更换系统源再继续安装
[2]:不更换继续安装
0:quit
请输入[]内的数字以选择:1
欢迎使用一键换源工具,本工具由[鱼香ROS]小鱼贡献..
RUN Choose Task:[请输入括号内的数字]
请选择换源方式,如果不知道选什么请选2
[1]:仅更换系统源
[2]:更换系统源并清理第三方源
0:quit
请输入[]内的数字以选择:2
Run CMD Task:[sudo rm -rf /etc/apt/sources.list]
[-]Result:success删除一个资源文件
Run CMD Task:[sudo rm -rf /etc/apt/sources.list.d]
[-]Result:successRun CMD Task:[sudo mkdir -p /etc/apt/sources.list.d]
[-]Result:successRun CMD Task:[dpkg --print-architecture]
[-]Result:success检测到当前系统架构为[amd64:jammy],正在为你更换对应源..
创建文件:/etc/apt/sources.list
替换完成,尝试第一次更新....
Run CMD Task:[sudo apt update]
[-]Result:success jammy-security InReleasee搞定了,不信你看,累死宝宝了,还不快去给小鱼点个赞~
['Hit:1 https://mirrors.ustc.edu.cn/ubuntu jammy InRelease', 'Hit:2 https://mirrors.ustc.edu.cn/ubuntu jammy-updates InRelease', 'Hit:3 https://mirrors.ustc.edu.cn/ubuntu jammy-backports InRelease', 'Hit:4 https://mirrors.ustc.edu.cn/ubuntu jammy-security InRelease', 'Reading package lists...', 'Building dependency tree...', 'Reading state information...', 'All packages are up to date.']
镜像修复完成.....
Run CMD Task:[sudo apt update]
[-]Result:success jammy-security InReleaseeRun CMD Task:[sudo apt search curl ]
This package retrieves data from url-format files such as http://, ftp://, package:// file://, etc., and loads the data[-]Result:success 22ubuntu0.1 amd64md640ubuntu0.22.04 amd64md64Run CMD Task:[sudo apt install curl -y]
[-]Result:success e and 0 not upgraded.Run CMD Task:[sudo apt search gnupg2 ]
[-]Result:success ent (dummy transitional package)Run CMD Task:[sudo apt install gnupg2 -y]
[-]Result:success e and 0 not upgraded.Run CMD Task:[curl -s https://gitee.com/ohhuo/rosdistro/raw/master/ros.asc | sudo apt-key add -]
[-]Result:successRun CMD Task:[curl -s https://gitee.com/ohhuo/rosdistro/raw/master/ros.asc | sudo gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/ros.gpg --import]
[-]Result:successRun CMD Task:[sudo chmod 644 /etc/apt/trusted.gpg.d/ros.gpg]
[-]Result:successRun CMD Task:[dpkg --print-architecture]
[-]Result:success根据您的系统,为您推荐安装源为['http://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu/']
创建文件:/etc/apt/sources.list.d/ros-fish.list
Run CMD Task:[sudo apt update]
[-]Result:success jammy-security InReleaseemd64 Packages [1,532 kB]Run CMD Task:[sudo apt search ros-base ]
Node that enables connected ROS-based devices or robots to exchange ROS messages via an MQTT broker using the MQTT prot[] Node that enables connected ROS-based devices or robots to exchange ROS messages via an MQTT broker using the MQTT prot[-]Result:success includes other basic functionalities like tf2 and urdf.恭喜,成功添加ROS源,接下来可以使用apt安装ROS或者使用[1]一键安装ROS安装!
Run CMD Task:[sudo apt search ros-base ]
Node that enables connected ROS-based devices or robots to exchange ROS messages via an MQTT broker using the MQTT prot[] Node that enables connected ROS-based devices or robots to exchange ROS messages via an MQTT broker using the MQTT prot[-]Result:success includes other basic functionalities like tf2 and urdf.RUN Choose Task:[请输入括号内的数字]
请选择你要安装的ROS版本名称(请注意ROS1和ROS2区别):
[1]:humble(ROS2)
[2]:iron(ROS2)
[3]:rolling(ROS2)
0:quit
请输入[]内的数字以选择:1
RUN Choose Task:[请输入括号内的数字]
请选择安装的具体版本(如果不知道怎么选,请选1桌面版):
[1]:humble(ROS2)桌面版
[2]:humble(ROS2)基础版(小)
0:quit
请输入[]内的数字以选择:1
Run CMD Task:[sudo apt search aptitude ]
[-]Result:success r Debian/Ubuntument files)trainedRun CMD Task:[sudo apt install aptitude -y]
[-]Result:success e and 0 not upgraded.Run CMD Task:[sudo apt search aptitude ]
[-]Result:success r Debian/Ubuntument files)trainedRun CMD Task:[sudo apt install aptitude -y]
[-]Result:success e and 0 not upgraded.Run CMD Task:[sudo apt install ros-humble-desktop -y]
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ros-humble-desktop is already the newest version (0.10.0-1jammy.20240530.113728).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Run CMD Task:[sudo apt install ros-humble-desktop -y]
[-]Result:success e and 0 not upgraded.y.20240530.113728).Run CMD Task:[sudo apt search python3-colcon-common-extensions ]
[-]Result:success d common extensions.lled]Run CMD Task:[sudo apt install python3-colcon-common-extensions -y]
[-]Result:success e and 0 not upgraded. (0.3.0-1).Run CMD Task:[sudo apt search python3-argcomplete ]
[-]Result:success ython 3)alled]Run CMD Task:[sudo apt install python3-argcomplete -y]
[-]Result:success e and 0 not upgraded.Run CMD Task:[sudo apt search python3-rosdep ]
[-]Result:success for Robot OS (Python 3)c]Run CMD Task:[sudo apt install python3-rosdep -y]
[-]Result:success e and 0 not upgraded.Run CMD Task:[ls /opt/ros/humble/setup.bash]
[-]Result:success欢迎使用一键配置ROS开发环境,本工具由作者小鱼提供
Run CMD Task:[ls /opt/ros/*/setup.bash]
[-]Result:successRun CMD Task:[ls /home/*/.bashrc]
[-]Result:success检测到系统有1个ROS环境,已为你生成启动选择,修改~/.bashrc可关闭
恭喜你,安装成功了,再附赠你机器人学习宝藏网站:鱼香社区:https://fishros.org.cn/forum
Run CMD Task:[ls /opt/ros/humble/setup.bash]
[-]Result:success小鱼:黄黄的提示:您安装的是ROS2,ROS2是没有roscore的,请打开新终端输入ros2测试!小鱼制作了ROS2课程,关注公众号《鱼香ROS》即 可获取~
欢迎加入机器人学习交流QQ群:438144612(入群口令:一键安装)
鱼香小铺正式开业,最低499可入手一台能建图会导航的移动机器人,淘宝搜店:鱼香ROS 或打开链接查看:https://item.taobao.com/item.htm?id=696573635888
如在使用过程中遇到问题,请打开:https://fishros.org.cn/forum 进行反馈
root@LAPTOP-T519TJGF:~# ros2 run demo_nodes_cpp
ros2: command not found -
从您提供的日志来看,您已经成功安装了ROS 2 Humble桌面版。但是,当您尝试运行
ros2 run demo_nodes_cpp
时,系统提示ros2: command not found
,这意味着ros2
命令没有在当前的环境变量中。出现这个问题的原因可能是您没有正确配置ROS 2的环境变量,或者您当前所在的终端会话还没有加载这些环境变量。ROS 2的环境变量通常通过在
~/.bashrc
或~/.bash_profile
中添加相应的source
命令来设置。以下是一些步骤,您可以按照这些步骤来确保ROS 2的环境变量被正确加载:
-
打开一个新的终端窗口。
-
检查
~/.bashrc
或~/.bash_profile
文件中是否包含如下行:source /opt/ros/humble/setup.bash
如果没有,请添加它,并保存文件。
-
在当前终端中,运行以下命令来使更改生效:
source ~/.bashrc
或者,如果您使用的是
~/.bash_profile
,则运行:source ~/.bash_profile
-
现在再次尝试运行
ros2
命令:ros2 run demo_nodes_cpp talker
如果您成功安装了
demo_nodes_cpp
包,这个命令应该会启动一个名为talker
的节点。 -
如果您在安装过程中没有安装
demo_nodes_cpp
包,您需要先安装它。在ROS 2中,您可以使用colcon
来构建示例包,或者如果您使用的是Debian包,则可以使用apt
来安装。使用
apt
安装示例包(如果可用):sudo apt install ros-humble-demo-nodes-cpp
或者,如果您想从源代码构建示例包,请按照ROS 2的官方文档进行操作。
如果上述步骤仍然不能解决问题,请检查您是否以正确的用户身份(如root用户或具有适当权限的普通用户)运行了这些命令,并确保您没有在安装或配置过程中遇到任何错误。
以上为生成回答,仅供参考~
-
-