Exotica
visualization_meshcat_types.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2019
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of nor the names of its contributors may be used to
14 // endorse or promote products derived from this software without specific
15 // prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 // POSSIBILITY OF SUCH DAMAGE.
28 //
29 
30 #ifndef EXOTICA_CORE_VISUALIZATION_MESHCAT_TYPES_H_
31 #define EXOTICA_CORE_VISUALIZATION_MESHCAT_TYPES_H_
32 
33 #define MSGPACK_USE_DEFINE_MAP
34 
35 #include <iostream>
36 #include <msgpack.hpp>
37 
38 #include <geometric_shapes/shapes.h>
39 
40 #include <exotica_core/scene.h>
41 #include <exotica_core/tools.h>
42 
43 // Backwards compatibility switch 16.04 with meshpack version < 2.0.0
44 #if (MSGPACK_VERSION_MAJOR >= 2)
45 typedef msgpack::v1::type::raw_ref msgpack_raw_ref;
46 typedef msgpack::v1::type::ext msgpack_ext;
47 #else
48 typedef msgpack::type::raw_ref msgpack_raw_ref;
49 typedef std::vector<float> msgpack_ext;
50 #define MSGPACK_FEATURE_NOT_SUPPORTED
51 #endif
52 
53 namespace exotica
54 {
55 namespace visualization
56 {
57 inline long RGB(double R, double G, double B)
58 {
59  return static_cast<long>(std::min(std::max(R, 0.0), 1.0) * 255) * 65536L + static_cast<long>(std::min(std::max(G, 0.0), 1.0) * 255) * 256L + static_cast<long>(std::min(std::max(B, 0.0), 1.0) * 255);
60 }
61 
62 unsigned char random_char()
63 {
64  std::random_device rd;
65  std::mt19937 gen(rd());
66  std::uniform_int_distribution<> dis(0, 255);
67  return static_cast<unsigned char>(dis(gen));
68 }
69 
70 std::string generate_hex(const unsigned int len)
71 {
72  std::stringstream ss;
73  for (auto i = 0; i < len; ++i)
74  {
75  auto rc = random_char();
76  std::stringstream hexstream;
77  hexstream << std::hex << int(rc);
78  auto hex = hexstream.str();
79  ss << (hex.length() < 2 ? '0' + hex : hex);
80  }
81  return ss.str();
82 }
83 
84 std::string generate_uuid()
85 {
86  return generate_hex(4) + "-" + generate_hex(4) + "-" + generate_hex(4) + "-" + generate_hex(4);
87 }
88 
89 struct Base
90 {
91  Base() = default;
92  Base(const std::string& type_in, const std::string& path_in) : type(type_in), path(path_in){};
93  std::string type;
94  std::string path;
95 };
96 
97 template <typename T>
98 struct Property : Base
99 {
100  Property() : Base("set_property", ""){};
101  Property(const std::string& path_in, const std::string& property_in, const T& value_in) : Base("set_property", path_in), property(property_in), value(value_in){};
102  std::string property;
103  T value;
105 };
106 
107 struct MetaData
108 {
109  MetaData() = default;
110  MetaData(double version_in, const std::string& type_in) : version(version_in), type(type_in){};
111  double version;
112  std::string type;
114 };
115 
116 struct Material
117 {
118  Material(long color_in, double opacity_in = 1.0, const std::string& type_in = "MeshPhongMaterial", const std::string& uuid_in = "") : color(color_in), opacity(opacity_in), uuid(uuid_in), type(type_in)
119  {
120  if (uuid_in == "") uuid = generate_uuid();
121  };
123  {
124  uuid = "0000-0000-0000-0000"; // Default material UUID
125  };
126  std::string uuid = "";
127  std::string type = "MeshPhongMaterial";
128  long color = 16777215;
129  long ambient = 0;
130  long emissive = 0;
131  long specular = 1118481;
132  double shininess = 30.0;
133  double opacity = 1.0;
134  bool transparent = false;
135  bool wireframe = false;
137 };
138 
140 {
141  ObjectData() = default;
142  ObjectData(const std::string& type_in, const std::string& uuid_in,
143  const std::string& geometry_in, const std::string& material_in) : type(type_in), uuid(uuid_in), geometry(geometry_in), material(material_in){};
144  std::string type;
145  std::string uuid;
146  std::string geometry;
147  std::string material;
148  std::vector<double> matrix = {1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0};
150 };
151 
152 template <typename T>
153 struct Object
154 {
155  MetaData metadata = MetaData(4.5, "Object");
157  std::vector<Material> materials;
158  std::vector<T> geometries;
160 };
161 
162 template <typename T>
164 {
165  MetaData metadata = MetaData(4.5, "Object");
167  std::vector<Material> materials;
168  std::vector<T> geometries;
170 };
171 
172 template <typename T>
174 {
175  SetObjectType() = default;
176  SetObjectType(const std::string& path_in, const T& object_in) : type("set_object"), path(path_in), object(object_in){};
177  std::string type;
178  std::string path;
180  MSGPACK_DEFINE(type, path, object);
181 };
182 
183 template <typename T>
184 SetObjectType<T> SetObject(const std::string& path_in, const T& object_in)
185 {
186  return SetObjectType<T>(path_in, object_in);
187 };
188 
189 struct Geometry
190 {
191  Geometry() = default;
192  Geometry(const std::string& type_in, const std::string& uuid_in = "") : type(type_in), uuid(uuid_in)
193  {
194  if (uuid_in == "") uuid = generate_uuid();
195  };
196  std::string uuid;
197  std::string type;
198 };
199 
201 {
202  GeometryBox() : Geometry("BoxGeometry", ""){};
203  GeometryBox(double width_in, double height_in, double depth_in, const std::string& uuid_in = "") : Geometry("BoxGeometry", uuid_in), width(width_in), height(height_in), depth(depth_in){};
204  double width;
205  double height;
206  double depth;
207  MSGPACK_DEFINE(uuid, type, width, height, depth)
208 };
209 
211 {
212  GeometryCylinder() : Geometry("CylinderGeometry", ""){};
213  GeometryCylinder(double radius_in, double height_in, int radialSegments_in = 50, const std::string& uuid_in = "") : Geometry("CylinderGeometry", uuid_in), radiusTop(radius_in), radiusBottom(radius_in), height(height_in), radialSegments(radialSegments_in){};
214  double height;
215  double radiusTop;
216  double radiusBottom;
218  MSGPACK_DEFINE(uuid, type, height, radiusTop, radiusBottom, radialSegments)
219 };
220 
222 {
223  GeometrySphere() : Geometry("SphereGeometry", ""){};
224  GeometrySphere(double radius_in, int widthSegments_in = 50, int heightSegments_in = 50, const std::string& uuid_in = "") : Geometry("SphereGeometry", uuid_in), radius(radius_in), heightSegments(heightSegments_in), widthSegments(widthSegments_in){};
225  double radius;
228  MSGPACK_DEFINE(uuid, type, radius, widthSegments, heightSegments)
229 };
230 
232 {
233  GeometryMesh() : Geometry("_meshfile_geometry", ""){};
234 
235  GeometryMesh(const std::string& file_name_in, const std::string& url_in = "", const std::string& format_in = "", const std::string& uuid_in = "") : Geometry("_meshfile_geometry", uuid_in), format(format_in)
236  {
237  file_name = ParsePath(file_name_in);
238  if (format_in == "")
239  {
240  std::string::size_type pos = file_name.rfind(".");
241  if (pos != std::string::npos)
242  {
243  format = file_name.substr(pos + 1);
244  }
245  }
246  std::transform(format.begin(), format.end(), format.begin(), ::tolower);
247  url = ParsePath(url_in);
248  std::ifstream file(file_name, std::ios::binary | std::ios::ate);
249  std::streamsize size = file.tellg();
250  file.seekg(0, std::ios::beg);
251 
252  buffer.resize(size);
253  file.read(buffer.data(), size);
254 
255  data.ptr = buffer.data();
256  data.size = buffer.size();
257  }
258 
259  GeometryMesh(const GeometryMesh& other) : Geometry(other.type, other.uuid)
260  {
261  buffer = other.buffer;
262  url = other.url;
263  resources = other.resources;
264  matrix = other.matrix;
265  format = other.format;
266  data.ptr = buffer.data();
267  data.size = buffer.size();
268  }
269 
271  {
272  if (this != &other)
273  {
274  type = other.type;
275  uuid = other.uuid;
276  buffer = other.buffer;
277  url = other.url;
278  resources = other.resources;
279  matrix = other.matrix;
280  format = other.format;
281  data.ptr = buffer.data();
282  data.size = buffer.size();
283  }
284  return *this;
285  }
286 
287  std::vector<char> buffer;
288  std::string file_name;
289  std::string format;
291  std::string url;
292  std::map<std::string, std::string> resources;
293  std::vector<double> matrix = {1.0, 0.0, 0.0, 0.0,
294  0.0, 1.0, 0.0, 0.0,
295  0.0, 0.0, 1.0, 0.0,
296  0.0, 0.0, 0.0, 1.0};
297  MSGPACK_DEFINE(uuid, type, format, resources, url, data, matrix)
298 };
299 
301 {
302  ArrayFloat() = default;
303  ~ArrayFloat() = default;
304 
305  ArrayFloat(double* data_in, unsigned int size)
306  {
307  data.resize(size);
308  for (unsigned int i = 0; i < size; ++i)
309  data[i] = static_cast<float>(data_in[i]);
310 #ifdef MSGPACK_FEATURE_NOT_SUPPORTED
311  array = data;
312  WARNING("MSGPACK version does not support sending this type of data. Ignoring.");
313 #else
314  array = msgpack_ext(0x17, reinterpret_cast<const char*>(data.data()), sizeof(float) * data.size());
315 #endif
316  }
317 
318  ArrayFloat(const ArrayFloat& other)
319  {
320  itemSize = other.itemSize;
321  normalized = other.normalized;
322  data = other.data;
323 #ifdef MSGPACK_FEATURE_NOT_SUPPORTED
324  array = data;
325 #else
326  array = msgpack_ext(0x17, reinterpret_cast<const char*>(data.data()), sizeof(float) * data.size());
327 #endif
328  }
329 
330  int itemSize = 3;
331  std::string type = "Float32Array";
332  bool normalized = false;
333  std::vector<float> data;
335 
336  MSGPACK_DEFINE(itemSize, type, normalized, array)
337 };
338 
339 struct ArrayInt
340 {
341  ArrayInt() = default;
342 
343  ArrayInt(unsigned int* data, unsigned int size)
344  {
345  array.resize(size);
346  for (unsigned int i = 0; i < size; ++i)
347  array[i] = data[i];
348  }
349 
350  int itemSize = 3;
351  std::string type = "Uint32Array";
352  bool normalized = false;
353  std::vector<uint32_t> array;
354 
355  MSGPACK_DEFINE(itemSize, type, normalized, array)
356 };
357 
359 {
360  GeometryMeshBufferData() = default;
361  GeometryMeshBufferData(shapes::ShapePtr shape_in)
362  {
363  std::shared_ptr<shapes::Mesh> shape = std::static_pointer_cast<shapes::Mesh>(shape_in);
364  attributes.insert(std::make_pair<std::string, ArrayFloat>("position", ArrayFloat(shape->vertices, shape->vertex_count * 3)));
365  if (shape->vertex_normals)
366  attributes.insert(std::make_pair<std::string, ArrayFloat>("normal", ArrayFloat(shape->vertex_normals, shape->vertex_count * 3)));
367  index = ArrayInt(shape->triangles, shape->triangle_count * 3);
368  }
369 
370  std::map<std::string, ArrayFloat> attributes;
372 
373  MSGPACK_DEFINE(attributes, index)
374 };
375 
377 {
378  GeometryMeshBuffer() : Geometry("BufferGeometry", ""){};
379 
380  GeometryMeshBuffer(shapes::ShapePtr shape_in, const std::string& uuid_in = "") : Geometry("BufferGeometry", uuid_in)
381  {
382  data = GeometryMeshBufferData(shape_in);
383  };
384 
386  std::vector<double> matrix = {1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0};
387  MSGPACK_DEFINE(uuid, type, data, matrix)
388 };
389 
390 template <typename T>
391 Object<T> CreateGeometryObject(const T& geometry_in, const Material& material_in = Material(), const std::string& uuid_in = "")
392 {
393  Object<T> ret;
394  ret.geometries.push_back(geometry_in);
395  ret.materials.push_back(material_in);
396  ret.object.type = "Mesh";
397  ret.object.uuid = uuid_in == "" ? generate_uuid() : uuid_in;
398  ret.object.geometry = geometry_in.uuid;
399  ret.object.material = material_in.uuid;
400  return ret;
401 };
402 
403 template <typename T>
404 MeshObject<T> CreateMeshObject(const T& geometry_in, const Material& material_in = Material(), const std::string& uuid_in = "")
405 {
406  MeshObject<T> ret;
407  ret.object = geometry_in;
408  ret.object.type = "_meshfile_object";
409  return ret;
410 };
411 
413 {
414  SetTransform() = default;
415  SetTransform(const std::string& path_in, const std::vector<double>& matrix_in) : type("set_transform"), path(path_in), matrix(matrix_in){};
416  std::string type;
417  std::string path;
418  std::vector<double> matrix;
420 };
421 
422 struct Key
423 {
424  Key() = default;
425  Key(double time_in, const std::vector<double>& value_in) : time(time_in), value(value_in){};
426  double time;
427  std::vector<double> value;
429 };
430 
431 struct Track
432 {
433  Track() = default;
434  Track(const std::string& name_in, const std::string& type_in) : name(name_in), type(type_in){};
435  std::string name;
436  std::string type;
437  std::vector<Key> keys;
439 };
440 
441 struct Clip
442 {
443  Clip() = default;
444  Clip(double fps_in, const std::string& name_in) : fps(fps_in), name(name_in){};
445  double fps;
446  std::string name;
447  std::vector<Track> tracks;
449 };
450 
451 struct Animation
452 {
453  Animation() = default;
454  Animation(const std::string& path_in) : path(path_in){};
455  std::string path;
458 };
459 
461 {
462  AnimationOption() = default;
463  bool play = true;
464  int repetitions = 1;
466 };
467 
469 {
470  SetAnimation() = default;
471  std::string type = "set_animation";
472  std::string path = "";
473  std::vector<Animation> animations;
476 };
477 
478 struct Delete
479 {
480  Delete() = default;
481  Delete(const std::string& path_in) : path(path_in){};
482  std::string type = "delete";
483  std::string path = "";
485 };
486 } // namespace visualization
487 } // namespace exotica
488 #endif // EXOTICA_CORE_VISUALIZATION_MESHCAT_TYPES_H_
exotica::visualization::ArrayFloat::normalized
bool normalized
Definition: visualization_meshcat_types.h:332
exotica::visualization::Property::value
T value
Definition: visualization_meshcat_types.h:103
exotica::visualization::Delete::MSGPACK_DEFINE
MSGPACK_DEFINE(type, path)
exotica::visualization::GeometryMeshBufferData
Definition: visualization_meshcat_types.h:358
exotica::visualization::GeometryMesh::GeometryMesh
GeometryMesh(const std::string &file_name_in, const std::string &url_in="", const std::string &format_in="", const std::string &uuid_in="")
Definition: visualization_meshcat_types.h:235
exotica::visualization::GeometrySphere::widthSegments
int widthSegments
Definition: visualization_meshcat_types.h:226
exotica::visualization::Key::Key
Key()=default
exotica::visualization::Base
Definition: visualization_meshcat_types.h:89
exotica::visualization::CreateGeometryObject
Object< T > CreateGeometryObject(const T &geometry_in, const Material &material_in=Material(), const std::string &uuid_in="")
Definition: visualization_meshcat_types.h:391
exotica::visualization::SetTransform::matrix
std::vector< double > matrix
Definition: visualization_meshcat_types.h:418
exotica::visualization::Key::time
double time
Definition: visualization_meshcat_types.h:425
exotica::visualization::Delete::type
std::string type
Definition: visualization_meshcat_types.h:482
exotica::visualization::MetaData::MetaData
MetaData()=default
exotica::visualization::SetAnimation::MSGPACK_DEFINE
MSGPACK_DEFINE(type, path, animations, options)
exotica::visualization::ArrayInt::type
std::string type
Definition: visualization_meshcat_types.h:351
exotica::visualization::SetObjectType::SetObjectType
SetObjectType()=default
exotica::visualization::ArrayInt
Definition: visualization_meshcat_types.h:339
exotica::visualization::Delete
Definition: visualization_meshcat_types.h:478
exotica::visualization::Material::Material
Material()
Definition: visualization_meshcat_types.h:122
msgpack_raw_ref
msgpack::type::raw_ref msgpack_raw_ref
Definition: visualization_meshcat_types.h:48
exotica::visualization::MeshObject::MSGPACK_DEFINE
MSGPACK_DEFINE(metadata, geometries, materials, object)
exotica::visualization::Delete::path
std::string path
Definition: visualization_meshcat_types.h:483
exotica::visualization::Material::opacity
double opacity
Definition: visualization_meshcat_types.h:133
exotica::visualization::Key::MSGPACK_DEFINE
MSGPACK_DEFINE(time, value)
exotica::visualization::SetTransform::SetTransform
SetTransform()=default
exotica::visualization::Object::metadata
MetaData metadata
Definition: visualization_meshcat_types.h:155
exotica::visualization::Clip::fps
double fps
Definition: visualization_meshcat_types.h:444
exotica::visualization::GeometryMesh::file_name
std::string file_name
Definition: visualization_meshcat_types.h:288
exotica::visualization::Base::path
std::string path
Definition: visualization_meshcat_types.h:94
exotica::visualization::Material::wireframe
bool wireframe
Definition: visualization_meshcat_types.h:135
exotica::visualization::Geometry::Geometry
Geometry()=default
exotica::visualization::ObjectData::matrix
std::vector< double > matrix
Definition: visualization_meshcat_types.h:148
exotica::visualization::GeometryCylinder
Definition: visualization_meshcat_types.h:210
exotica::visualization::generate_uuid
std::string generate_uuid()
Definition: visualization_meshcat_types.h:84
exotica::visualization::Material::transparent
bool transparent
Definition: visualization_meshcat_types.h:134
exotica::visualization::Property::Property
Property()
Definition: visualization_meshcat_types.h:100
exotica::visualization::SetAnimation
Definition: visualization_meshcat_types.h:468
exotica::visualization::Material::type
std::string type
Definition: visualization_meshcat_types.h:127
exotica::visualization::ObjectData::ObjectData
ObjectData()=default
exotica::visualization::ArrayInt::normalized
bool normalized
Definition: visualization_meshcat_types.h:352
exotica::visualization::GeometryMeshBuffer::GeometryMeshBuffer
GeometryMeshBuffer(shapes::ShapePtr shape_in, const std::string &uuid_in="")
Definition: visualization_meshcat_types.h:380
exotica::visualization::ArrayFloat::ArrayFloat
ArrayFloat()=default
exotica::visualization::GeometrySphere
Definition: visualization_meshcat_types.h:221
exotica::visualization::ArrayInt::ArrayInt
ArrayInt(unsigned int *data, unsigned int size)
Definition: visualization_meshcat_types.h:343
exotica::visualization::Clip::tracks
std::vector< Track > tracks
Definition: visualization_meshcat_types.h:447
exotica::visualization::ArrayFloat::data
std::vector< float > data
Definition: visualization_meshcat_types.h:333
exotica::visualization::random_char
unsigned char random_char()
Definition: visualization_meshcat_types.h:62
exotica::visualization::SetObjectType::type
std::string type
Definition: visualization_meshcat_types.h:176
exotica::visualization::Object::object
ObjectData object
Definition: visualization_meshcat_types.h:156
exotica::visualization::Clip::Clip
Clip()=default
exotica::visualization::Animation::clip
Clip clip
Definition: visualization_meshcat_types.h:456
exotica
Definition: cartpole_dynamics_solver.h:38
exotica::visualization::Material::color
long color
Definition: visualization_meshcat_types.h:128
exotica::visualization::Material::ambient
long ambient
Definition: visualization_meshcat_types.h:129
exotica::visualization::ArrayFloat::type
std::string type
Definition: visualization_meshcat_types.h:331
exotica::visualization::GeometryCylinder::radialSegments
int radialSegments
Definition: visualization_meshcat_types.h:217
exotica::visualization::ObjectData::material
std::string material
Definition: visualization_meshcat_types.h:147
exotica::visualization::GeometryCylinder::radiusBottom
double radiusBottom
Definition: visualization_meshcat_types.h:216
exotica::visualization::MeshObject::metadata
MetaData metadata
Definition: visualization_meshcat_types.h:165
exotica::visualization::Track::name
std::string name
Definition: visualization_meshcat_types.h:434
exotica::visualization::GeometryMesh::GeometryMesh
GeometryMesh()
Definition: visualization_meshcat_types.h:233
exotica::visualization::GeometryMesh::operator=
GeometryMesh & operator=(const GeometryMesh &other)
Definition: visualization_meshcat_types.h:270
exotica::visualization::MeshObject
Definition: visualization_meshcat_types.h:163
exotica::visualization::SetTransform
Definition: visualization_meshcat_types.h:412
exotica::visualization::SetObjectType::object
T object
Definition: visualization_meshcat_types.h:179
scene.h
exotica::visualization::SetTransform::path
std::string path
Definition: visualization_meshcat_types.h:417
exotica::visualization::GeometryBox::height
double height
Definition: visualization_meshcat_types.h:205
exotica::visualization::SetObjectType::MSGPACK_DEFINE
MSGPACK_DEFINE(type, path, object)
exotica::visualization::ArrayFloat::ArrayFloat
ArrayFloat(double *data_in, unsigned int size)
Definition: visualization_meshcat_types.h:305
exotica::visualization::ArrayInt::array
std::vector< uint32_t > array
Definition: visualization_meshcat_types.h:353
exotica::visualization::SetObjectType::path
std::string path
Definition: visualization_meshcat_types.h:178
exotica::visualization::Material::shininess
double shininess
Definition: visualization_meshcat_types.h:132
exotica::visualization::ArrayInt::ArrayInt
ArrayInt()=default
exotica::visualization::AnimationOption::MSGPACK_DEFINE
MSGPACK_DEFINE(play, repetitions)
exotica::visualization::GeometryMeshBuffer::GeometryMeshBuffer
GeometryMeshBuffer()
Definition: visualization_meshcat_types.h:378
exotica::visualization::SetObject
SetObjectType< T > SetObject(const std::string &path_in, const T &object_in)
Definition: visualization_meshcat_types.h:184
exotica::visualization::GeometryMeshBuffer::matrix
std::vector< double > matrix
Definition: visualization_meshcat_types.h:386
exotica::visualization::Animation::path
std::string path
Definition: visualization_meshcat_types.h:454
exotica::visualization::Key
Definition: visualization_meshcat_types.h:422
exotica::visualization::GeometryMesh::data
msgpack_raw_ref data
Definition: visualization_meshcat_types.h:290
exotica::visualization::ObjectData::type
std::string type
Definition: visualization_meshcat_types.h:143
exotica::visualization::Material::Material
Material(long color_in, double opacity_in=1.0, const std::string &type_in="MeshPhongMaterial", const std::string &uuid_in="")
Definition: visualization_meshcat_types.h:118
exotica::visualization::Track::keys
std::vector< Key > keys
Definition: visualization_meshcat_types.h:437
exotica::visualization::GeometrySphere::heightSegments
int heightSegments
Definition: visualization_meshcat_types.h:227
exotica::visualization::Property::property
std::string property
Definition: visualization_meshcat_types.h:101
exotica::visualization::MetaData::MSGPACK_DEFINE
MSGPACK_DEFINE(version, type)
exotica::visualization::Delete::Delete
Delete()=default
exotica::visualization::MetaData::type
std::string type
Definition: visualization_meshcat_types.h:112
exotica::visualization::Property::MSGPACK_DEFINE
MSGPACK_DEFINE(type, path, property, value)
exotica::visualization::Material::uuid
std::string uuid
Definition: visualization_meshcat_types.h:126
exotica::visualization::generate_hex
std::string generate_hex(const unsigned int len)
Definition: visualization_meshcat_types.h:70
exotica::visualization::Object
Definition: visualization_meshcat_types.h:153
exotica::visualization::SetTransform::type
std::string type
Definition: visualization_meshcat_types.h:415
exotica::visualization::GeometryBox::depth
double depth
Definition: visualization_meshcat_types.h:206
exotica::visualization::Geometry
Definition: visualization_meshcat_types.h:189
exotica::visualization::Material::MSGPACK_DEFINE
MSGPACK_DEFINE(uuid, type, color, ambient, emissive, specular, shininess, opacity, transparent, wireframe)
exotica::visualization::Track::Track
Track()=default
exotica::visualization::Object::geometries
std::vector< T > geometries
Definition: visualization_meshcat_types.h:158
exotica::visualization::ObjectData::geometry
std::string geometry
Definition: visualization_meshcat_types.h:146
exotica::ParsePath
std::string ParsePath(const std::string &path)
exotica::visualization::AnimationOption::play
bool play
Definition: visualization_meshcat_types.h:463
exotica::visualization::GeometryMeshBuffer::data
GeometryMeshBufferData data
Definition: visualization_meshcat_types.h:383
exotica::visualization::GeometryCylinder::radiusTop
double radiusTop
Definition: visualization_meshcat_types.h:215
exotica::visualization::GeometryCylinder::GeometryCylinder
GeometryCylinder()
Definition: visualization_meshcat_types.h:212
exotica::visualization::Animation::MSGPACK_DEFINE
MSGPACK_DEFINE(path, clip)
exotica::visualization::GeometryMeshBufferData::index
ArrayInt index
Definition: visualization_meshcat_types.h:371
exotica::visualization::Animation
Definition: visualization_meshcat_types.h:451
exotica::visualization::SetAnimation::type
std::string type
Definition: visualization_meshcat_types.h:471
msgpack_ext
std::vector< float > msgpack_ext
Definition: visualization_meshcat_types.h:49
exotica::visualization::Clip
Definition: visualization_meshcat_types.h:441
exotica::visualization::Geometry::Geometry
Geometry(const std::string &type_in, const std::string &uuid_in="")
Definition: visualization_meshcat_types.h:192
exotica::visualization::Base::type
std::string type
Definition: visualization_meshcat_types.h:92
exotica::visualization::MetaData::version
double version
Definition: visualization_meshcat_types.h:110
exotica::visualization::MeshObject::geometries
std::vector< T > geometries
Definition: visualization_meshcat_types.h:168
exotica::visualization::GeometryMeshBufferData::GeometryMeshBufferData
GeometryMeshBufferData()=default
exotica::visualization::GeometryBox::GeometryBox
GeometryBox()
Definition: visualization_meshcat_types.h:202
exotica::visualization::Track::type
std::string type
Definition: visualization_meshcat_types.h:436
exotica::visualization::ArrayFloat::itemSize
int itemSize
Definition: visualization_meshcat_types.h:330
exotica::visualization::ArrayFloat
Definition: visualization_meshcat_types.h:300
exotica::visualization::Animation::Animation
Animation()=default
exotica::visualization::SetAnimation::SetAnimation
SetAnimation()=default
exotica::visualization::Geometry::uuid
std::string uuid
Definition: visualization_meshcat_types.h:195
exotica::visualization::GeometryMesh::matrix
std::vector< double > matrix
Definition: visualization_meshcat_types.h:293
exotica::visualization::Delete::Delete
Delete(const std::string &path_in)
Definition: visualization_meshcat_types.h:481
exotica::visualization::CreateMeshObject
MeshObject< T > CreateMeshObject(const T &geometry_in, const Material &material_in=Material(), const std::string &uuid_in="")
Definition: visualization_meshcat_types.h:404
exotica::visualization::GeometryMesh::buffer
std::vector< char > buffer
Definition: visualization_meshcat_types.h:287
exotica::visualization::ArrayFloat::~ArrayFloat
~ArrayFloat()=default
exotica::visualization::GeometryMesh::resources
std::map< std::string, std::string > resources
Definition: visualization_meshcat_types.h:292
exotica::visualization::GeometryCylinder::height
double height
Definition: visualization_meshcat_types.h:213
exotica::visualization::SetAnimation::animations
std::vector< Animation > animations
Definition: visualization_meshcat_types.h:473
WARNING
#define WARNING(x)
With endline.
Definition: printable.h:56
exotica::visualization::Track::MSGPACK_DEFINE
MSGPACK_DEFINE(name, type, keys)
exotica::visualization::Geometry::type
std::string type
Definition: visualization_meshcat_types.h:197
exotica::visualization::GeometryBox::width
double width
Definition: visualization_meshcat_types.h:203
exotica::visualization::GeometryBox
Definition: visualization_meshcat_types.h:200
exotica::visualization::Clip::name
std::string name
Definition: visualization_meshcat_types.h:446
exotica::visualization::Material
Definition: visualization_meshcat_types.h:116
exotica::visualization::Track::Track
Track(const std::string &name_in, const std::string &type_in)
Definition: visualization_meshcat_types.h:434
exotica::visualization::SetAnimation::path
std::string path
Definition: visualization_meshcat_types.h:472
exotica::visualization::GeometryMesh::url
std::string url
Definition: visualization_meshcat_types.h:291
exotica::visualization::ObjectData::MSGPACK_DEFINE
MSGPACK_DEFINE(type, uuid, geometry, material, matrix)
exotica::visualization::Key::value
std::vector< double > value
Definition: visualization_meshcat_types.h:427
exotica::visualization::GeometryMeshBufferData::attributes
std::map< std::string, ArrayFloat > attributes
Definition: visualization_meshcat_types.h:370
exotica::visualization::Object::MSGPACK_DEFINE
MSGPACK_DEFINE(metadata, geometries, materials, object)
exotica::visualization::ObjectData::uuid
std::string uuid
Definition: visualization_meshcat_types.h:145
exotica::visualization::MetaData
Definition: visualization_meshcat_types.h:107
exotica::visualization::ObjectData::ObjectData
ObjectData(const std::string &type_in, const std::string &uuid_in, const std::string &geometry_in, const std::string &material_in)
Definition: visualization_meshcat_types.h:142
exotica::visualization::SetAnimation::options
AnimationOption options
Definition: visualization_meshcat_types.h:474
exotica::visualization::SetTransform::MSGPACK_DEFINE
MSGPACK_DEFINE(type, path, matrix)
exotica::visualization::Material::specular
long specular
Definition: visualization_meshcat_types.h:131
tools.h
exotica::visualization::GeometryMesh::GeometryMesh
GeometryMesh(const GeometryMesh &other)
Definition: visualization_meshcat_types.h:259
exotica::visualization::GeometrySphere::GeometrySphere
GeometrySphere()
Definition: visualization_meshcat_types.h:223
exotica::visualization::GeometryMesh::format
std::string format
Definition: visualization_meshcat_types.h:289
exotica::visualization::Property
Definition: visualization_meshcat_types.h:98
exotica::visualization::Material::emissive
long emissive
Definition: visualization_meshcat_types.h:130
exotica::visualization::GeometryMesh
Definition: visualization_meshcat_types.h:231
exotica::visualization::Track
Definition: visualization_meshcat_types.h:431
exotica::visualization::ObjectData
Definition: visualization_meshcat_types.h:139
exotica::visualization::GeometrySphere::radius
double radius
Definition: visualization_meshcat_types.h:224
exotica::visualization::RGB
long RGB(double R, double G, double B)
Definition: visualization_meshcat_types.h:57
exotica::visualization::ArrayInt::itemSize
int itemSize
Definition: visualization_meshcat_types.h:350
exotica::visualization::Base::Base
Base()=default
exotica::visualization::Object::materials
std::vector< Material > materials
Definition: visualization_meshcat_types.h:157
exotica::visualization::Clip::MSGPACK_DEFINE
MSGPACK_DEFINE(fps, name, tracks)
exotica::visualization::ArrayFloat::array
msgpack_ext array
Definition: visualization_meshcat_types.h:334
exotica::visualization::AnimationOption
Definition: visualization_meshcat_types.h:460
exotica::visualization::GeometryMeshBufferData::GeometryMeshBufferData
GeometryMeshBufferData(shapes::ShapePtr shape_in)
Definition: visualization_meshcat_types.h:361
exotica::visualization::AnimationOption::AnimationOption
AnimationOption()=default
exotica::visualization::ArrayFloat::ArrayFloat
ArrayFloat(const ArrayFloat &other)
Definition: visualization_meshcat_types.h:318
exotica::visualization::MeshObject::materials
std::vector< Material > materials
Definition: visualization_meshcat_types.h:167
exotica::visualization::SetObjectType
Definition: visualization_meshcat_types.h:173
exotica::visualization::MeshObject::object
T object
Definition: visualization_meshcat_types.h:166
exotica::visualization::AnimationOption::repetitions
int repetitions
Definition: visualization_meshcat_types.h:464
exotica::visualization::GeometryMeshBuffer
Definition: visualization_meshcat_types.h:376