python ros 关闭节点
def myhook():
print "shutdown time!"
rospy.on_shutdown(myhook)
或
rospy.signal_shutdown(reason)
- 初始化节点关闭
- reason 为关闭理由,字符串内容。
例子:
#!/usr/bin/env python
import rospy
import math
import sys
from tf import transformations
from geometry_msgs.msg import PoseWithCovarianceStamped
class PoseSetter(rospy.SubscribeListener):
def __init__(self, pose):
self.pose = pose
def peer_subscribe(self, topic_name, topic_publish, peer_publish):
p = PoseWithCovarianceStamped()
print("hh")
p.header.frame_id = "map"
p.pose.pose.position.x = self.pose[]
p.pose.pose.position.y = self.pose[]
(p.pose.pose.orientation.x,
p.pose.pose.orientation.y,
p.pose.pose.orientation.z,
p.pose.pose.orientation.w) = transformations.quaternion_from_euler(, , self.pose[])
p.pose.covariance[*+] = 0.5 * 0.5
p.pose.covariance[*+] = 0.5 * 0.5
p.pose.covariance[*+] = math.pi/12.0 * math.pi/12.0
peer_publish(p)
print("ll")
rospy.signal_shutdown("closed!") x=True
print("dd")
pose = [-9.983256,-2.641909,-1.201580]#x,y,a
rospy.init_node('pose_setter', anonymous=True)
if(x):
print("tt")
pub=rospy.Publisher("initialpose", PoseWithCovarianceStamped,PoseSetter(pose),queue_size=)
x=False
else:
print("x=False")
print("ff")
rospy.spin()
print("pp")
python ros 关闭节点的更多相关文章
- python ros 创建节点订阅robot_pose
建立文件夹hello_rospy,再在该目录下建立子目录src,cd到该src目录,运行如下命令创建工作包 catkin_create_pkg beginner_tutorials std_msgs ...
- 理解ROS的节点(NODE)
经过前面的学习,我们已经知道了如何构建一个ROS的包,这篇博客将介绍ROS中的节点的概念. 在继续之前,请按ctrl+alt+t打开一个终端,在里面输入: sudo apt-get install r ...
- ROS 进阶学习笔记(13) - Combine Subscriber and Publisher in Python, ROS
Combine Subscriber and Publisher in Python, ROS This article will describe an example of Combining S ...
- [Flex] 组件Tree系列 —— 打开和关闭节点
mxm: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:打开和关闭节点--> < ...
- ROS向节点传递参数
ROS的节点有很多中调用方式,包括rosrun,launch,直接运行等,向节点内传递参数的方式也有很多. 1. rosrun + 参数服务器传递 ros::init(argc, argv, &quo ...
- Python - 记录我开始学习Python的时间节点
记录我开始学习Python的时间节点 2019-09-22 从明天开始我要开始学习Python了,坚持学习.坚持写博客,慢慢积累. 结合实例项目,最好能把目前在做的项目用Python实现. 加油!
- (六)ROS话题---节点之间通信的方式
1. 理解 ROS 话题: (Ctrl+Alt+T 打开一个新终端) 运行下面的命令: $ roscore (Ctrl+Alt+T 打开一个新终端) $ rosrun turtlesim turtle ...
- python ros topic demo
发布者: #!/usr/bin/env python #coding=utf- import rospy from std_msgs.msg import String def talker(): ...
- python ros 订阅imu数据,实时显示欧拉角
#!/usr/bin/env python # -*- coding: utf- -*- import rospy import math from sensor_msgs.msg import Im ...
随机推荐
- dfs模板(真心不会深搜)
栈 #include <stdio.h> #include <string.h> ][]; ][]; ,-, , }; , ,-, }; int Min; void dfs(i ...
- 使用Fiddler远程抓包
Fiddler简介以及web抓包 一.Fiddler简介 简单来说,Fiddler是一个http协议调试代理工具,它能够记录并检查所有你的电脑和互联网之间的http通讯.网上简介很多,我们不多说. 二 ...
- Django-made基础
知识预览 ORM 创建表(建立模型) 添加表记录 查询表记录 修改表记录 删除表记录 回到顶部 ORM 映射关系: 表名 <-------> 类名 字段 <-------> 属 ...
- Winter Storm Warning
2019-01-02 11:22:33 ...WINTER STORM WARNING REMAINS IN EFFECT UNTIL 6 AM AKST TUESDAY... * WHAT...He ...
- SV中的Interface和Program
Interface:SV中新定义的接口方式,用来简化接口连接,使用时注意在module或program之外定义interface,然后通过'include来添加进工程. interface arb_ ...
- “System.Data”中不存在类型或命名空间名称“TypedTableBase”
错误 1 命名空间“System.Data”中不存在类型或命名空间名称“TypedTableBase”(是否缺少程序集引用?) 解决方案 因为是把强类型DataSet文件绑定报表的项目中出现的错误, ...
- SQL查询日历
这东西给自己留着用. 经常会用到一些查询需要做全月统计,但有些时候的统计需要将未发生日期也显示出来,因此会需要一个固定的日期表,(T6的自定义查询估计也是需要的,至少以前是这样) 下面写两种方法来获取 ...
- python webdriver操作浏览器句柄
断言 assert self.driver.title.find(u"搜狗搜索引擎")>=0, "assert error" 浏览器后退,前进,前进前要先 ...
- click 在网页测试手机模式下无效,不能执行。调成非手机模式即可
click 在网页测试手机模式下无效,不能执行. 调成非手机模式即可
- Linux服务器---apache支持SSL
Apache支持ssl 1.检测是否安装ssl模块,如果没有就安装 [root@localhost cgi-bin]# rpm -qa | grep mod_ssl //查看是否安 ...