min_max_finder.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import roslib; roslib.load_manifest('acc_finder')
3 import rospy
4 
5 from geometry_msgs.msg import Twist
6 from nav_msgs.msg import Odometry
7 
8 lin_min = 0.0
9 lin_max = 0.0
10 ang_min = 0.0
11 ang_max = 0.0
12 
13 def odom_cb(msg):
14  global lin_min, lin_max, ang_min, ang_max
15  if lin_min > msg.twist.twist.linear.x:
16  lin_min = msg.twist.twist.linear.x
17  if lin_max < msg.twist.twist.linear.x:
18  lin_max = msg.twist.twist.linear.x
19  if ang_min > msg.twist.twist.angular.z:
20  ang_min = msg.twist.twist.angular.z
21  if ang_max < msg.twist.twist.angular.z:
22  ang_max = msg.twist.twist.angular.z
23 
24  rospy.loginfo('linear: [%f, %f] angular: [%f, %f]', lin_min, lin_max,
25  ang_min, ang_max)
26 
27 def listener():
28  rospy.init_node('acc_finder', anonymous=True)
29  rospy.Subscriber('odom', Odometry, odom_cb)
30  rospy.loginfo('min_max_finde node ready and listening. now use teleop to move your robot to the limits!')
31  rospy.spin()
32 
33 if __name__ == '__main__':
34  listener()
def odom_cb(msg)


acc_finder
Author(s): Martin Guenther
autogenerated on Mon Jun 10 2019 15:49:09