Skip to content
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

functions to write urdf xml to file? #12

Closed
baxelrod-bdai opened this issue Oct 25, 2013 · 4 comments
Closed

functions to write urdf xml to file? #12

baxelrod-bdai opened this issue Oct 25, 2013 · 4 comments
Labels

Comments

@baxelrod-bdai
Copy link

I am looking for functions to write a urdf xml file but can't seem to find any. Basically, I am reading joint and body data from another file format, and would like to convert it to URDF.

It looks like this functionality might exist in "urdf_parser_py", but i'm not sure. Other than that, the only other thing i can find that looks like it writes urdf files is "robot_model/collada_urdf/src/collada_to_urdf.cpp".

Thanks

@jacquelinekay
Copy link
Contributor

Using urdf_parser_py, the following sample code should work.

from urdf_parser_py.urdf import URDF

robot = URDF.from_xml_file("calvin.urdf")

# change robot model programatically

xml_string = robot.to_xml_string()
print xml_string

We could add this functionality to the C++ API and/or update the documentation for urdf_parser_py.

@baxelrod-bdai
Copy link
Author

Thanks, I would like the C++ API.

@jacquelinekay jacquelinekay reopened this Dec 10, 2015
@sbarthelemy
Copy link

It already exists:

TiXmlDocument* exportURDF(const ModelInterface &model);

You can write to a file with something like this:

boost::scoped_ptr<TiXmlDocument> tiXmlDoc(urdf::exportURDF(mymodel));
TiXmlPrinter printer;
tiXmlDoc->Accept(&printer);
std::cout << printer.Str();

@sloretz
Copy link
Contributor

sloretz commented Aug 10, 2017

Hi @benaxelrod, it looks like it has been a while since this was updated. I'm assuming the post by @sbarthelemy answers the question. Feel free to reopen if that's not the case.

@sloretz sloretz closed this as completed Aug 10, 2017
Karsten1987 pushed a commit to Karsten1987/urdfdom that referenced this issue Nov 15, 2018
[joint] reset `JointMimic` pointer on clear
clalancette pushed a commit that referenced this issue Oct 16, 2020
clalancette pushed a commit that referenced this issue Jun 30, 2021
clalancette pushed a commit that referenced this issue Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants