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
idyntree-meshcat-cpp depends on iDynTree
and meshcat-cpp
.
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
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:
- Build and install the
icub-models
project - 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
All types of issues are welcome.
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.