How to rename the ROS interface node name?

Typically: "How do I... ", "How can I... " questions
Post Reply
mthor13
Posts: 25
Joined: 03 Jul 2017, 08:32

How to rename the ROS interface node name?

Post by mthor13 » 13 May 2019, 19:51

Dear all,

I am trying to run several instances of V-REP in parallel and I currently face a problem with the ROS interface.
The problem is that when I open multiple V-REP instances they all start the ROS node called /vrep_ros_interface which triggers a shutdown request for that node.

Is there a way to rename /vrep_ros_interface when I open a new instance of V-REP?

Best Regards,
Mathias Thor

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

Re: How to rename the ROS interface node name?

Post by fferri » 14 May 2019, 08:27

Hi mthor13,

currently the node name is hardcoded, and passed to ros::init() during plugin initialization.

You can change v_repExtRosInterface/src/vrep_ros_interface.cpp line 511 such that the node name is read from an external source.

For example, read it from an environment variable:

Code: Select all

const char* node_name = std::getenv("VREP_ROSINTERFACE_NODE_NAME");
// if not given, use the default name:
if(!node_name) node_name = "vrep_ros_interface";
ros::init(argc, argv, node_name);
then you can pass the node name on the command line with:

Code: Select all

VREP_ROSINTERFACE_NODE_NAME=node1 ./vrep
For the next release, we will support this in a more standardized way.

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

Re: How to rename the ROS interface node name?

Post by fferri » 14 May 2019, 13:55

With the latest version of V-REP (v_rep, include, common, and v_repClientApplication git repositories, or wait for 3.6.1.rev4 to be released) and RosInterface, you can set the node name by passing a -GRosInterface.nodeName=MyNodeName command-line option to V-REP.

mthor13
Posts: 25
Joined: 03 Jul 2017, 08:32

Re: How to rename the ROS interface node name?

Post by mthor13 » 16 May 2019, 08:49

Hi fferri,

Thank you very much for your replay. And also thank you for implementing this in rev4!

Best Regards,
Mathias Thor

Post Reply