Skip to content

GiulioRomualdi/idyntree-meshcat-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

idyntree-meshcat-cpp

C++ Standard Size

A simple bridge between iDynTree and the meshcat-cpp interface.

This repository contains the C++ implementation of the already existing iDynTree Meshcat visualizer python class.


🚧 REPOSITORY UNDER DEVELOPMENT 🚧
The library implemented in this repository is still experimental and we cannot guarantee stable API


🏗️ Dependencies

idyntree-meshcat-cpp depends on iDynTree and meshcat-cpp.

⚒️ Build the library

You can build the library coping and paste the following snippet into a terminal

git clone https://github.com/GiulioRomualdi/idyntree-meshcat-cpp.git
cd idyntree-meshcat-cpp
mkdir build && cd build
cmake ..
cmake --build .
[sudo] make install

🏃 Example

idyntree-meshcat-cpp provides native CMake support which allows the library to be easily used in CMake projects. Please add in your CMakeLists.txt

project(foo)
find_package(iDynTreeMeshcatCpp REQUIRED)
add_executable(${PROJECT_NAME} src/foo.cpp)
target_link_libraries(${PROJECT_NAME} iDynTreeMeshcatCpp::iDynTreeMeshcatCpp)

The following example shows you how to display the iCub Humanoid robot with the visualizer. To compile the example please:

  1. Build and install the icub-models project
  2. Enable IDYNTREE_MESHCAT_CPP_BUILT_EXAMPLES cmake option
#include <iDynTreeMeshcatCpp/Visualizer.h>
#include <iDynTree/Model/Model.h>
#include <iDynTree/ModelIO/ModelLoader.h>
#include <iCubModels/iCubModels.h>

int main()
{
    iDynTreeMeshcatCpp::Visualizer viz;

    const std::string modelPath = iCubModels::getModelFile("iCubGenova09");
    iDynTree::ModelLoader loader;
    loader.loadModelFromFile(modelPath);

    viz.loadModel(loader.model(), "iCub", {0,0,0});

    viz.join();

    return 0;
}

Once you have run the example, the MeshcatCpp::Meshcat class will print the URL at which the MeshCat server runs. Please open the link in your browser and you should be able to see the following screen

meshcat_icub

🐛 Bug reports and support

All types of issues are welcome.

📝 License

Materials in this repository are distributed under the following license:

All software is licensed under the BSD 3-Clause "New" or "Revised" License. See LICENSE file for details.

About

A simple bridge between iDynTree and the meshcat-cpp interface

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published