ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Is it somehow possible to change the master URI and recall ros init? [closed]

asked 2015-10-04 11:35:56 -0500

I want to programm a node which is running and trying to find the ros master. It has an external non ROS interface to change the masters address and should if the master address is changed deregister and shutdown all connections, set the new master URI and connect again.

Is that possible somehow?

I tried to run ros::init multiple times with calling putenv("ROS_MASTER_URI=...") before but it does not seem to change the master uri when checking it with ros::master::getURI. Unfortunately this doesn't work. It seems to keep the first master URI.

        std::string hostname="localhost";
        std::stringstream ss;
        ros::init(argc, argv, "node");

        ROS_INFO_STREAM("Master: "<<ros::master::getURI());
        if(ros::master::check()) master_up();

->in a while loop always returns Master: http://localhost1:11311

Can I reset the master uri on runtime somehow?

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by cyborg-x1
close date 2015-10-04 12:12:59.381800

1 Answer

Sort by ยป oldest newest most voted

answered 2015-10-04 12:12:29 -0500

updated 2015-10-04 12:12:45 -0500

ok seems to be not possible, I found another question about that:

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-10-04 11:35:56 -0500

Seen: 1,464 times

Last updated: Oct 04 '15