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

actionlib Action client missing some callbacks

asked 2018-10-03 15:35:48 -0500

campergat gravatar image

I have a simple action server that currently runs a simple procedure : it just generates 10 random numbers and publishes each of them as feedback, after that it publishes a result. I then have a simple action client that has some callback functions, which just print out the values received.

For some reason though, not all feedback sent is received by the client, or it doesn't activate the callback, even though it is all published to the /feedback topic. To be clear, I publish feedback 10 times in my server. I can see 10 feedback messages in /feedback topic, but the callback in the client is only called around 4 times.

I thought this might have something to do with the callback queue size in the client, so I added the following lines to my server code:

nh_.setParam("actionlib_client_sub_queue_size", 30);
nh_.setParam("actionlib_client_pub_queue_size", 30);

I understand that the ActionClient looks for these parameters to set the queue size, am I correct? Setting them made no difference unfortunately, even though I have verified that the param is being set correctly.

Am I misunderstanding something? Is there another way to set the queue size for the ActionClient?

Could there be another reason for this behavior? Clearly the client and server are connected properly, since some of the feedback is received.

Any help would be greatly appreciated.

edit retag flag offensive close merge delete

Comments

We need to see your code to debug anything. The queue size plays part only if the publishing rate of the message is greater then subscribing rate.

l4ncelot gravatar image l4ncelot  ( 2018-10-04 08:46:16 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-01-15 16:23:23 -0500

campergat gravatar image

In the end, the problem was that the parameters were being set in the wrong namespace. They have to be in the same namespace as the Action itself. That wasn't obvious to me.

So if you declare your Client something like this:

actionlib::SimpleActionClient<WhateverAction> ac("/robot/your/action", true);

Then your parameters need to be set like this:

nh_.setParam("/robot/your/action/actionlib_client_sub_queue_size", 30);
nh_.setParam("/robot/your/action/actionlib_client_pub_queue_size", 30);
edit flag offensive delete link more

Comments

1

@campergat or you can use private namespace of the node with ~ sign. Have a look at q#250092

l4ncelot gravatar image l4ncelot  ( 2019-01-17 09:24:17 -0500 )edit

@l4ncelot's suggestion is a better solution IMO. Hardcoding stuff like this makes your code less portable/reusable which @l4ncelot's suggestion avoids

jayess gravatar image jayess  ( 2019-01-17 17:46:38 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2018-10-03 15:35:48 -0500

Seen: 538 times

Last updated: Jan 15 '19