测试 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 获取参数