danielsnider / follow_waypoints

Create and follow a set of navigation goals for use with ROS move_base
http://wiki.ros.org/follow_waypoints
The Unlicense
204 stars 90 forks source link

Tolerance Waypoints does not works #30

Open GitNzino opened 2 years ago

GitNzino commented 2 years ago

Hi I want to congrats you for the excellent work done, all the package works amazing!

I only have issue on waypoints tolerance because I don't want that the robot stops at each waypoints and also changing the value of tolerance the robot stops the same.

Can You help me in found some solution? I would be grateful, Lorenzo

GitNzino commented 2 years ago

In my script I am using tf2_ros, so I had some issue on time tolerance of tf because tf2_ros not publish the tf with a certain frequency as tf does.

For me worked this type of modification from line 78 to 92 of follow_waypoints.py.

self.client.send_goal(goal)
            if self.distance_tolerance <= 0.0:
                self.client.wait_for_result()
                rospy.loginfo("Waiting for %f sec..." % self.duration)
                time.sleep(self.duration)
            else:
                #This is the loop which exist when the robot is near a certain GOAL point.
                distance = 10
                while(distance > self.distance_tolerance):
                    now = rospy.Time(0)
                    self.listener.waitForTransform(self.frame_id, self.base_frame_id, now, rospy.Duration(4.0))
                    trans,rot = self.listener.lookupTransform(self.frame_id,self.base_frame_id, now)
                    distance = math.sqrt(pow(waypoint.pose.pose.position.x-trans[0],2)+pow(waypoint.pose.pose.position.y-trans[1],2))
                    # rospy.loginfo(distance)
        return 'success'