30 这是一个小强驱动包的假节点。这个节点发布以下几个topic 36 同时发布odom -> baselink 的 静态tf变换 40 from geometry_msgs.msg
import Pose2D
41 from nav_msgs.msg
import Odometry
42 from std_msgs.msg
import Float64, Int32
44 if __name__ ==
"__main__":
45 rospy.init_node(
"fake_xiaoqiang_driver", anonymous=
True)
47 odom_pub = rospy.Publisher(
"odom", Odometry, queue_size=0)
48 status_flag_pub = rospy.Publisher(
"status_flag", Int32,
50 pose_pub = rospy.Publisher(
"pose2d", Pose2D, queue_size=0)
51 power_pub = rospy.Publisher(
"power", Float64, queue_size=0)
52 while not rospy.is_shutdown():
53 now = rospy.Time.now()
55 odom.header.stamp = now
56 odom.header.frame_id =
"odom" 57 odom.child_frame_id =
"base_footprint" 58 odom.pose.pose.orientation.x = 0
59 odom.pose.pose.orientation.y = 0
60 odom.pose.pose.orientation.z = 0
61 odom.pose.pose.orientation.w = 1
62 odom_pub.publish(odom)
65 status_flag_pub.publish(status)
67 pose_pub.publish(mPose)
70 power_pub.publish(power)