python ros 设置机器人的位置
2024-09-05 22:50:09
#!/usr/bin/env python
import rospy
import math
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()
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)
x=True
pose = [-9.983256,-2.641909,-1.201580]#x,y,a
rospy.init_node(‘pose_setter‘, anonymous=True)
pub=rospy.Publisher("initialpose", PoseWithCovarianceStamped, queue_size=)
pub.publish(PoseSetter(pose))
最新文章
- PHP获取指定月份的第一天开始和最后一天结束的时间戳函数
- [ubuntu]用ubuntu开发的日子----win7 ubuntu双系统
- 明白python文件如何组织,理解建立源文件
- 对sizeof的思考
- 多线程程序设计学习(4)guarded suspension模式
- (十二)学习CSS之display属性
- 网站WAF的检测
- careercup-C和C++ 13.4
- Twitter 工程师谈 JVM 调优
- [PWA] 13. New db and object store
- Javascript DOM编程艺术JS代码
- Linux简介与厂商版本下
- JavaSE教程-04Java中循环语句for,while,do···while
- 中国移动飞信WAP登陆分析及脚本
- nyoj 仿射密码
- linux安装postgresql简洁版
- 修改xampp-apache访问目录
- linux开通端口允许其他机器访问
- Angular2+URL中的 # 引发的思考
- 【JAVA】使用IntelliJ IDEA创建Java控制台工程