#! /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()

[((17, 4, 17, 44), 'rospy.init_node', 'rospy.init_node', ({(17, 20, 17, 43): '"""odom_topic_subscriber"""'}, {}), "('odom_topic_subscriber')", False, 'import rospy\n'), ((20, 11, 20, 25), 'rospy.Rate', 'rospy.Rate', ({(20, 22, 20, 24): '10'}, {}), '(10)', False, 'import rospy\n'), ((9, 20, 9, 85), 'rospy.Subscriber', 'rospy.Subscriber', ({(9, 37, 9, 53): 'self._topic_name', (9, 55, 9, 63): 'Odometry', (9, 65, 9, 84): 'self.topic_callback'}, {}), '(self._topic_name, Odometry, self.topic_callback)', False, 'import rospy\n'), ((10, 25, 10, 35), 'nav_msgs.msg.Odometry', 'Odometry', ({}, {}), '()', False, 'from nav_msgs.msg import Odometry\n'), ((14, 8, 14, 37), 'rospy.loginfo', 'rospy.loginfo', ({(14, 22, 14, 36): 'self._odomdata'}, {}), '(self._odomdata)', False, 'import rospy\n'), ((21, 14, 21, 33), 'rospy.is_shutdown', 'rospy.is_shutdown', ({}, {}), '()', False, 'import rospy\n')]