ROS interface automatically adds prefix to a service topic

Typically: "How do I... ", "How can I... " questions
Post Reply
Filipe Rocha
Posts: 8
Joined: 28 May 2017, 20:51

ROS interface automatically adds prefix to a service topic

Post by Filipe Rocha » 21 Feb 2019, 15:59

Hello everyone.

I am using vrep_ros_interface to communicate my simulation with ROS.

When advertising a service, I use the following LUA command:

Code: Select all

serv_handler = simROS.advertiseService('/srv_topic', '/std_msgs/foo', 'my_service_callback_function')
However, the interface generates a service topic with the following name:

Code: Select all

/vrep_ros_interface/srv_topic
It automatically adds the /vrep_ros_interface prefix. This is a problem for my application, as we are replicating a real robot interaction and the real service does not have this prefix.

Is there a way to remove that prefix?

Thank you in advance, and congratulations for the awesome simulator!

fferri
Posts: 304
Joined: 09 Sep 2013, 19:28

Re: ROS interface automatically adds prefix to a service topic

Post by fferri » 22 Feb 2019, 09:18

RosInterface does not add any prefix.

This is the Lua callback for simROS.advertiseService, and this is the included srvsrv.cpp which calls NodeHandle::advertiseService, as you can see it passes in->serviceName (the string "/srv_topic" in your case) directly to ROS.

Have you tried using "srv_topic" instead of "/srv_topic"?

Can you post the output of "rosservice list"?

Post Reply