1. TF TREE
2. launch file
<launch>
<node pkg="tf" type="static_transform_publisher" name="map_to_odom_broadcaster" args="0 0 0 0 0 0 1 /map /odom 100" />
<node pkg="champ_gazebo" type="tf_from_odom_to_base.py" name="tf_from_odom_to_base"/>
</launch>
JavaScript
복사
3. odom_to_base
#!/usr/bin/env python
import rospy
import tf
from nav_msgs.msg import Odometry
def handle_go1_pose(msg):
br = tf.TransformBroadcaster()
quat = [msg.pose.pose.orientation.x, msg.pose.pose.orientation.y, msg.pose.pose.orientation.z, msg.pose.pose.orientation.w]
br.sendTransform((msg.pose.pose.position.x, msg.pose.pose.position.y, 0),
(quat),
rospy.Time.now(),
"base_footprint",
"odom")
if __name__ == '__main__':
rospy.init_node('tf_broadcaster')
rospy.Subscriber('/odom',
Odometry,
handle_go1_pose,
)
rospy.spin()
JavaScript
복사