TinyURDF 1.0.0
A Modern C++ Library for Parsing and Visualizing URDF Model Files
Loading...
Searching...
No Matches
vtk_joint_renderer.h
Go to the documentation of this file.
1#ifndef TINYURDF_VTK_JOINT_RENDRER_H_
2#define TINYURDF_VTK_JOINT_RENDRER_H_
3
4// Copyright 2025 Wissem CHIHA
5
6#include <thread>
7#include <vector>
8
9#include <vtkNew.h>
10#include <vtkActor.h>
11#include <vtkCamera.h>
12#include <vtkArrowSource.h>
13#include <vtkSphereSource.h>
14#include <vtkNamedColors.h>
15#include <vtkElevationFilter.h>
16#include <vtkPolyDataMapper.h>
17#include <vtkProperty.h>
18#include <vtkTextProperty.h>
19#include <vtkRenderWindow.h>
20#include <vtkAxesActor.h>
21#include <vtkRenderer.h>
22#include <vtkTransform.h>
23#include <vtkDataSetMapper.h>
24#include <vtkRenderWindowInteractor.h>
25#include <vtkCaptionActor2D.h>
26
27#include "renderer_base.h"
28#include "joint.h"
29#include "pose.h"
30
31class VtkJointRenderer : public RendererBase<Joint>{
32public:
34 void update() override;
35 void show() override;
36 void setLabelsVisibility(bool isVisible) override;
37 void setArrowsVisibility(bool isVisible);
38 void setRenderer(vtkSmartPointer<vtkRenderer> renderer);
39 void setWindowSize(const int32_t width, const int32_t height) override;
40 void setBackrgournd(double r, double g, double b, double a) override;
41 vtkSmartPointer<vtkRenderer> getRenderer();
42 void setJoint(const Joint& joint);
43 void clear() override;
44 bool isA(const char* name) override;
45 void print(std::ostream& os) override;
46 bool empty() const override;
47 const char* getTypename() override;
48 void setJoints(const std::vector<Joint>& joints);
50private:
51 int32_t width_ = 800;
52 int32_t height_ = 600;
53 vtkSmartPointer<vtkRenderer> renderer_;
54 vtkSmartPointer<vtkRenderWindow> window_;
55 std::vector<Joint> joints_;
56 bool labels_ = true;
57 bool arrow_ = false;
58 void Pose2vtkMatrix(Pose& pose, vtkSmartPointer<vtkMatrix4x4> matrix);
59};
60#endif // TINYURDF_VTK_JOINT_RENDRER_H_
61
Definition joint.h:22
Represents a pose, consisting of position and rotation.
Definition pose.h:13
this is a base class for all renderers all renderers impentation should inherit from this class at th...
Definition renderer_base.h:15
Definition vtk_joint_renderer.h:31
void setWindowSize(const int32_t width, const int32_t height) override
Definition vtk_joint_renderer.cc:125
const char * getTypename() override
Definition vtk_joint_renderer.cc:177
void clear() override
Definition vtk_joint_renderer.cc:150
void setLabelsVisibility(bool isVisible) override
Definition vtk_joint_renderer.cc:105
bool isA(const char *name) override
Definition vtk_joint_renderer.cc:155
void print(std::ostream &os) override
Definition vtk_joint_renderer.cc:160
void setRenderer(vtkSmartPointer< vtkRenderer > renderer)
Definition vtk_joint_renderer.cc:115
void setBackrgournd(double r, double g, double b, double a) override
Definition vtk_joint_renderer.cc:131
~VtkJointRenderer()
Definition vtk_joint_renderer.h:49
VtkJointRenderer()
Definition vtk_joint_renderer.cc:3
void setJoints(const std::vector< Joint > &joints)
Definition vtk_joint_renderer.cc:182
void setJoint(const Joint &joint)
Definition vtk_joint_renderer.cc:145
vtkSmartPointer< vtkRenderer > getRenderer()
Definition vtk_joint_renderer.cc:140
bool empty() const override
Definition vtk_joint_renderer.cc:172
void show() override
Definition vtk_joint_renderer.cc:94
void update() override
Definition vtk_joint_renderer.cc:9
void setArrowsVisibility(bool isVisible)
Definition vtk_joint_renderer.cc:110