transformable_object.h
Go to the documentation of this file.
1 #ifndef __TRANSFORMABLE_OBJECT_H__
2 #define __TRANSFORMABLE_OBJECT_H__
3 
4 #include <ros/ros.h>
5 #include <visualization_msgs/Marker.h>
6 #include <visualization_msgs/InteractiveMarker.h>
7 #include <visualization_msgs/InteractiveMarkerControl.h>
8 #include <std_msgs/Float32.h>
9 #include <std_msgs/ColorRGBA.h>
11 #include <tf/transform_datatypes.h>
12 #include <geometry_msgs/Point.h>
13 #include <jsk_rviz_plugins/RequestMarkerOperate.h>
14 #include <vector>
15 #include <algorithm>
16 #include <jsk_interactive_marker/InteractiveSettingConfig.h>
17 
18 namespace jsk_interactive_marker {
20  public:
22 
23  std::vector<visualization_msgs::InteractiveMarkerControl> makeRotateTransFixControl(unsigned int orientation_mode = visualization_msgs::InteractiveMarkerControl::FIXED);
24 
26  visualization_msgs::InteractiveMarker getInteractiveMarker();
27  virtual visualization_msgs::Marker getVisualizationMsgMarker(){};
28  void addMarker(visualization_msgs::InteractiveMarker &int_marker, bool always_visible = true, unsigned int interaction_mode = visualization_msgs::InteractiveMarkerControl::MOVE_3D);
29  void addControl(visualization_msgs::InteractiveMarker &int_marker);
30 
31  visualization_msgs::Marker marker_;
32  geometry_msgs::Pose pose_;
33  geometry_msgs::Pose control_offset_pose_;
34  std::string name_;
35  std::string frame_id_;
36  std::string description_;
37  int type_;
41  unsigned int interaction_mode_;
42 
43  void setPose(geometry_msgs::Pose pose, bool for_interactive_control=false);
44  void addPose(geometry_msgs::Pose msg, bool relative=false);
45  void publishTF();
46  std::string getFrameId() { return frame_id_; }
47  geometry_msgs::Pose getPose(bool for_interactive_control=false);
49  void setDisplayDescription(bool v);
50  void setInteractiveMarkerSetting(const InteractiveSettingConfig& config);
51  virtual bool setRadius(std_msgs::Float32 recieve_val){return false;};
52  virtual bool setSmallRadius(std_msgs::Float32 recieve_val){return false;};
53  virtual bool setHeight(std_msgs::Float32 recieve_val){return false;};
54  virtual bool setX(std_msgs::Float32 recieve_val){return false;};
55  virtual bool setY(std_msgs::Float32 recieve_val){return false;};
56  virtual bool setZ(std_msgs::Float32 recieve_val){return false;};
57  virtual void setRGBA(float r , float g, float b, float a){};
58  virtual void getRGBA(float &r , float &g, float &b, float &a){};
59  virtual void setXYZ(float x , float y, float z){};
60  virtual void getXYZ(float &x, float &y, float&z){};
61  virtual void setRSR(float r , float sr){};
62  virtual void getRSR(float &r , float &sr){};
63  virtual void setRZ(float r , float z){};
64  virtual void getRZ(float &r , float &z){};
65 
66  int getType() { return type_; };
67  void setType(int type) { type_ = type; return; };
68 
69  virtual float getInteractiveMarkerScale(){};
70  };
71 };
72 
73 namespace jsk_interactive_marker
74 {
76  {
77  public:
78  TransformableBox( float length , float r, float g, float b, float a, std::string frame, std::string name, std::string description);
79 
80  TransformableBox( float x, float y, float z, float r, float g, float b, float a, std::string frame, std::string name, std::string description);
81 
82  visualization_msgs::Marker getVisualizationMsgMarker();
83  void setRGBA( float r , float g, float b, float a){box_r_=r;box_g_=g;box_b_=b;box_a_=a;};
84  void getRGBA(float &r , float &g, float &b, float &a){r=box_r_;g=box_g_;b=box_b_;a=box_a_;}
85  void setXYZ( float x , float y, float z){box_x_=x;box_y_=y;box_z_=z;};
86  void getXYZ(float &x, float &y, float&z){x=box_x_;y=box_y_;z=box_z_;};
87 
88  bool setX(std_msgs::Float32 x){box_x_=x.data;return true;};
89  bool setY(std_msgs::Float32 y){box_y_=y.data;return true;};
90  bool setZ(std_msgs::Float32 z){box_z_=z.data;return true;};
91 
92  float getInteractiveMarkerScale(){return 1.25*std::max(std::max(box_x_, box_y_),box_z_);};
93 
94  float box_x_;
95  float box_y_;
96  float box_z_;
97  float box_r_;
98  float box_g_;
99  float box_b_;
100  float box_a_;
101  };
102 };
103 
104 namespace jsk_interactive_marker
105 {
107  {
108  public:
109  TransformableMesh(std::string frame, std::string name, std::string description, std::string mesh_resource, bool mesh_use_embedded_materials);
110  visualization_msgs::Marker getVisualizationMsgMarker();
111  void setRGBA( float r , float g, float b, float a){mesh_r_=r;mesh_g_=g;mesh_b_=b;mesh_a_=a;};
112  void getRGBA(float &r , float &g, float &b, float &a){r=mesh_r_;g=mesh_g_;b=mesh_b_;a=mesh_a_;};
113  void setXYZ( float x , float y, float z){marker_scale_=x; return;};
114  void getXYZ(float &x, float &y, float&z){return;};
115  bool setX(std_msgs::Float32 x){marker_scale_=x.data; return true;};
116  bool setY(std_msgs::Float32 y){return true;};
117  bool setZ(std_msgs::Float32 z){return true;};
119  float marker_scale_;
120  std::string mesh_resource_;
122  float mesh_r_;
123  float mesh_g_;
124  float mesh_b_;
125  float mesh_a_;
126  };
127 };
128 
129 namespace jsk_interactive_marker
130 {
132  {
133  public:
134  TransformableTorus( float radius, float small_radius, int u_div, int v_div, float r, float g, float b, float a, std::string frame, std::string name, std::string description);
135 
136  visualization_msgs::Marker getVisualizationMsgMarker();
137  void setRGBA( float r , float g, float b, float a){torus_r_=r;torus_g_=g;torus_b_=b;torus_a_=a;};
138  void getRGBA(float &r , float &g, float &b, float &a){r=torus_r_;g=torus_g_;b=torus_b_;a=torus_a_;}
139  void setRSR( float r , float sr){torus_radius_=r; torus_small_radius_=sr;};
140  void getRSR(float &r , float &sr){r=torus_radius_; sr=torus_small_radius_;};
141 
142  bool setRadius(std_msgs::Float32 r){torus_radius_=r.data;return true;};
143  bool setSmallRadius(std_msgs::Float32 sr){torus_small_radius_=sr.data;return true;};
144 
145  std::vector<geometry_msgs::Point > calcurateTriangleMesh();
146 
148 
149  float torus_radius_;
151  float torus_r_;
152  float torus_g_;
153  float torus_b_;
154  float torus_a_;
155 
158  };
159 };
160 
161 namespace jsk_interactive_marker
162 {
164  {
165  public:
166  TransformableCylinder( float radius, float z, float r, float g, float b, float a, std::string frame, std::string name, std::string description);
167 
168  visualization_msgs::Marker getVisualizationMsgMarker();
169  void setRGBA( float r , float g, float b, float a){cylinder_r_=r;cylinder_g_=g;cylinder_b_=b;cylinder_a_=a;};
170  void getRGBA(float &r , float &g, float &b, float &a){r=cylinder_r_;g=cylinder_g_;b=cylinder_b_;a=cylinder_a_;}
171  void setRZ( float r , float z){cylinder_radius_=r; cylinder_z_=z;};
172  void getRZ(float &r , float &z){r=cylinder_radius_; z=cylinder_z_;};
173 
174  bool setRadius(std_msgs::Float32 r){cylinder_radius_=r.data;return true;};
175  bool setZ(std_msgs::Float32 z){cylinder_z_=z.data;return true;};
176 
177  float getInteractiveMarkerScale(){return 1.25*std::max(cylinder_radius_, cylinder_z_);};
178 
179  float cylinder_radius_;
180  float cylinder_z_;
181  float cylinder_r_;
182  float cylinder_g_;
183  float cylinder_b_;
184  float cylinder_a_;
185  };
186 };
187 
188 #endif
jsk_interactive_marker::TransformableMesh::mesh_use_embedded_materials_
bool mesh_use_embedded_materials_
Definition: transformable_object.h:121
jsk_interactive_marker::TransformableBox::getXYZ
void getXYZ(float &x, float &y, float &z)
Definition: transformable_object.h:86
jsk_interactive_marker::TransformableBox::getRGBA
void getRGBA(float &r, float &g, float &b, float &a)
Definition: transformable_object.h:84
jsk_interactive_marker::TransformableTorus::setRadius
bool setRadius(std_msgs::Float32 r)
Definition: transformable_object.h:142
jsk_interactive_marker::TransformableObject::setRadius
virtual bool setRadius(std_msgs::Float32 recieve_val)
Definition: transformable_object.h:51
jsk_interactive_marker::TransformableObject::setY
virtual bool setY(std_msgs::Float32 recieve_val)
Definition: transformable_object.h:55
jsk_interactive_marker::TransformableObject::type_
int type_
Definition: transformable_object.h:37
jsk_interactive_marker::TransformableCylinder::cylinder_radius_
float cylinder_radius_
Definition: transformable_object.h:177
jsk_interactive_marker::TransformableObject::setRGBA
virtual void setRGBA(float r, float g, float b, float a)
Definition: transformable_object.h:57
jsk_interactive_marker::TransformableBox::box_x_
float box_x_
Definition: transformable_object.h:92
jsk_interactive_marker::TransformableMesh::setX
bool setX(std_msgs::Float32 x)
Definition: transformable_object.h:115
jsk_interactive_marker::TransformableCylinder::getRZ
void getRZ(float &r, float &z)
Definition: transformable_object.h:172
ros.h
jsk_interactive_marker::TransformableTorus::TransformableTorus
TransformableTorus(float radius, float small_radius, int u_div, int v_div, float r, float g, float b, float a, std::string frame, std::string name, std::string description)
Definition: transformable_object.cpp:209
jsk_interactive_marker::TransformableMesh
Definition: transformable_object.h:106
z
z
jsk_interactive_marker::TransformableMesh::marker_scale_
float marker_scale_
Definition: transformable_object.h:118
description
description
jsk_interactive_marker::TransformableTorus::getInteractiveMarkerScale
float getInteractiveMarkerScale()
Definition: transformable_object.h:147
jsk_interactive_marker::TransformableCylinder::setRZ
void setRZ(float r, float z)
Definition: transformable_object.h:171
jsk_interactive_marker::TransformableBox::getInteractiveMarkerScale
float getInteractiveMarkerScale()
Definition: transformable_object.h:92
jsk_interactive_marker::TransformableMesh::setZ
bool setZ(std_msgs::Float32 z)
Definition: transformable_object.h:117
jsk_interactive_marker::TransformableObject::pose_
geometry_msgs::Pose pose_
Definition: transformable_object.h:32
jsk_interactive_marker::TransformableObject::setRZ
virtual void setRZ(float r, float z)
Definition: transformable_object.h:63
jsk_interactive_marker::TransformableObject::publishTF
void publishTF()
Definition: transformable_object.cpp:172
jsk_interactive_marker::TransformableObject::addMarker
void addMarker(visualization_msgs::InteractiveMarker &int_marker, bool always_visible=true, unsigned int interaction_mode=visualization_msgs::InteractiveMarkerControl::MOVE_3D)
Definition: transformable_object.cpp:86
jsk_interactive_marker::TransformableCylinder::setRGBA
void setRGBA(float r, float g, float b, float a)
Definition: transformable_object.h:169
jsk_interactive_marker::TransformableTorus::torus_small_radius_
float torus_small_radius_
Definition: transformable_object.h:150
jsk_interactive_marker::TransformableObject::interaction_mode_
unsigned int interaction_mode_
Definition: transformable_object.h:41
jsk_interactive_marker
Definition: camera_info_publisher.h:48
jsk_interactive_marker::TransformableBox::box_r_
float box_r_
Definition: transformable_object.h:97
jsk_interactive_marker::TransformableObject::display_interactive_manipulator_
bool display_interactive_manipulator_
Definition: transformable_object.h:38
transform_broadcaster.h
jsk_interactive_marker::TransformableObject::setPose
void setPose(geometry_msgs::Pose pose, bool for_interactive_control=false)
Definition: transformable_object.cpp:121
jsk_interactive_marker::TransformableBox::box_y_
float box_y_
Definition: transformable_object.h:95
jsk_interactive_marker::TransformableCylinder::cylinder_r_
float cylinder_r_
Definition: transformable_object.h:181
jsk_interactive_marker::TransformableMesh::mesh_r_
float mesh_r_
Definition: transformable_object.h:122
jsk_interactive_marker::TransformableBox
Definition: transformable_object.h:75
jsk_interactive_marker::TransformableObject::setSmallRadius
virtual bool setSmallRadius(std_msgs::Float32 recieve_val)
Definition: transformable_object.h:52
jsk_interactive_marker::TransformableTorus::torus_b_
float torus_b_
Definition: transformable_object.h:153
jsk_interactive_marker::TransformableCylinder::setRadius
bool setRadius(std_msgs::Float32 r)
Definition: transformable_object.h:174
jsk_interactive_marker::TransformableObject::setType
void setType(int type)
Definition: transformable_object.h:67
jsk_interactive_marker::TransformableObject::setX
virtual bool setX(std_msgs::Float32 recieve_val)
Definition: transformable_object.h:54
jsk_interactive_marker::TransformableTorus::torus_r_
float torus_r_
Definition: transformable_object.h:151
jsk_interactive_marker::TransformableObject
Definition: transformable_object.h:19
jsk_interactive_marker::TransformableBox::setXYZ
void setXYZ(float x, float y, float z)
Definition: transformable_object.h:85
jsk_interactive_marker::TransformableTorus::torus_radius_
float torus_radius_
Definition: transformable_object.h:147
tf::TransformBroadcaster
jsk_interactive_marker::TransformableTorus::getRSR
void getRSR(float &r, float &sr)
Definition: transformable_object.h:140
jsk_interactive_marker::TransformableObject::display_description_
bool display_description_
Definition: transformable_object.h:39
jsk_interactive_marker::TransformableTorus::getRGBA
void getRGBA(float &r, float &g, float &b, float &a)
Definition: transformable_object.h:138
x
x
jsk_interactive_marker::TransformableTorus::getVisualizationMsgMarker
visualization_msgs::Marker getVisualizationMsgMarker()
Definition: transformable_object.cpp:276
jsk_interactive_marker::TransformableBox::TransformableBox
TransformableBox(float length, float r, float g, float b, float a, std::string frame, std::string name, std::string description)
Definition: transformable_object.cpp:288
jsk_interactive_marker::TransformableBox::setZ
bool setZ(std_msgs::Float32 z)
Definition: transformable_object.h:90
jsk_interactive_marker::TransformableBox::box_g_
float box_g_
Definition: transformable_object.h:98
small_radius
small_radius
jsk_interactive_marker::TransformableMesh::getRGBA
void getRGBA(float &r, float &g, float &b, float &a)
Definition: transformable_object.h:112
jsk_interactive_marker::TransformableCylinder::TransformableCylinder
TransformableCylinder(float radius, float z, float r, float g, float b, float a, std::string frame, std::string name, std::string description)
Definition: transformable_object.cpp:179
jsk_interactive_marker::TransformableTorus::torus_a_
float torus_a_
Definition: transformable_object.h:154
dummy_camera.r
r
Definition: dummy_camera.py:14
jsk_interactive_marker::TransformableObject::frame_id_
std::string frame_id_
Definition: transformable_object.h:35
jsk_interactive_marker::TransformableBox::setX
bool setX(std_msgs::Float32 x)
Definition: transformable_object.h:88
jsk_interactive_marker::TransformableMesh::setRGBA
void setRGBA(float r, float g, float b, float a)
Definition: transformable_object.h:111
jsk_interactive_marker::TransformableCylinder::getVisualizationMsgMarker
visualization_msgs::Marker getVisualizationMsgMarker()
Definition: transformable_object.cpp:194
jsk_interactive_marker::TransformableObject::getFrameId
std::string getFrameId()
Definition: transformable_object.h:46
jsk_interactive_marker::TransformableTorus::u_division_num_
int u_division_num_
Definition: transformable_object.h:156
jsk_interactive_marker::TransformableObject::getInteractiveMarkerScale
virtual float getInteractiveMarkerScale()
Definition: transformable_object.h:69
jsk_interactive_marker::TransformableObject::name_
std::string name_
Definition: transformable_object.h:34
y
y
jsk_interactive_marker::TransformableObject::marker_
visualization_msgs::Marker marker_
Definition: transformable_object.h:31
jsk_interactive_marker::TransformableBox::setY
bool setY(std_msgs::Float32 y)
Definition: transformable_object.h:89
jsk_interactive_marker::TransformableTorus::setRGBA
void setRGBA(float r, float g, float b, float a)
Definition: transformable_object.h:137
jsk_interactive_marker::TransformableMesh::setXYZ
void setXYZ(float x, float y, float z)
Definition: transformable_object.h:113
jsk_interactive_marker::TransformableMesh::setY
bool setY(std_msgs::Float32 y)
Definition: transformable_object.h:116
jsk_interactive_marker::TransformableObject::getRSR
virtual void getRSR(float &r, float &sr)
Definition: transformable_object.h:62
jsk_interactive_marker::TransformableObject::getPose
geometry_msgs::Pose getPose(bool for_interactive_control=false)
Definition: transformable_object.cpp:134
transform_datatypes.h
jsk_interactive_marker::TransformableMesh::getInteractiveMarkerScale
float getInteractiveMarkerScale()
Definition: transformable_object.h:118
jsk_interactive_marker::TransformableCylinder::cylinder_z_
float cylinder_z_
Definition: transformable_object.h:180
jsk_interactive_marker::TransformableBox::getVisualizationMsgMarker
visualization_msgs::Marker getVisualizationMsgMarker()
Definition: transformable_object.cpp:318
jsk_interactive_marker::TransformableTorus
Definition: transformable_object.h:131
jsk_interactive_marker::TransformableObject::setHeight
virtual bool setHeight(std_msgs::Float32 recieve_val)
Definition: transformable_object.h:53
jsk_interactive_marker::TransformableObject::setRSR
virtual void setRSR(float r, float sr)
Definition: transformable_object.h:61
jsk_interactive_marker::TransformableTorus::calcurateTriangleMesh
std::vector< geometry_msgs::Point > calcurateTriangleMesh()
Definition: transformable_object.cpp:227
jsk_interactive_marker::TransformableCylinder::setZ
bool setZ(std_msgs::Float32 z)
Definition: transformable_object.h:175
jsk_interactive_marker::TransformableMesh::mesh_resource_
std::string mesh_resource_
Definition: transformable_object.h:120
jsk_interactive_marker::TransformableTorus::v_division_num_
int v_division_num_
Definition: transformable_object.h:157
length
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
jsk_interactive_marker::TransformableTorus::setRSR
void setRSR(float r, float sr)
Definition: transformable_object.h:139
jsk_interactive_marker::TransformableCylinder::cylinder_b_
float cylinder_b_
Definition: transformable_object.h:183
jsk_interactive_marker::TransformableMesh::TransformableMesh
TransformableMesh(std::string frame, std::string name, std::string description, std::string mesh_resource, bool mesh_use_embedded_materials)
Definition: transformable_object.cpp:332
jsk_interactive_marker::TransformableObject::addPose
void addPose(geometry_msgs::Pose msg, bool relative=false)
Definition: transformable_object.cpp:151
jsk_interactive_marker::TransformableObject::getXYZ
virtual void getXYZ(float &x, float &y, float &z)
Definition: transformable_object.h:60
jsk_interactive_marker::TransformableObject::TransformableObject
TransformableObject()
Definition: transformable_object.cpp:17
jsk_interactive_marker::TransformableObject::makeRotateTransFixControl
std::vector< visualization_msgs::InteractiveMarkerControl > makeRotateTransFixControl(unsigned int orientation_mode=visualization_msgs::InteractiveMarkerControl::FIXED)
Definition: transformable_object.cpp:45
jsk_interactive_marker::TransformableObject::setDisplayInteractiveManipulator
void setDisplayInteractiveManipulator(bool v)
Definition: transformable_object.cpp:28
jsk_interactive_marker::TransformableCylinder::cylinder_a_
float cylinder_a_
Definition: transformable_object.h:184
jsk_interactive_marker::TransformableObject::br
tf::TransformBroadcaster br
Definition: transformable_object.h:25
jsk_interactive_marker::TransformableBox::box_a_
float box_a_
Definition: transformable_object.h:100
jsk_interactive_marker::TransformableObject::setDisplayDescription
void setDisplayDescription(bool v)
Definition: transformable_object.cpp:33
jsk_interactive_marker::TransformableObject::getVisualizationMsgMarker
virtual visualization_msgs::Marker getVisualizationMsgMarker()
Definition: transformable_object.h:27
jsk_interactive_marker::TransformableObject::setZ
virtual bool setZ(std_msgs::Float32 recieve_val)
Definition: transformable_object.h:56
jsk_interactive_marker::TransformableBox::setRGBA
void setRGBA(float r, float g, float b, float a)
Definition: transformable_object.h:83
jsk_interactive_marker::TransformableMesh::mesh_a_
float mesh_a_
Definition: transformable_object.h:125
jsk_interactive_marker::TransformableObject::addControl
void addControl(visualization_msgs::InteractiveMarker &int_marker)
Definition: transformable_object.cpp:96
radius
GLdouble radius
jsk_interactive_marker::TransformableTorus::setSmallRadius
bool setSmallRadius(std_msgs::Float32 sr)
Definition: transformable_object.h:143
jsk_interactive_marker::TransformableObject::interactive_manipulator_orientation_
int interactive_manipulator_orientation_
Definition: transformable_object.h:40
jsk_interactive_marker::TransformableObject::setInteractiveMarkerSetting
void setInteractiveMarkerSetting(const InteractiveSettingConfig &config)
Definition: transformable_object.cpp:38
jsk_interactive_marker::TransformableCylinder::getRGBA
void getRGBA(float &r, float &g, float &b, float &a)
Definition: transformable_object.h:170
jsk_interactive_marker::TransformableBox::box_b_
float box_b_
Definition: transformable_object.h:99
jsk_interactive_marker::TransformableObject::getRZ
virtual void getRZ(float &r, float &z)
Definition: transformable_object.h:64
jsk_interactive_marker::TransformableCylinder
Definition: transformable_object.h:163
a
char a[26]
jsk_interactive_marker::TransformableMesh::getVisualizationMsgMarker
visualization_msgs::Marker getVisualizationMsgMarker()
Definition: transformable_object.cpp:343
jsk_interactive_marker::TransformableObject::description_
std::string description_
Definition: transformable_object.h:36
jsk_interactive_marker::TransformableObject::getInteractiveMarker
visualization_msgs::InteractiveMarker getInteractiveMarker()
Definition: transformable_object.cpp:104
jsk_interactive_marker::TransformableTorus::torus_g_
float torus_g_
Definition: transformable_object.h:152
jsk_interactive_marker::TransformableMesh::mesh_b_
float mesh_b_
Definition: transformable_object.h:124
jsk_interactive_marker::TransformableObject::setXYZ
virtual void setXYZ(float x, float y, float z)
Definition: transformable_object.h:59
jsk_interactive_marker::TransformableObject::control_offset_pose_
geometry_msgs::Pose control_offset_pose_
Definition: transformable_object.h:33
jsk_interactive_marker::TransformableCylinder::getInteractiveMarkerScale
float getInteractiveMarkerScale()
Definition: transformable_object.h:177
jsk_interactive_marker::TransformableObject::getRGBA
virtual void getRGBA(float &r, float &g, float &b, float &a)
Definition: transformable_object.h:58
jsk_interactive_marker::TransformableObject::getType
int getType()
Definition: transformable_object.h:66
jsk_interactive_marker::TransformableMesh::mesh_g_
float mesh_g_
Definition: transformable_object.h:123
jsk_interactive_marker::TransformableMesh::getXYZ
void getXYZ(float &x, float &y, float &z)
Definition: transformable_object.h:114
jsk_interactive_marker::TransformableCylinder::cylinder_g_
float cylinder_g_
Definition: transformable_object.h:182
jsk_interactive_marker::TransformableBox::box_z_
float box_z_
Definition: transformable_object.h:96


jsk_interactive_marker
Author(s): furuta
autogenerated on Fri Aug 2 2024 08:50:24