TinyURDF 1.0.0
Loading...
Searching...
No Matches
TinyURDF

TinyURDF

Modern C++17 URDF File Parsing Library.

ubuntu windows documentation coverage codecov GitHub commit activity GitHub last commit GitHub License

Table of Contents

  • Table of Contents
  • 1.0 Introduction
    • 1.1 Features
    • 1.2 Contact
    • 1.3 Contributing
  • 2.0 Building
    • 2.1 Prerequisites
    • 2.2 Dependencies
      • 2.2.1 Eigen
      • 2.2.2 TinyXML2
      • 2.2.3 loguru
      • 2.2.4 cxxopts
    • 2.4 Platforms
      • 2.4.1 Windows
      • 2.4.2 Linux
    • 2.5 Configure Options
    • 2.6 Building TinyURDF
  • 3.0 Examples
    • 3.1 Reading Model Data
    • 3.1 Build Model Graph
  • 4.0 License

1.0 Introduction

TinyURDF is an open-source C++17 library for parsing URDF model files.

This library is designed for use by projects that do not have access or do not want to rely on ROS libraries.

This project is originally derived from the ROS-based parser urdfdom Package.

1.1 Features

  • Supports complex multijoint structures, parallel multibodies and graph-based models.
  • Minimal dependencies (only Eigen), with a clean and stable API.

1.2 Contact

You can contact the maintainer through email at mail

1.3 Contributing

The project is actively in progress, and contributions are welcome. see the CONTRIBUTING file for more information.If you are interested in collaborations, contact the maintainer via mil (see section 1.2).

2.0 Building

2.1 Prerequisites

  1. C++17 compatible compiler (GCC 7.1+, Clang 5.0+, MSVC 2017+)
  2. CMake (version 3.14+)

2.2 Dependencies

2.2.1 Eigen

2.2.2 TinyXML2

2.2.3 loguru

2.2.4 cxxopts

2.4 Platforms

2.4.1 Windows

  1. Compiler: MSVC 2017, CMake: 3.22.1

2.4.2 Linux

  1. Compiler: GCC 8, CMake: Latest

Other platforms or compilers have not yet been tested. Please open an issue on GitHub Issues for any suspected bugs,

we recommend using Ninja with Microsoft Visual Studio for faster builds, for more details go to Ninja-Installtion

2.5 Configure Options

Customize the build using the following CMake options:

cmake -G Ninja \
-DBUILD_TESTS=FALSE \ # Build tests
-DBUILD_PYTHON3=FALSE \ # Enable Python 3 bindings
-DBUILD_SCRIPTS=TRUE \ # Build cpp scripts
-DBUILD_DOCS=FALSE \ # Build documentation with Doxygen
-DBUILD_MATLAB=FALSE \
-DBUILD_BUILD_SINGLE_HEADER=FALSE \
-DUSE_OPENMP=FALSE
-DBUILD_SHARED_LIBS = FALSE # build shared librarry

For Python bindings build and installation, enable the -DBUILD_PYTHON3 flag, and run the following command from the root of the project to installthem locally

bash <br> pip install --user . <br>
Note that Python bindings are not currently tested, many bugs exist. Use them at your own risk, or feel free to contribute

TinyURDF will soon be available for installation via vcpkg.

2.6 Building TinyURDF

Run the following commands to build the project:

mkdir build && cd build
cmake -G Ninja ..
ninja
ninja install

By default, this will use the MSVC compiler on Windows and the default CMake options. To use a different compiler with Ninja, run:

cmake -G Ninja -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc ..
make
make install

for Unix-based Systems or MinGW on Windows If you prefer not to use Ninja, you can build the project using Unix Makefiles:

mkdir build && cd build
cmake -G "Unix Makefiles" ..
make
make install

These commands will build and install the static/shared library under the lib/ directory and the include files in the include/ directory of the build folder.

3.0 Examples

3.1 Reading Model Data

int main() {
// Create and run the parser
URDFParser parser;
bool eResult = parser.parse("path/to/tinyurdf/examples/urdf/example.urdf");
if(!eResult){
return 0;
}
// Retrieve the parsed model
std::shared_ptr<Model> model_ = parser.get();
// Print model info
std::cout << model_->toString();
// Access model metadata
std::string name = model_->getName();
bool status = model_->empty();
// Access model structure
std::vector<std::shared_ptr<Joint>> joints_ = model_->getJoints();
std::vector<std::shared_ptr<Link>> links_ = model_->getLinks();
return 0;
}
Main user high-level interface for parsing URDF files.
Definition urdf_parser.h:18
bool parse(const std::string &filename)
Definition urdf_parser.cc:44
std::shared_ptr< Model > get() override
Definition urdf_parser.cc:49

3.1 Build Model Graph

int main() {
URDFParser parser;
bool eResult = parser.parse("path/to/tinyurdf/examples/urdf/example.urdf");
if(!eResult){
return 0;
}
std::shared_ptr<Model> model = parser.get();
InternalGraph graph(model);
std::shared_ptr<Link> link = std::make_shared<Link>();
auto children = graph.getChildLinks(link);
auto roots = graph.getRootLinks();
return 0;
}
base class for building multibody graph model
Definition internal_graph.h:12

4.0 License

see the LICENSE file.