API+Doc review
Proposer: Tim
Present at review:
- Eitan
- Wim
urdf_to_collada tool
The urdf_to_collada command-line tool takes an URDF file and converts it to a COLLADA document:
$ ./urdf_to_collada Usage: urdf_to_collada input.urdf output.dae
An example of a successful export:
$ bin/urdf_to_collada test/pr2.urdf test/pr2.dae Warning: geometry type BOX of link base_footprint not exported Warning: geometry type BOX of link base_laser_link not exported Warning: geometry type BOX of link double_stereo_link not exported Warning: geometry type BOX of link head_plate_frame not exported Warning: geometry type BOX of link high_def_frame not exported Warning: geometry type CYLINDER of link high_def_optical_frame not exported ... Warning: geometry type BOX of link wide_stereo_link not exported Document successfully written to test/pr2.dae
An example of an unsuccessful export:
$ bin/urdf_to_collada test/pr2.urdf /usr/pr2.dae Warning: geometry type BOX of link base_footprint not exported Warning: geometry type BOX of link base_laser_link not exported Warning: geometry type BOX of link double_stereo_link not exported Warning: geometry type BOX of link head_plate_frame not exported Warning: geometry type BOX of link high_def_frame not exported Warning: geometry type CYLINDER of link high_def_optical_frame not exported ... Warning: geometry type BOX of link wide_stereo_link not exported I/O error : Permission denied I/O error : Permission denied error : xmlNewTextWriterFilename : cannot open uri Error converting document: daeLIBXMLPlugin::write(file:/usr/pr2.dae) failed
collada_urdf API
The API follows the kdl_parser API. Functions exist for constructing a COLLADA document from an URDF from a variety of sources: file, string, XML document, or Model object.
A colladaToFile function writes the DOM object to disk in the COLLADA XML format.
No exceptions are thrown: errors are output via ROS_ERROR and success/failure is indicated by the boolean return value.
1 namespace collada_urdf {
2
3 /** Construct a COLLADA DOM from an URDF file
4 * \param file The filename from where to read the URDF
5 * \param dom The resulting COLLADA DOM
6 * \return true on success, false on failure
7 */
8 bool colladaFromUrdfFile(std::string const& file, boost::shared_ptr<DAE>& dom);
9
10 /** Construct a COLLADA DOM from a string containing URDF
11 * \param xml A string containing the XML description of the robot
12 * \param dom The resulting COLLADA DOM
13 * \return true on success, false on failure
14 */
15 bool colladaFromUrdfString(std::string const& xml, boost::shared_ptr<DAE>& dom);
16
17 /** Construct a COLLADA DOM from a TiXmlDocument containing URDF
18 * \param xml_doc The TiXmlDocument containing URDF
19 * \param dom The resulting COLLADA DOM
20 * \return true on success, false on failure
21 */
22 bool colladaFromUrdfXml(TiXmlDocument* xml_doc, boost::shared_ptr<DAE>& dom);
23
24 /** Construct a COLLADA DOM from a URDF robot model
25 * \param robot_model The URDF robot model
26 * \param dom The resulting COLLADA DOM
27 * \return true on success, false on failure
28 */
29 bool colladaFromUrdfModel(urdf::Model const& robot_model, boost::shared_ptr<DAE>& dom);
30
31 /** Write a COLLADA DOM to a file
32 * \param dom COLLADA DOM to write
33 * \param file The filename to write the document to
34 * \return true on success, false on failure
35 */
36 bool colladaToFile(boost::shared_ptr<DAE> dom, std::string const& file);
37
38 }
Question / concerns / comments
Enter your thoughts on the API and any questions / concerns you have here. Please sign your name. Anything you want to address in the API review should be marked down here before the start of the meeting.
- Eitan
- It would be useful to have a function where you get a Collada DOM object back rather than writing a file.
- TF: done
- It might also be nice to be able to convert the other way round... going from Collada objects and files to URDF (This isn't really a doc related concern and probably won't get done, but I just wanted to note it)
- TF: noted
- Otherwise, seems pretty good and simple.
- It would be useful to have a function where you get a Collada DOM object back rather than writing a file.
- Wim
Since the collada parser is so similar to what the kdl parser is doing, it might be good to create a similar api doc/api/kdl_parser/html/namespacekdl__parser.html. The kdl parser has a number of convenient functions to create a kdl tree from a string, a file, the parameter server, etc.
- TF: updated the API - see above
Meeting agenda
To be filled out by proposer based on comments gathered during API review period
Conclusion
Package status change mark change manifest)
Action items that need to be taken.
Major issues that need to be resolved