iDynTree::MeshcatVisualizer class

MeshcatVisualizer is an iDynTree-based wrapper to the meshcat-cpp visualizer.

Constructors, destructors, conversion operators

MeshcatVisualizer()
~MeshcatVisualizer()

Public functions

auto loadModel(const iDynTree::Model& model, const std::string& modelName) -> bool
Load a given model in the visualizer.
auto setModelState(const iDynTree::Transform& world_T_base, const iDynTree::VectorDynSize& jointPositions, const std::string& modelName) -> bool
Set the state of an already existing model in the visualizer.
auto setModelState(const iDynTree::MatrixView<const double>& world_T_base, const iDynTree::Span<const double>& jointPositions, const std::string& modelName) -> bool
Set the state of an already existing model in the visualizer.
auto loadSphere(const double radius, const iDynTree::Span<const double>& color, const std::string& name) -> bool
Load a sphere mesh in the visualizer.
auto loadCylinder(const double radius, const double height, const iDynTree::Span<const double>& color, const std::string& name) -> bool
Load a cylinder mesh in the visualizer.
auto loadBox(const double width, const double depth, const double height, const iDynTree::Span<const double>& color, const std::string& name) -> bool
Load a box mesh in the visualizer.
auto loadEllipsoid(const double a, const double b, const double c, const iDynTree::Span<const double>& color, const std::string& name) -> bool
Load an ellipsoid mesh in the visualizer.
auto setPrimitiveGeometryTransform(const iDynTree::Transform& world_T_geometry, const std::string& geometryName) -> bool
set the pose of a primitive geometry mesh in the visualizer.
auto setPrimitiveGeometryTransform(const iDynTree::MatrixView<const double>& world_T_geometry, const std::string& geometryName) -> bool
set the pose of a primitive geometry mesh in the visualizer.
void join()
Utility function to make the meshcat interface run forever (until the user stops the application)

Function documentation

bool iDynTree::MeshcatVisualizer::loadModel(const iDynTree::Model& model, const std::string& modelName)

Load a given model in the visualizer.

Parameters
model the model that should be loaded.
modelName the name of the model used in the visualizer. Each model you add needs to have an unique name.
Returns True in case of success false otherwise/

bool iDynTree::MeshcatVisualizer::setModelState(const iDynTree::Transform& world_T_base, const iDynTree::VectorDynSize& jointPositions, const std::string& modelName)

Set the state of an already existing model in the visualizer.

Parameters
world_T_base pose of the base of the model.
jointPositions position of the joints.
modelName the name of the model specified in MeshcatVisualizer::loadModel(),
Returns True in case of success false otherwise.

bool iDynTree::MeshcatVisualizer::setModelState(const iDynTree::MatrixView<const double>& world_T_base, const iDynTree::Span<const double>& jointPositions, const std::string& modelName)

Set the state of an already existing model in the visualizer.

Parameters
world_T_base 4x4 matrix representing the homogeneous transformation,
jointPositions position of the joints,
modelName the name of the model specified in MeshcatVisualizer::loadModel().
Returns True in case of success false otherwise.

bool iDynTree::MeshcatVisualizer::loadSphere(const double radius, const iDynTree::Span<const double>& color, const std::string& name)

Load a sphere mesh in the visualizer.

Parameters
radius radius of the sphere.
color needs to be a vector of 4 double between 0 and 1 representing RGBA.
name the name of the sphere. Each geometry you add needs to have an unique name.
Returns True in case of success false otherwise.

bool iDynTree::MeshcatVisualizer::loadCylinder(const double radius, const double height, const iDynTree::Span<const double>& color, const std::string& name)

Load a cylinder mesh in the visualizer.

Parameters
radius radius of the cylinder.
height height of the cylinder.
color needs to be a vector of 4 double between 0 and 1 representing RGBA.
name the name of the cylinder. Each geometry you add needs to have an unique name.
Returns True in case of success false otherwise.

bool iDynTree::MeshcatVisualizer::loadBox(const double width, const double depth, const double height, const iDynTree::Span<const double>& color, const std::string& name)

Load a box mesh in the visualizer.

Parameters
width width of the box.
depth depth of the box.
height height of the box.
color needs to be a vector of 4 double between 0 and 1 representing RGBA.
name the name of the box. Each geometry you add needs to have an unique name.
Returns True in case of success false otherwise.

bool iDynTree::MeshcatVisualizer::loadEllipsoid(const double a, const double b, const double c, const iDynTree::Span<const double>& color, const std::string& name)

Load an ellipsoid mesh in the visualizer.

Parameters
a a-axis of the ellipsoid.
b b-axis of the ellipsoid.
c c-axis of the ellipsoid.
color needs to be a vector of 4 double between 0 and 1 representing RGBA.
name the name of the ellipsoid. Each geometry you add needs to have an unique name.
Returns True in case of success false otherwise.

bool iDynTree::MeshcatVisualizer::setPrimitiveGeometryTransform(const iDynTree::Transform& world_T_geometry, const std::string& geometryName)

set the pose of a primitive geometry mesh in the visualizer.

Parameters
world_T_geometry pose of the geometry.
geometryName the name of the geometry specified in MeshcatVisualizer::loadSphere() || MeshcatVisualizer::loadCylinder() || MeshcatVisualizer::loadBox() || MeshcatVisualizer::loadEllipsoid().
Returns True in case of success false otherwise. Implementations available: for iDynTree::Transform, for iDynTree::MatrixView.

bool iDynTree::MeshcatVisualizer::setPrimitiveGeometryTransform(const iDynTree::MatrixView<const double>& world_T_geometry, const std::string& geometryName)

set the pose of a primitive geometry mesh in the visualizer.

Parameters
world_T_geometry pose of the geometry.
geometryName the name of the geometry specified in MeshcatVisualizer::loadSphere() || MeshcatVisualizer::loadCylinder() || MeshcatVisualizer::loadBox() || MeshcatVisualizer::loadEllipsoid().
Returns True in case of success false otherwise. Implementations available: for iDynTree::Transform, for iDynTree::MatrixView.