min_max_finder.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import roslib; roslib.load_manifest('acc_finder')
00003 import rospy
00004 
00005 from geometry_msgs.msg import Twist
00006 from nav_msgs.msg import Odometry
00007 
00008 lin_min = 0.0
00009 lin_max = 0.0
00010 ang_min = 0.0
00011 ang_max = 0.0
00012 
00013 def odom_cb(msg):
00014     global lin_min, lin_max, ang_min, ang_max
00015     if lin_min > msg.twist.twist.linear.x:
00016         lin_min = msg.twist.twist.linear.x
00017     if lin_max < msg.twist.twist.linear.x:
00018         lin_max = msg.twist.twist.linear.x
00019     if ang_min > msg.twist.twist.angular.z:
00020         ang_min = msg.twist.twist.angular.z
00021     if ang_max < msg.twist.twist.angular.z:
00022         ang_max = msg.twist.twist.angular.z
00023 
00024     rospy.loginfo('linear: [%f, %f]   angular: [%f, %f]', lin_min, lin_max,
00025             ang_min, ang_max)
00026 
00027 def listener():
00028     rospy.init_node('acc_finder', anonymous=True)
00029     rospy.Subscriber('odom', Odometry, odom_cb)
00030     rospy.loginfo('min_max_finde node ready and listening. now use teleop to move your robot to the limits!')
00031     rospy.spin()
00032 
00033 if __name__ == '__main__':
00034     listener()


acc_finder
Author(s): Martin Guenther
autogenerated on Wed Aug 26 2015 16:40:23