Naming consistency in parsing libraries
Right now, we have dart::utils::SkelParser which parses the native DART format .skel, and then we have dart::utils::DartLoader which unintuitively loads .urdf, and then there's dart::utils::SdfParser which is a class for loading SDFs, except all its functions are static, so it's really more of a namespace than a class (the situation for SkelParser is the same).
I would propose the following:
-
kido::utils::skelshould be the namespace for the functions that parse the.skelformat. The functions should not be in a class namedSkelParserat all. This namespace will encapsulate acomponentlibrary namedkido-utils-skelwith a dependency ontinyxml2(related to the discussion here #434). -
kido::utils::sdfshould be the namespace for the functions that parse the.sdfformat. Similarly, those functions should not be in a class namedSdfParserat all. This namespace will encapsulate acomponentlibrary namedkido-utils-sdfwith a dependency onsdformat. -
kido::utils::urdfshould be the namespace for the classkido::utils::urdf::Loader. The urdf parsing still needs a class at the moment, in order to add package directories. The namespace will encapsulate acomponentlibrary namedkido-utils-urdfwith a dependency onurdfdom.
I suggest we at least do this for the first major release of KIDO. I don't know for sure whether or not we want to implement this in the next major release of DART as well.
Overall idea sounds good. Here is a quick note.
SkelParser is changed to a namespace in shapenode branch. Things to do are (1) changing the name of namespace and (2) moving them into skel folder like urdf and sdf.
VskParser should also follow the convention.
The name utils was used to represent more general functionalities including the current files in common directory. As utils now contains only save (and load in the future) functionality, io namespace would be more informative name for the namespace rather than utils.
VskParser should also follow the convention.
io namespace would be more informative name for the namespace rather than utils
I like both of those ideas :+1:
I think we should make DartLoader a collection of static methods as well. You can specify package paths using PackageResourceRetriever. The methods on DartLoader are deprecated and only exist for backwards compatibility - they're thin wrappers around PackageResourceRetriever.
-Mike On Thu, Feb 4, 2016 at 8:46 AM Jeongseok Lee [email protected] wrote:
Overall idea sounds good. Here is a quick note.
SkelParser is changed to a namespace in shapenode branch https://github.com/dartsim/dart/blob/shapenode/dart/utils/SkelParser.h. Things to do are (1) change the name of namespace and move them into a skel folder like urdf and sdf.
VskParser should also follow the convention.
The name utils was used to represent more general functionalities including the current files in common directory. As utils now contains only save (and load in the fuction), io namespace would be more informative name for the namespace rather than utils.
— Reply to this email directly or view it on GitHub https://github.com/dartsim/dart/issues/604#issuecomment-179939844.
I agree with removing the need for a class from DartLoader; I just wasn't sure if we wanted to do that immediately. Getting the naming and package management to be consistent before the major release seemed like a higher priority to me, since we can easily deprecate the loader class in the following minor release.
I'd suggest we aim to do this refactoring for DART 7.0.
@jslee02 if you don't agree, feel free to remove this from the milestone.
@mxgrey :+1: