Ask Your Question
0

send a message in a specific action namespace

asked 2012-01-30 18:50:13 -0500

markkre gravatar image

Hello ROS community!

The Fibonacci Example works with my android-device & ubuntu combination. Now I adapted that example to my own purposes. It uses different messages now and the action server already exists and waits for new goal messages.

But the client is stuck at the line "sac.waitForServer();". I used rxgraph to check the problem and realized:

  • my client publishes: "goal [Type: package_xyz/message_xyz]"
  • the server subscribes to: "abc/goal [Type: package_xyz/message_xyz]"

So, both, the server and the client use the same message type, but the first part is different. I just can guess, that the first part is called "namespace"?

Therefore my question is: How can I set the namespace of my client?

I already discovered that I can create an actionClient by using "spec.buildSimpleActionClient("abc");" where "abc" is the namespace parameter. But that doesn't change anything in rxgraph and the client and the server still won't connect.

Any idea?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2012-02-01 19:23:53 -0500

markkre gravatar image

I found a solution for setting the namespace! It has to be done when setting up the NodeConfiguration:

NodeConfiguration configuration = NodeConfiguration.createDefault();
configuration.setHost(host);
configuration.setMasterUri(uri);
NameResolver res = NameResolver.createFromString("/abc");
configuration.setParentResolver(res);

Nodes and topics created with this configuration will always have the prefix "/abc", e.g. "/abc/goal" which is exactly the behaviour i needed.

edit flag offensive delete link more
0

answered 2012-01-31 02:10:56 -0500

You are probably using the cpp server/client with a rosjava counterpart. For roscpp I know how to change it:

Have a look at the fibonacci server of the actionlib_tutorials. The namespace is given as the constructor of the action_server:

00114   FibonacciAction fibonacci(ros::this_node::getName());

In the Fibonacci client it is given in the constructor in line:

00051   actionlib::SimpleActionClient<actionlib_tutorials::FibonacciAction> ac("fibonacci", true);

Should you find out where to set this in the rosjava actionlib, I would like to know.

edit flag offensive delete link more

Comments

this corresponds to the java code: FibonacciSimpleActionClient sac = spec.buildSimpleActionClient("fibonacci_client"); the topics created, however, will be called "/goal", "/cancel" instead of "/fibonacci_client/goal", "/fibonacci_client/cancel". I need latter, in other words, with name space.
markkre gravatar image markkre  ( 2012-01-31 21:30:25 -0500 )edit
does it work in roscpp, the namespacing?
markkre gravatar image markkre  ( 2012-01-31 21:31:25 -0500 )edit
The topic namespace in roscpp is the constructor parameter described above. Set it to the empty string and you will have the same as in rosjava. Don't know whether this works out when using several (different) action servers. Will they share topics then?
Felix Endres gravatar image Felix Endres  ( 2012-02-01 07:18:37 -0500 )edit
I guess they would share the topics. But then, nodes could get confused. Moreover I'm not sure, one topic name with several message types is an allowed construct. This is, where namespaces are useful. But I have found the solution already and posted it. Thank you for your answers!
markkre gravatar image markkre  ( 2012-02-01 19:27:57 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-01-30 18:50:13 -0500

Seen: 740 times

Last updated: Feb 01 '12