diff --git a/robomaster_pi/robot_ros_odom.py b/robomaster_pi/robot_ros_odom.py index bfae794eec983e2642cdcf02da77af603d9e9d07..38220c0e58d20274dec015876aa71087dace5271 100644 --- a/robomaster_pi/robot_ros_odom.py +++ b/robomaster_pi/robot_ros_odom.py @@ -40,11 +40,12 @@ def quaternion_from_euler(ai, aj, ak): class Robomaster_odom(Node): def __init__(self, ep_chassis): + super().__init__("robomaster_odom") ep_chassis.sub_position(freq=10, callback=self.sub_position_handler) def sub_position_handler(position_info): - super().__init__("robomaster_odom") + tf_broadcaster = TransformBroadcaster() t = TransformStamped() t.header.stampep_chassis = time.get_clock().now().to_msg() @@ -69,8 +70,8 @@ def main(): ep_chassis = ep_robot.chassis rclpy.init() - node1 = Robomaster_odom(ep_chassis) - rclpy.spin(node1) + node = Robomaster_odom(ep_chassis) + rclpy.spin(node) rclpy.shutdown() ep_robot.close() \ No newline at end of file