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

Revision history [back]

click to hide/show revision 1
initial version

Based on your problem description and code snippet, it seems like the main issue is that your move_base_client is not correctly waiting for the robot to reach the goal before sending the next one.Utilize SimpleActionClient methods: SimpleActionClient offers various methods to manage goal execution.

The wait_for_result() function waits until the server finishes executing the action. You could try using the wait_for_result() function with a timeout parameter, like so:

def go_to_waypoint(self, goal):
    server_up = self.move_base_client.wait_for_server()
    if server_up:
        self.move_base_client.send_goal(goal)
        finished_within_time = self.move_base_client.wait_for_result(rospy.Duration(10))
        if not finished_within_time:
            self.move_base_client.cancel_goal()
            rospy.loginfo("Timed out achieving goal")
        else:
            rospy.loginfo(self.move_base_client.get_result())
        server_check = self.move_base_client.wait_for_server(timeout=rospy.Duration(10.0))
        print('Server up after goal send?: ' + str(server_check))
    else:
        print("Cannot send goal to move_base. Server down")

Based on your problem description and code snippet, it seems like the main issue is that your move_base_client move_base_client is not correctly waiting for the robot to reach the goal before sending the next one.Utilize SimpleActionClient methods: SimpleActionClient one. SimpleActionClient offers various methods to manage goal execution.

The wait_for_result() wait_for_result() function waits until the server finishes executing the action. You could try using the wait_for_result() wait_for_result() function with a timeout parameter, like so:

def go_to_waypoint(self, goal):
    server_up = self.move_base_client.wait_for_server()
    if server_up:
        self.move_base_client.send_goal(goal)
        finished_within_time = self.move_base_client.wait_for_result(rospy.Duration(10))
        if not finished_within_time:
            self.move_base_client.cancel_goal()
            rospy.loginfo("Timed out achieving goal")
        else:
            rospy.loginfo(self.move_base_client.get_result())
        server_check = self.move_base_client.wait_for_server(timeout=rospy.Duration(10.0))
        print('Server up after goal send?: ' + str(server_check))
    else:
        print("Cannot send goal to move_base. Server down")

Based on your problem description and code snippet, it seems like the main issue is that your move_base_client is not correctly waiting for the robot to reach the goal before sending the next one. SimpleActionClient offers various methods to manage goal execution.

  • I have produced a video about it as well -> link

The wait_for_result() function waits until the server finishes executing the action. You could try using the wait_for_result() function with a timeout parameter, like so:

def go_to_waypoint(self, goal):
    server_up = self.move_base_client.wait_for_server()
    if server_up:
        self.move_base_client.send_goal(goal)
        finished_within_time = self.move_base_client.wait_for_result(rospy.Duration(10))
        if not finished_within_time:
            self.move_base_client.cancel_goal()
            rospy.loginfo("Timed out achieving goal")
        else:
            rospy.loginfo(self.move_base_client.get_result())
        server_check = self.move_base_client.wait_for_server(timeout=rospy.Duration(10.0))
        print('Server up after goal send?: ' + str(server_check))
    else:
        print("Cannot send goal to move_base. Server down")