-
Notifications
You must be signed in to change notification settings - Fork 911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rostest] Randomize Gazebo port number #903
Comments
A short detour on how the random port number for
I understand your use case with running multiple tests using Gazebo. On the other hand nothing in these ROS packages knows about Gazebo at the moment. And the same request could be made for almost any other external software which needs a specific environment in order to run multiple instances in parallel. Therefore I hesitate to add something specifically for Gazebo. A "generic" feature which enables your use case for Gazebo but also covers similar use cases would be nicer. I am not sure how this can be achieved best. Since Gazebo is run from one entry in the roslaunch file it is a bit different than the ROS master described above.
|
My primary interest is in running tests concurrently from multiple repos on the same buildslave (without going to Docker or whatever for port isolation), or by a parallel catkin_tools invocation (eg catkin/catkin_tools#397). So from either of those perspectives, it would be perfectly possible to just have a However, that doesn't help the I agree in principal that it sucks to put something Gazebo-specific like this into rostest, but the complexity of a pluggable solution seems really high; given that it's just setting a var without any actual dependence, I wonder if it would be worth it. |
I would imagine the environment variable to be set on a per test level. E.g. instead of calling This approach should work fine with |
That would be picking the port number at configure time rather than execution time, wouldn't it? The idea of |
That is true. The beauty with ROS master is that it picks the port on its own before any node from the launch file is started. And then that can be used to set the environment in all nodes. I don't see yet how something similar can be done with Gazebo (in a way that ensure collision free port numbers). |
Yes, in the case of setting up the env var in advance, it will still just be a random number best effort. Without cooperation from Gazebo, that's the best that's possible. |
Since Gazebo is only one process in a launch file I don't see a good way how even with the support of Gazebo this could be improved. @ros/ros_team Any ideas how to approach this? |
It would have to be a scheme where In the short term, I still think there's value in having an option to at least randomize it, or do some kind of round-robin scheme. |
Setting the env variable to control the port Gazebo uses and randomizing that is the best option of which I can think. |
rostest has some nifty logic which allows rostests to run on top of each other, by randomizing the rosmaster's port number:
ros_comm/tools/rostest/src/rostest/rostest_parent.py
Line 84 in 98aa98e
Unfortunately, there can still be collisions with concurrent tests when Gazebo is involved, as there will be contention over the default GAZEBO_MASTER_URI value of
http://localhost:11345
. Would it be reasonable to speculatively set GAZEBO_MASTER_URI in the test environment, with a known-available port?The text was updated successfully, but these errors were encountered: