From 84c38f206e8c364676f5d9a3227e77642bad8d22 Mon Sep 17 00:00:00 2001 From: Cx330 <1487537121@qq.com> Date: Mon, 30 Jun 2025 11:09:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=8F=8F=E8=BF=B0=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 95 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 52 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 694bd76..a75ca37 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ -# ROS-noetic安装,应用于Ubuntu20.04lts -## 注:最好全程使用root权限 +#

ROS_Learn

+## 实验一 +### ROS-noetic安装,应用于Ubuntu20.04lts
注:最好全程使用root权限 +#### 1.切换ubuntu软件源,访问清华源来提升下载速度。 ```c sudo vim /etc/apt/sources.list # 进入apt下载源文件 ``` - -删除所有ubuntu官方源,添加清华源 +删除所有ubuntu官方源(最好提前备份以下文件避免操作失误无法恢复),添加清华源 ```c # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse @@ -22,8 +23,8 @@ deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restric deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse ``` - -添加ROS源地址 +vim中按`Esc`退出编辑模式,按`Shift+;`进入命令输入模式输入`wq`保存退出。
+在命令行中输入下列命令添加ROS源地址。 ```c sudo sh -c 'echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu focal main" > /etc/apt/sources.list.d/ros-latest.list' ``` @@ -31,11 +32,11 @@ sudo sh -c 'echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu focal main" ```c sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-keys 6A030B21B4D2B67B ``` -更新源 +更新软件源 ```c sudo apt update ``` -安装ROS-noetic +安装ROS-noetic(适用于Ubuntu20.04Lts) ```c sudo apt install ros-noetic-desktop-full ``` @@ -66,8 +67,12 @@ sudo apt install --reinstall ros-noetic-desktop-full dpkg -l | grep ros-noetic-roslaunch # 若roslaunch以安装则无需执行下条命令 sudo apt install ros-noetic-roslaunch +# 将路径换为文件/文件夹路径,赋予文件/文件夹可执行权限 +chmod -x /路径 +# 将文件/文件夹可编辑权限赋予某用户 +sudo chown -R 用户名:用户名 /路径 ``` -启动roscore +#### 2.启动roscore ```c roscore ``` @@ -80,12 +85,42 @@ rosrun turtlesim turtlesim_node rosrun turtlesim turtle_teleop_key ``` -# 二 +## 实验二 +### ROS中话题通信 编译工作空间 ```c catkin_make ``` -启动roscore +启动roscore(终端A) +```c +roscore +``` +添加环境变量(所有新终端窗口要执行下列命令) +```c +source /home/zmn/Gitea/ROS_Learn/devel/setup.bash +``` +启动发送端(终端B) +```c +rosrun position_demo publisher_node.py +``` +启动订阅端(终端C) +```c +rosrun position_demo subscriber_node.py +``` +启动RViz(终端D) +```c +rviz +``` +注:将RViz左侧 Global Options 面板中 Fixed Frame 改为程序中的 world 。 +在 Displays 面板中,点击 Add,添加 Marker 类型。 + +## 实验三 +### ROS中服务和客户 +编译工作空间 +```c +catkin_make +``` +启动roscore(终端A) ```c roscore ``` @@ -93,45 +128,19 @@ roscore ```c source /home/zmn/Gitea/ROS_Learn/devel/setup.bash ``` -启动发送端 +启动发送端(终端B) ```c -rosrun position_demo publisher_node.py +rosrun position_demo publisher_node_three.py ``` -启动客户端 +启动订阅端(也是客户端)(终端C) ```c -rosrun position_demo subscriber_node.py +rosrun position_demo subscriber_node_three.py ``` -启动RViz +启动RViz(终端F) ```c rviz ``` 将RViz左侧 Global Options 面板中 Fixed Frame 改为程序中的 world 。 在 Displays 面板中,点击 Add,添加 Marker 类型。 -# 三 -编译工作空间 -```c -catkin_make -``` -启动roscore -```c -roscore -``` -添加环境变量 -```c -source /home/zmn/Gitea/ROS_Learn/devel/setup.bash -``` -启动发送端 -```c -rosrun position_demo publisher_node_three.py -``` -启动客户端 -```c -rosrun position_demo subscriber_node_three.py -``` -启动RViz -```c -rviz -``` -将RViz左侧 Global Options 面板中 Fixed Frame 改为程序中的 world 。 -在 Displays 面板中,点击 Add,添加 Marker 类型。 \ No newline at end of file +### 注:服务端(节点C)提供FFT服务暂未完成。 \ No newline at end of file