class
#include <iDynTree/Visualizer.h>
Visualizer Class to visualize a set of iDynTree models.
Constructors, destructors, conversion operators
- Visualizer()
- ~Visualizer() virtual
Public functions
- auto init(const VisualizerOptions& visualizerOptions = VisualizerOptions()) -> bool
- Initialize the visualization.
- auto getNrOfVisualizedModels() -> size_t
- Get number of models visualized.
- auto getModelInstanceName(size_t modelInstanceIndex) -> std::string
- auto getModelInstanceIndex(const std::string instanceName) -> int
- Get the index of a given model instance, or -1 if there is not such model instance.
-
auto addModel(const iDynTree::
Model& model, const std::string& instanceName) -> bool - Add an instance of a given model to the visualization.
- auto modelViz(size_t modelIdx) -> IModelVisualization&
- Return an interface to a visualization of a model.
- auto modelViz(const std::string& instanceName) -> IModelVisualization&
- Return an interface to a visualization of a model.
- auto camera() -> ICamera&
- Return an interface to manipulate the camera in the visualization.
- auto enviroment() -> IEnvironment&
- Return an interface to manipulate the visualization environment.
- auto environment() -> IEnvironment&
- Return an interface to manipulate the visualization environment.
- auto vectors() -> IVectorsVisualization&
- Get a reference to the internal IVectorsVisualization interface.
- auto frames() -> IFrameVisualization&
- Get a reference to the internal IFrameVisualization interface.
- auto textures() -> ITexturesHandler&
- Get a reference to the internal ITexturesHandler interface.
- auto shapes() -> IShapeVisualization&
- Get a reference to the internal IShapeVisualization interface.
- auto getLabel(const std::string& labelName) -> ILabel&
- Get a label given a name.
- auto width() const -> int
- Get the visualizer width.
- auto height() const -> int
- Get the visualizer height.
- auto run() -> bool
- Wrap the run method of the Irrlicht device.
- void draw()
- Draw the visualization.
- void subDraw(int xOffsetFromTopLeft, int yOffsetFromTopLeft, int subImageWidth, int subImageHeight)
- Draw the visualization in a subportion of the window.
- auto drawToFile(const std::string filename = "iDynTreeVisualizerScreenshot.png") -> bool
- Draw the current visualization to a image file.
- void close()
- Close the visualizer.
- auto isWindowActive() const -> bool
- Get if the visualizer window is active (to allow drawing only if necessary)
- auto setColorPalette(const std::string& name) -> bool
- Set the color palette.
Function documentation
bool iDynTree:: Visualizer:: init(const VisualizerOptions& visualizerOptions = VisualizerOptions())
Initialize the visualization.
bool iDynTree:: Visualizer:: addModel(const iDynTree:: Model& model,
const std::string& instanceName)
Add an instance of a given model to the visualization.
Parameters | |
---|---|
model in | |
instanceName in | name of the instance of the model added. |
Returns | true if all went well, false otherwise. |
IModelVisualization& iDynTree:: Visualizer:: modelViz(size_t modelIdx)
Return an interface to a visualization of a model.
Returns | a reference to a valid ModelVisualization if instanceName is the name of a model instance. |
---|
IModelVisualization& iDynTree:: Visualizer:: modelViz(const std::string& instanceName)
Return an interface to a visualization of a model.
Returns | a reference to a valid ModelVisualization if instanceName is the name of a model instance. |
---|
int iDynTree:: Visualizer:: width() const
Get the visualizer width.
Note: if the window is resized, this returns the correct size only if run is called first.
int iDynTree:: Visualizer:: height() const
Get the visualizer height.
Note: if the window is resized, this returns the correct size only if run is called first.
void iDynTree:: Visualizer:: subDraw(int xOffsetFromTopLeft,
int yOffsetFromTopLeft,
int subImageWidth,
int subImageHeight)
Draw the visualization in a subportion of the window.
Need to call draw once done.
bool iDynTree:: Visualizer:: drawToFile(const std::string filename = "iDynTreeVisualizerScreenshot.png")
Draw the current visualization to a image file.
Returns | true if all went ok, false otherwise. |
---|
The format of the image is desumed from the filename.
For more info on the process of writing the image, check irr::video::IVideoDriver::writeImageToFile irrlicht method.
bool iDynTree:: Visualizer:: isWindowActive() const
Get if the visualizer window is active (to allow drawing only if necessary)
Returns | True if the window is active, false otherwise. |
---|
bool iDynTree:: Visualizer:: setColorPalette(const std::string& name)
Set the color palette.
Parameters | |
---|---|
name | name of the color palette. Currently only vanilla and meshcat are supported. |
Returns | true if all went ok, false otherwise. |