#! /usr/bin/env python

import rospy
from nav_msgs.msg import Odometry

class OdomTopicReader(object):
    def __init__(self, topic_name = '/odom'):
        self._topic_name = topic_name
        self._sub = rospy.Subscriber(self._topic_name, Odometry, self.topic_callback)
        self._odomdata = Odometry()

    def topic_callback(self, msg):
        self._odomdata = msg
        rospy.loginfo(self._odomdata)

if __name__ == "__main__":
    rospy.init_node('odom_topic_subscriber')
    odom_reader_object = OdomTopicReader()
    
    rate = rospy.Rate(10)
    while not rospy.is_shutdown():
        rate.sleep()

[((444, 484), 'rospy.init_node', 'rospy.init_node', (['"""odom_topic_subscriber"""'], {}), "('odom_topic_subscriber')\n", (459, 484), False, 'import rospy\n'), ((544, 558), 'rospy.Rate', 'rospy.Rate', (['(10)'], {}), '(10)\n', (554, 558), False, 'import rospy\n'), ((207, 272), 'rospy.Subscriber', 'rospy.Subscriber', (['self._topic_name', 'Odometry', 'self.topic_callback'], {}), '(self._topic_name, Odometry, self.topic_callback)\n', (223, 272), False, 'import rospy\n'), ((298, 308), 'nav_msgs.msg.Odometry', 'Odometry', ([], {}), '()\n', (306, 308), False, 'from nav_msgs.msg import Odometry\n'), ((382, 411), 'rospy.loginfo', 'rospy.loginfo', (['self._odomdata'], {}), '(self._odomdata)\n', (395, 411), False, 'import rospy\n'), ((573, 592), 'rospy.is_shutdown', 'rospy.is_shutdown', ([], {}), '()\n', (590, 592), False, 'import rospy\n')]