0
$\begingroup$

Rosanswers logo

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.


Originally posted by campergat on ROS Answers with karma: 11 on 2018-10-03

Post score: 1


Original comments

Comment by l4ncelot on 2018-10-04:
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.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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);

Originally posted by campergat with karma: 11 on 2019-01-15

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by l4ncelot on 2019-01-17:
@campergat or you can use private namespace of the node with ~ sign. Have a look at q#250092

Comment by jayess on 2019-01-17:
@l4ncelot's suggestion is a better solution IMO. Hardcoding stuff like this makes your code less portable/reusable which @l4ncelot's suggestion avoids

$\endgroup$

Your Answer

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