-
Notifications
You must be signed in to change notification settings - Fork 21
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
Update URDF parsing logic and improve R/W operations on files #100
Conversation
## Hack to remove the encoding urdf, see https://github.com/icub-tech-iit/ergocub-gazebo-simulations/issues/49 | ||
with open(model_path, "r", encoding="utf-8") as robot_file: | ||
robot_urdf_string = ( | ||
robot_file.read() | ||
.replace("<?xml", "") | ||
.replace("version='1.0'", "") | ||
.replace("encoding='UTF-8'?>", "") | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@traversaro @CarlottaSartore did ros/urdf_parser_py#83 fix ros/urdf_parser_py#82? If yes, maybe these lines that remove the encoding can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, but no release was done, so I guess the issue is still present in the latest release, and the problem is also that the pypi package is abandoned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I see, so probably the solution for ADAM is to just migrate to something else, at one point in the future. Thanks for the feedback!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I guess we need to migrate soon :/
Thanks a lot @flferretti! :) |
## Hack to remove the encoding urdf, see https://github.com/icub-tech-iit/ergocub-gazebo-simulations/issues/49 | ||
with open(model_path, "r", encoding="utf-8") as robot_file: | ||
robot_urdf_string = ( | ||
robot_file.read() | ||
.replace("<?xml", "") | ||
.replace("version='1.0'", "") | ||
.replace("encoding='UTF-8'?>", "") | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I guess we need to migrate soon :/
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "CZMO7PsmKUB6" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just selecting a few lines, but I'm considering the whole file. I was wondering: which is the automatic formatter you used? I will put it in the dependencies ;)
I would remove this file from this PR for now (just to enhance the clarity of this PR) and maybe add it in a new PR that just formats the files!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using black[jupyter]
and isort
for formatting.
Formatting removed in 79f6d67 with rebase
e68b68a
to
79f6d67
Compare
This PR updates the parsing logic for URDF files by bounding the check on file existence to the maximum path length allowed by the OS. Moreover, some changes were made to make the RW operations on files safer and some final linting was performed.
Closes ami-iit/comodo#21
📚 Documentation preview 📚: https://adam-docs--100.org.readthedocs.build/en/100/