-
Notifications
You must be signed in to change notification settings - Fork 480
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
URDF included in SDF 1.6 is silently corrupted in Gazebo 11 when spawned from the GUI #2728
Comments
I think this is the actual bug related to URDF included in SDF 1.4 files that I thought was due to something in sdformat and I reported (but without being able to reproduce it) in robotology-legacy/icub-gazebo-wholebody#30 @EricCousineau-TRI @scpeters @azeey @ale-git . |
which version of |
gazebosim/sdformat@f7dcdd7 on Windows (see https://github.com/iit-danieli-joint-lab/idjl-software-dependencies-vcpkg/blob/master/gazebo-repos.yaml#L37), I don't have the setup in which I reproduced it on Ubuntu but I had installed Gazebo 11 from the OSRF Ubuntu Repo that day. |
I tested again on Ubuntu, and the problem is present with SDFormat 9.2.0-1~bionic . |
I'm able to reproduce this. I think the main issue is that the included URDF is always converted to SDFormat 1.7, but we're using |
We use |
I was a bit confused by this sentence, I am trying to understand the rationale from the code, I guess this comment https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-requests/3133/page/1#comment-131669268 is related, even if I still miss which problem there is in sending SDF 1.7 files to |
Per f2f, possible next steps:
|
If anyone needs to maintain a codebase with models that need to be compatible with both Gazebo 10 and 11, for which then just bumping the SDF version to 1.7 is not a viable solution, the following CMake snippet may be useful as a temporary workaround: # Before this, copy the SDF files in ${CMAKE_BINARY_DIR} for processing
# ...
# List all the .sdf files in ${CMAKE_BINARY_DIR}
file(GLOB_RECURSE sdf_files ${CMAKE_BINARY_DIR}/*.sdf)
# Workaround for the following osrf/gazebo issues:
# * https://github.com/osrf/gazebo/issues/2728
# * https://github.com/osrf/gazebo/issues/2739
if(GAZEBO_VERSION VERSION_GREATER_EQUAL 11.0)
message(STATUS "Gazebo >= 11 detected, patching SDF models to version 1.7")
foreach(sdf_file IN LISTS sdf_files)
file(READ ${sdf_file} SDF_CONTENT)
string(REPLACE "<sdf version='1.6'>" "<sdf version='1.7'>" SDF_CONTENT_CONVERT_TO_1_7 ${SDF_CONTENT})
file(WRITE ${sdf_file} ${SDF_CONTENT_CONVERT_TO_1_7})
endforeach()
endif()
# After that, install the SDF files from ${CMAKE_BINARY_DIR}
# ... Note that this will not work if your SDF 1.6 use some features that changed meaning/is not supported in 1.7, i.e. simply changing |
When an SDFormat file is parsed, it automatically gets up-converted to the latest spec. In this case 1.7. The original version of the document is kept and it can be retrieved by calling The fact that Gazebo doesn't use frame semantics if the original version is 1.6 is also a problem with the addition of Bitbucket PR #668 and Bitbucket PR #676. Bitbucket PR #668 uses frame semantics for handling pose transforms of nested models. This now means frames have to be resolved for nesting to work properly.
Even if we made the changes from Bitbucket PR #676 optional, the problem will persist because the converted URDF is nested inside a parent model and that nesting uses frames. My suggestion is to fix Gazebo to resolve frames even if the original version is not 1.7. Otherwise, we'll have to revert both PR 668 and 676 or come up with a way to make them optional. The caveat with my suggested approach is that if the model containing the nested URDF has an error, frames may not be resolved properly. Whereas in the past Gazebo might have ignored those errors and loaded the model anyway. We can try to resolve poses even if |
Thanks for the nice explanation @azeey , I had completely overlooked that |
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Add a workaround for gazebosim/gazebo-classic#2728
I have one simple URDF file:
Click to see URDF content
that is included in two almost identical SDF files, one with version 1.6:
and another with version 1.7 :
when I spawn the models from the GUI, the SDF 1.7 is loaded correctly, while the kinematics of the SDF 1.6 model are silently loaded incorrectly, see the following GIF:
Interestingly, the urdf included models is loaded correctly if I load it in a world model, both if the world is a SDF 1.6 or 1.7 model.
I reproduced the problem on Gazebo 11 on both Windows and Linux.
To reproduce it locally, you can use this models: urdf_included_in_sdf_1_6_mwe.zip .
Short setup bash script to reproduce the GUI spawning:
on the same terminal, you can see that loading the models from a world file is working correctly:
The text was updated successfully, but these errors were encountered: