0
$\begingroup$

Rosanswers logo

I am trying to create a SimpleActionClient in my Python service node using the following lines of code:

move_base_client = actionlib.SimpleActionClient('move_base', MoveBaseAction)
move_base_client.wait_for_server()

I've got this working previously but I'm now trying to implement it on a different system where move_base is already running.

The code just hangs when it waits for the server and I'm not sure why. I'd like to verify that move_base_client has connected to the move_base topic as instructed to begin troubleshooting.

Any ideas on how I might do this?


Originally posted by Py on ROS Answers with karma: 501 on 2022-01-06

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

You need to make sure the action server is running. Do a rostopic list | grep goal and look for topics ending with ".../goal". The entire "..." part is the name of the action server.


Originally posted by Mike Scheutzow with karma: 4903 on 2022-01-06

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$
0
$\begingroup$

Rosanswers logo

You may try to specify a timeout period for wait_for_server. The following code will display a message if the connection cannot be established after waiting for 2 seconds.

while move_base_client.wait_for_server(timeout=rospy.Duration(2.0)) === False:
    rospy.loginfo("waiting")
    # other actions
    # ...

ref: https://github.com/ros/actionlib/blob/noetic-devel/actionlib/src/actionlib/simple_action_client.py#L66


Originally posted by miura with karma: 1908 on 2022-01-06

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.