ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

The problem lies here

    for x in range (90):    #  --> loop 90 times
     # --> check if range at specific angle is lowest visited so far
     if data.ranges[angle] <  self.laser_scan: 
         self.laser_scan = data.ranges[angle]
     angle = angle + 1  # --> increment angle

     # WITHOUT LEAVING FOR LOOP call stop() or print go
     if self.laser_scan < 1.5:
          stop()
     else:
          print('go')

This means you'd print either stop or go 90 times PER SCAN! The indentation of the last if clause is wrong.