Page 1 of 1

How to rename the ROS interface node name?

Posted: 13 May 2019, 19:51
by mthor13
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

Re: How to rename the ROS interface node name?

Posted: 14 May 2019, 08:27
by fferri
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.

Re: How to rename the ROS interface node name?

Posted: 14 May 2019, 13:55
by fferri
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.

Re: How to rename the ROS interface node name?

Posted: 16 May 2019, 08:49
by mthor13
Hi fferri,

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

Best Regards,
Mathias Thor

Re: How to rename the ROS interface node name?

Posted: 04 Mar 2021, 23:25
by yygyt
I would like to point out for future references that it's now -GROSInterface.nodeName=myNodeName