From 69766a009853b20e533ba21d342b8ba9b39a2020 Mon Sep 17 00:00:00 2001 From: yewuya Date: Tue, 16 May 2023 20:39:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=A3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ROS.md | 29 +++-------------------------- ros c++.md | 19 +++++++++++++++++++ ros python.md | 25 +++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 26 deletions(-) create mode 100644 ros c++.md create mode 100644 ros python.md 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