How to rename the ROS interface node name?

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

How to rename the ROS interface node name?

Post 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

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

Re: How to rename the ROS interface node name?

Post 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.

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

Re: How to rename the ROS interface node name?

Post 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.

mthor13
Posts: 61
Joined: 03 Jul 2017, 08:32
Contact:

Re: How to rename the ROS interface node name?

Post by mthor13 »

Hi fferri,

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

Best Regards,
Mathias Thor

yygyt
Posts: 4
Joined: 21 Apr 2015, 06:47

Re: How to rename the ROS interface node name?

Post by yygyt »

I would like to point out for future references that it's now -GROSInterface.nodeName=myNodeName

Post Reply