-
Notifications
You must be signed in to change notification settings - Fork 773
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
Support to use gazebo and ROS parameters when using rosrun #387
Comments
Which version of gazebo are you using? I was just able to |
I run a source build of Gazebo 7.0.0 . I can also test with 2.2.6 tomorrow. |
I tested with gazebo7 built from source |
what do you see if you add |
...together with ROS Indigo on Trusty, if that matters. |
This is the error when running
This issue is present in gazebo 2.2.3 installed via I actually think it makes sense |
Hm...I might not understand what the problem is. I wouldn't expect the following to work because it gives invalid arguments to gazebo:
But gazebo can be launched from a launch file (empty_world.launch). Is there something broken about |
Aha, the behavior is kind of weird.
runs correctly.
fails with
So it seems Gazebo requires the first "non-option" (without dash) This fortunately means that the current way of running gazebo via However, it may stop working at any time when Gazebo stops silently Martin Pecka |
removing the ROS remappings from the scripts sounds good to me |
thanks for the contribution. closing. |
Removing the ROS remappings here breaks things (like remappings!) |
@jonbinney Hmm, seems you're right. We fixed a possible segfault, but obviously have broken ROS remapping support. @j-rivero @scpeters Should we rather fix this in |
eeeh, ooh, ... I failed reading the propose of the script and though that it only took care of the gazebo call. Sorry for that.
Upstream gazebo code should know nothing about ROS so we need to implement the patch in gazebo_ros_pkgs code. I'm going to revert the change and release tomorrow while we find a different solution. |
Ok, so we need a "bash magic" that'd go through all arguments, split them into ROS- and non-ROS arguments, put the non-ROS ones first, and the ROS arguments last? Would that work well? At least for (my) original scenario, that should fix the problem. |
In ROS nodes, the ros client code magically removes the ROS specific arguments, so the program's normal command line parsing only sees what is left: http://wiki.ros.org/roscpp/Overview/Initialization%20and%20Shutdown#Accessing_Your_Command_Line_Arguments One extreme option would be to write a thin C++ wrapper to gazebo that just initializes ROS and then runs gazebo as normal. I'm not very familiar with the gazebo codebase though, so there are probably reasons that would be bad. |
After reviewing the whole issue I have some clear ideas now:
Anything more I could be missing? |
Re-ordering the arguments sounds like a reasonable approach to me. In that case the only argument that gazebo will use is the first one, which will be the world name, right? Does gazebo ignore all arguments after the first one? |
My knowledge of boost program_options is limited but I would say that it allows unregistered arguments after it found the world file. That makes sense if we want to allow the plugins to use command line arguments. |
Martin, John if you could give a quick try to the PR to make sure that I'm not breaking anything serious, that would be awesome. Thanks for the comments. |
@j-rivero Sounds reasonable to me. Maybe the wrapper should issue some kind of warning about what it did with the arguments. It's just not clear to me what kind of warning it should be - neither ROS nor Gazebo are initialized in the wrapper script to provide the logging capabilities. Maybe a simple stderr printout? (An obscure way to get some "standardized" log record would be publishing to I got a little bit confused when I looked at rosrun docs and source. There it is stated that even rosrun itself can take arguments other than package, program and the remappings (like Last, we could try to somehow formalize all the steps that take part in this argument reordering magic. I think it would be nice to say it explicitly in the docs (of upstream Gazebo) that all arguments following the world name are ignored by gazebo server itself and are dedicated for processing by system plugins. And add a test for this case (if it's not yet there). |
If I try to run
gzserver
from a roslaunch file, e.g. like this:gzserver
crashes withI found out it is because of the
__name
and__log
ROS parameters passed torosrun
. The commandline parameters actually are:And I've found out that
gzserver
doesn't like the ROS arguments on its commandline (nor doesrosrun
remove them, which I'd expect).I propose to patch the
gzserver
,gzclient
andgazebo
scripts by adding a line like:which would remove all ROS remapping arguments from the commandline. Or would it be better to remove all ROS argument mappings, just for case someone passes some params?
Or is this whole case just a misconfiguration of my computer? Could you please test with e.g.
The text was updated successfully, but these errors were encountered: