republish.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import roslib; roslib.load_manifest('maxwell_navigation')
00004 import rospy
00005 
00006 from sensor_msgs.msg import LaserScan
00007 
00008 class republish:
00009 
00010     def __init__(self):
00011         rospy.init_node("short_scan")
00012         rospy.Subscriber("base_scan", LaserScan, self.laserCb)
00013         self.scanPub = rospy.Publisher('scan', LaserScan)
00014         rospy.spin()
00015 
00016     def laserCb(self, msg):
00017         n_ranges = list()
00018         for i in range(len(msg.ranges)):
00019             if msg.ranges[i] == 0.0:
00020                 n_ranges.append(5.2)
00021             else:
00022                 n_ranges.append(msg.ranges[i])
00023         msg.ranges = n_ranges
00024         self.scanPub.publish(msg)
00025 
00026 if __name__ == "__main__":
00027     a = republish()
00028 


maxwell_navigation
Author(s): Michael Ferguson
autogenerated on Mon Oct 6 2014 02:15:44