https://github.com/giulioromualdi/idyntree-meshcat-cpp
A simple bridge between iDynTree and the meshcat-cpp interface
https://github.com/giulioromualdi/idyntree-meshcat-cpp
cpp meshcat robotics visualizer
Last synced: about 2 months ago
JSON representation
A simple bridge between iDynTree and the meshcat-cpp interface
- Host: GitHub
- URL: https://github.com/giulioromualdi/idyntree-meshcat-cpp
- Owner: GiulioRomualdi
- License: bsd-3-clause
- Created: 2023-01-11T18:33:10.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-11T23:22:09.000Z (over 3 years ago)
- Last Synced: 2025-03-29T07:13:22.452Z (about 1 year ago)
- Topics: cpp, meshcat, robotics, visualizer
- Language: CMake
- Homepage:
- Size: 20.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
idyntree-meshcat-cpp
A simple bridge between [iDynTree](https://github.com/robotology/idyntree) and the [meshcat-cpp](https://github.com/GiulioRomualdi/meshcat-cpp) interface.
This repository contains the C++ implementation of the already existing [iDynTree Meshcat visualizer python class](https://github.com/robotology/idyntree/blob/7ecf7b536be9e03fe05a0d49c8e7adbc5f84dc31/bindings/python/visualize/meshcat_visualizer.py).
---
🚧 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
```console
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`
```cmake
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`](https://github.com/robotology/icub-models) project
2. Enable `IDYNTREE_MESHCAT_CPP_BUILT_EXAMPLES` cmake option
```cpp
#include
#include
#include
#include
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](./examples/example_viewer.cpp), 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

## 🐛 Bug reports and support
All types of [issues](https://github.com/GiulioRomualdi/idyntree-meshcat-cpp/issues/new) 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](https://github.com/GiulioRomualdi/idyntree-meshcat-cpp/blob/master/LICENSE) file for details.