测试 launch 文件如下, test.py 广播 TF 变换, listen_tf.py 文件监听TF变换。
<launch>
<node name="agv_driver" pkg="test" type="test.py" output="screen" respawn="true">
<rosparam file="$(find test)/config/test.yaml" command="load" />
</node>
<!--node pkg="test" type="test1" name="test1" required="true" output="screen" >
<rosparam file="$(find test)/config/test1.yaml" command="load"/>
</node-->
<node name="listen" pkg="test" type="listen_tf.py" output="screen" respawn="true">
</node>
</launch>
广播 test.py 内容如下,发布了两个TF 的数据
#!/usr/bin/env python
#-*-coding: utf-8 -*-
import rospy
from geometry_msgs.msg import Twist
import tf
class ArduinoROS():
def __init__(self):
# 唯一的节点名 日志级别为DEBUG 等级排序为 DEBUG INFO WARN ERROR FATAL
rospy.init_node('Arduino', log_level=rospy.DEBUG)
# self. 变量, 从 .yaml 获取参数

本文深入解析ROS中的TF变换原理,通过实例演示如何使用test.py广播TF变换,listen_tf.py监听TF变换并解析返回的trans和rot值。文章详细介绍了trans表示的三维坐标距离和rot表示的四元数旋转,为ROS开发者提供了实用的编程指导。
最低0.47元/天 解锁文章
1636

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



