ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Ok. I finally managed to solve this. I can run now multiple instances of rosmaster and Gazebo!
Since the envioremental variables are "local" to each shell (terminal instance), you need to be careful with this. First, for running different rosmaster instances you need to change the ROS_MASTER_URI enviorement variable for each one. You also need to change the GAZEBO_MASTER_URI for each INDEPENDENT Gazebo instance you want to run. I tried it, and at first it didn't work. That's because according to THIS, you have to edit your /usr/share/gazebo/setup.sh and replace
export GAZEBO_MASTER_URI=http://localhost:11345
for
export GAZEBO_MASTER_URI=${GAZEBO_MASTER_URI:-"http://localhost:11345"}
Then save. If you dont do this change, the GAZEBO_MASTER_URI won't chance properly!!
Now, for running different instances of rosmaster:
First shell:
export ROS_MASTER_URI=http://localhost:11315
11315 is just an example. The default is 11311.
roscore -p 11315
or roslaunch some package. It'll run on the specified port ( localhost:11315 )
Second shell:
export ROS_MASTER_URI=http://localhost:11316
A different one from before!
roscore -p 11316
or roslaunch some package. It'll run on the specified port ( localhost:11316 )
Now, for running multiple Gazebo instances
Third shell:
export GAZEBO_MASTER_URI=http://localhost:11355
11355 is just an example. The default is 11345.
gazebo
Fourth shell:
export GAZEBO_MASTER_URI=http://localhost:11356
A different one from before!
gazebo
And voilĂ !