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

How to verify correct actionlib.SimpleActionClient setup?

asked 2022-01-06 03:36:48 -0600

Py gravatar image

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?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2022-01-06 12:14:54 -0600

Mike Scheutzow gravatar image

updated 2022-01-08 11:01:18 -0600

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.

edit flag offensive delete link more
1

answered 2022-01-06 17:27:04 -0600

miura gravatar image

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...

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2022-01-06 03:36:48 -0600

Seen: 133 times

Last updated: Jan 08 '22