ROS real robot project: Program error

Hi,

I would suggest the following:

    def move_straight_15(self):
        if not self.Obst_detect:
            self.TW.linear.x=0.05
            self.pub.publish(self.TW)
            for i in range(50):
                if not self.Obst_detect:
                    rospy.sleep(0.1)
                else:
                    print("Obstacle Detected")
                    break

And do the same for the turn method