diff --git a/ROS.md b/ROS.md index 995f747..f73082c 100644 --- a/ROS.md +++ b/ROS.md @@ -1,26 +1,3 @@ - - -## 参数服务器 - -### 设置参数 - -```c++ -ros::NodeHandle n; -n.setParam("camera/session", to_string(session)); -``` - -### 获取参数 - -```c++ -ros::NodeHandle n; -string session_s; -n.getParam("camera/session", session_s); - -``` - - - - - - - +[[ros 命令]] +[[ros c++]] +[[ros python]] \ No newline at end of file diff --git a/ros c++.md b/ros c++.md new file mode 100644 index 0000000..43ee9ce --- /dev/null +++ b/ros c++.md @@ -0,0 +1,19 @@ + +## 参数服务器 + +### 设置参数 + +```c++ +ros::NodeHandle n; +n.setParam("camera/session", to_string(session)); +``` + +### 获取参数 + +```c++ +ros::NodeHandle n; +string session_s; +n.getParam("camera/session", session_s); + +``` + diff --git a/ros python.md b/ros python.md new file mode 100644 index 0000000..3fc375e --- /dev/null +++ b/ros python.md @@ -0,0 +1,25 @@ +python文件头内容 + +```python +#!/usr/bin/env python3 #指定运行环境 +# coding:utf-8 #指定文件编码 +import rospy +``` + +python 文件需要存储在ros 功能包 scripts 路径下 +```shell +mkdir scripts #创建scripts路径 +``` + +需要先设置python 文件为可执行文件 +```shell +chmod +x sample.py +``` + +编译运行python代码 +```shell +cd ros_workspace #回到工作空间 +catkin_make #编译代码 +source devel/setup.bash #编译后要source刷新环境 +rosrun ros_workspace sample.py #运行python代码 +``` \ No newline at end of file