ROS进二阶学习笔记(1) TF 学习笔记2 -- TF Broadcaster
Ref: http://wiki.ros.org/tf/Tutorials#Learning_tf
>>Ref: Writing a tf broadcaster (Python)
This tutorial teaches you how to broadcast the state of a robot to tf.
Ref内的东西请读者自行研读,这里要做点总结:
- /tf topic上 是有一个发布器broadcaster 发布 /tf 消息才能被 /tf 的 listener 收听到。
- /tf 的发布器类:python: tf.TransformBroadcaster 所以我们要理解它里面的方法: sendTransform(translation, rotation, time, child, parent)
1. 先看看tf broadcaster的示例代码:
#!/usr/bin/env python
import roslib
roslib.load_manifest('learning_tf')
import rospy
import tf
import turtlesim.msg
def handle_turtle_pose(msg, turtlename):
br = tf.TransformBroadcaster()
br.sendTransform((msg.x, msg.y, 0), #the translation of the transformtion as a tuple (x, y, z)
tf.transformations.quaternion_from_euler(0, 0, msg.theta),
#the rotation of the transformation as a tuple (x, y, z, w)
rospy.Time.now(), #the time of the transformation, as a rospy.Time()
turtlename, #child frame in tf, string
"world") #pa

本文是ROS进阶学习笔记的一部分,详细介绍了如何使用Python编写TF Broadcaster。内容包括TF Broadcaster的基本概念、sendTransform方法、TransformBroadcaster类的使用,以及如何通过launch文件启动TF Broadcaster并进行结果验证。
 TF 学习笔记2: -- TF Broadcaster 编写 (Python)&spm=1001.2101.3001.5002&articleId=52183461&d=1&t=3&u=107ae128cbf544feb22bcdaf969b3c5f)
4226

被折叠的 条评论
为什么被折叠?



