完善描述文档

This commit is contained in:
张梦南 2025-06-30 11:09:41 +08:00
parent 2ebfbb4c94
commit 84c38f206e

View File

@ -1,10 +1,11 @@
# ROS-noetic安装应用于Ubuntu20.04lts
## 注最好全程使用root权限
# <p align="center">ROS_Learn</p>
## 实验一
### ROS-noetic安装应用于Ubuntu20.04lts<br>最好全程使用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`保存退出。<br>
在命令行中输入下列命令添加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 类型。
### 注服务端节点C提供FFT服务暂未完成。