文档更新
This commit is contained in:
parent
5d69fbe3f2
commit
69766a0098
29
ROS.md
29
ROS.md
@ -1,26 +1,3 @@
|
|||||||
|
[[ros 命令]]
|
||||||
|
[[ros c++]]
|
||||||
## 参数服务器
|
[[ros python]]
|
||||||
|
|
||||||
### 设置参数
|
|
||||||
|
|
||||||
```c++
|
|
||||||
ros::NodeHandle n;
|
|
||||||
n.setParam("camera/session", to_string(session));
|
|
||||||
```
|
|
||||||
|
|
||||||
### 获取参数
|
|
||||||
|
|
||||||
```c++
|
|
||||||
ros::NodeHandle n;
|
|
||||||
string session_s;
|
|
||||||
n.getParam("camera/session", session_s);
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
19
ros c++.md
Normal file
19
ros c++.md
Normal file
@ -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);
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
25
ros python.md
Normal file
25
ros python.md
Normal file
@ -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代码
|
||||||
|
```
|
||||||
Loading…
x
Reference in New Issue
Block a user