diff --git a/README.md b/README.md index 8909e8f..f704c68 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ source ~/.bashrc sudo apt install python3-rosinstall python3-rosinstall-generator python3-wstool sudo apt install build-essential ``` -环境配置检测 +环境配置检测,配置无误的话可无需运行 ```c # 确保环境配置 source /opt/ros/noetic/setup.bash @@ -67,6 +67,7 @@ sudo apt install --reinstall ros-noetic-desktop-full dpkg -l | grep ros-noetic-roslaunch # 若roslaunch以安装则无需执行下条命令 sudo apt install ros-noetic-roslaunch + # 将路径换为文件/文件夹路径,赋予文件/文件夹可执行权限 chmod +x /路径 # 将文件/文件夹可编辑权限赋予某用户 @@ -84,6 +85,27 @@ rosrun turtlesim turtlesim_node ```c rosrun turtlesim turtle_teleop_key ``` +创建工作空间 +```c +mkdir -p src +catkin_make +``` +设置 ROS 环境变量 +```c +echo "source /文件夹路径/devel/setup.bash" >> ~/.bashrc +source ~/.bashrc +``` +进入 src 目录并创建功能包 +```c +cd src +catkin_create_pkg Service rospy std_msgs geometry_msgs visualization_msgs message_generation +``` +创建结构和放置文件 +```c +cd Service +mkdir scripts +mkdir srv +``` ## 实验二 ### ROS中话题通信 @@ -91,6 +113,10 @@ rosrun turtlesim turtle_teleop_key ```c catkin_make ``` +设置文件可执行权限 +```c +chmod +x scripts/程序名.py +``` 添加环境变量(所有新终端窗口要执行下列命令) ```c source /home/zmn/Gitea/ROS_Learn/devel/setup.bash @@ -115,26 +141,34 @@ rviz 在 Displays 面板中,点击 Add,添加 Marker 类型。 ## 实验三 -### ROS中服务和客户 +### ROS中服务端和客户端 编译工作空间 ```c catkin_make ``` -启动roscore(终端A) +设置文件可执行权限 ```c -roscore +chmod +x scripts/程序名.py ``` 添加环境变量 ```c source /home/zmn/Gitea/ROS_Learn/devel/setup.bash ``` -启动发送端(终端B) +启动roscore(终端A) ```c -rosrun position_demo publisher_node_three.py +roscore +``` +启动服务端(终端B) +```c +rosrun Service Service_S.py ``` 启动订阅端(也是客户端)(终端C) ```c -rosrun position_demo subscriber_node_three.py +rosrun Service Subscriber_Client_S.py +``` +启动发送端(终端D) +```c +rosrun Service Publister_S.py ``` 启动RViz(终端F) ```c @@ -142,5 +176,3 @@ rviz ``` 将RViz左侧 Global Options 面板中 Fixed Frame 改为程序中的 world 。 在 Displays 面板中,点击 Add,添加 Marker 类型。 - -### 注:服务端(节点C)提供FFT服务暂未完成。 \ No newline at end of file