facing_visualizer.cpp
Go to the documentation of this file.
1 // -*- mode: c++ -*-
2 /*********************************************************************
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2014, JSK Lab
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of the JSK Lab nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *********************************************************************/
35 
36 #include "facing_visualizer.h"
38 #include <rviz/render_panel.h>
39 #include <rviz/view_manager.h>
41 #include <QPainter>
42 
43 namespace jsk_rviz_plugins
44 {
45 
46  const double minimum_font_size = 0.2;
47  const float arrow_animation_duration = 1.0;
48 
49  SquareObject::SquareObject(Ogre::SceneManager* manager,
50  double outer_radius,
51  double inner_radius,
52  std::string name):
53  manager_(manager), outer_radius_(outer_radius),
54  inner_radius_(inner_radius), name_(name), polygon_type_(CIRCLE)
55  {
56  manual_ = manager->createManualObject();
57  rebuildPolygon();
58  }
59 
61  {
62  manual_->detachFromParent();
63  manager_->destroyManualObject(manual_);
64  }
65 
66  Ogre::ManualObject* SquareObject::getManualObject()
67  {
68  return manual_;
69  }
70 
71  void SquareObject::setOuterRadius(double outer_radius)
72  {
73  outer_radius_ = outer_radius;
74  }
75 
76  void SquareObject::setInnerRadius(double inner_radius)
77  {
78  inner_radius_ = inner_radius;
79  }
80 
82  {
83  manual_->clear();
84  manual_->begin(name_,
85  Ogre::RenderOperation::OT_TRIANGLE_STRIP);
86  if (polygon_type_ == CIRCLE) {
87  const size_t resolution = 100;
88  const double radius_ratio = inner_radius_ / outer_radius_;
89  const double inner_offset = - outer_radius_ * 0.0;
90  int counter = 0;
91  for (size_t i = 0; i < resolution; i++) {
92  double theta = 2.0 * M_PI / resolution * i;
93  double next_theta = 2.0 * M_PI / resolution * (i + 1);
94 
95  manual_->position(inner_radius_ * cos(theta) + inner_offset,
96  inner_radius_ * sin(theta) + inner_offset,
97  0.0f);
98  manual_->textureCoord((1 + radius_ratio * cos(theta)) / 2.0,
99  (1.0 - radius_ratio * sin(theta)) / 2.0);
100  manual_->index(counter++);
101  manual_->position(outer_radius_ * cos(theta),
102  outer_radius_ * sin(theta),
103  0.0f);
104  manual_->textureCoord((1 + cos(theta)) / 2.0,
105  (1.0 -sin(theta)) / 2.0);
106  manual_->index(counter++);
107  manual_->position(inner_radius_ * cos(next_theta) + inner_offset,
108  inner_radius_ * sin(next_theta) + inner_offset,
109  0.0f);
110  manual_->textureCoord((1 + radius_ratio * cos(next_theta)) / 2.0,
111  (1.0 - radius_ratio * sin(next_theta)) / 2.0);
112  manual_->index(counter++);
113  manual_->position(outer_radius_ * cos(next_theta),
114  outer_radius_ * sin(next_theta),
115  0.0f);
116  manual_->textureCoord((1 + cos(next_theta)) / 2.0,
117  (1.0 -sin(next_theta)) / 2.0);
118  manual_->index(counter++);
119 
120  }
121  }
122  else if (polygon_type_ == SQUARE) {
124  0.0f); // 1
125  manual_->textureCoord(0, 0); // 4
126  manual_->index(0);
127 
128  manual_->position(-outer_radius_, outer_radius_,
129  0.0f); // 2
130  manual_->textureCoord(0, 1); // 3
131  manual_->index(1);
132 
133  manual_->position(-outer_radius_, -outer_radius_,
134  0.0f); // 3
135  manual_->textureCoord(1, 1); // 2
136  manual_->index(2);
137 
138  manual_->position(outer_radius_, -outer_radius_,
139  0.0f); // 4
140  manual_->textureCoord(1, 0); // 1
141  manual_->index(3);
142 
144  0.0f); // 1
145  manual_->textureCoord(0, 0); // 4
146  manual_->index(4);
147  }
148  // for (size_t i = 0; i < resolution; i++) {
149  // }
150  // manual_->index(0);
151  manual_->end();
152  }
153 
154  void SquareObject::setPolygonType(PolygonType type)
155  {
157  }
158 
159  TextureObject::TextureObject(const int width, const int height,
160  const std::string name):
161  width_(width), height_(height), name_(name)
162  {
163  texture_ = Ogre::TextureManager::getSingleton().createManual(
164  name,
165  Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
166  Ogre::TEX_TYPE_2D,
167  width, height,
168  0,
169  Ogre::PF_A8R8G8B8,
170  Ogre::TU_DEFAULT
171  );
172  material_ = Ogre::MaterialManager::getSingleton().create(
173  getMaterialName(), // name
174  Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
175 
176  material_->getTechnique(0)->getPass(0)->createTextureUnitState(
177  texture_->getName());
178  material_->setReceiveShadows(false);
179  material_->getTechnique(0)->setLightingEnabled(true);
180  material_->getTechnique(0)->getPass(0)->setCullingMode(Ogre::CULL_NONE);
181  material_->getTechnique(0)->getPass(0)->setLightingEnabled(false);
182  material_->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false);
183  material_->getTechnique(0)->getPass(0)->setDepthCheckEnabled(true);
184 
185  material_->getTechnique(0)->getPass(0)->setVertexColourTracking(Ogre::TVC_DIFFUSE);
186  material_->getTechnique(0)->getPass(0)->createTextureUnitState(texture_->getName());
187  material_->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
188 
189  material_->getTechnique(0)->getPass(0)
190  ->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
191  // material_->getTechnique(0)->getPass(0)
192  // ->setSceneBlending(Ogre::SBT_MODULATE);
193 
194  }
195 
197  {
198  material_->unload();
199  Ogre::MaterialManager::getSingleton().remove(material_->getName());
200  }
201 
202  ScopedPixelBuffer TextureObject::getBuffer()
203  {
204  return ScopedPixelBuffer(texture_->getBuffer());
205  }
206 
207  std::string TextureObject::getMaterialName()
208  {
209  return name_ + "Material";
210  }
211 
212  FacingObject::FacingObject(Ogre::SceneManager* manager,
213  Ogre::SceneNode* parent,
214  double size):
215  scene_manager_(manager), size_(size), enable_(true), text_("")
216  {
217  node_ = parent->createChildSceneNode();
218  }
219 
221  {
222  node_->detachAllObjects();
223  scene_manager_->destroySceneNode(node_);
224  }
225 
226  void FacingObject::setPosition(Ogre::Vector3& pos)
227  {
228  node_->setPosition(pos);
229  }
230 
232  {
233  rviz::ViewManager* manager = context->getViewManager();
234  rviz::RenderPanel* panel = manager->getRenderPanel();
235  Ogre::Camera* camera = panel->getCamera();
236  Ogre::Quaternion q = camera->getDerivedOrientation();
237  setOrientation(q);
238  }
239 
240  void FacingObject::setOrientation(Ogre::Quaternion& rot)
241  {
242  node_->setOrientation(rot);
243  }
244 
245  void FacingObject::setSize(double size)
246  {
247  size_ = size;
248  }
249 
250  void FacingObject::setEnable(bool enable)
251  {
252  enable_ = enable;
253  node_->setVisible(enable_);
254  }
255 
256  void FacingObject::setText(std::string text)
257  {
259  //updateTextUnderLine();
260  updateText();
261  }
262 
264  {
265  color_.a = alpha;
266  updateColor();
267  }
268 
269  void FacingObject::setColor(QColor color)
270  {
271  color_.r = color.red() / 255.0;
272  color_.g = color.green() / 255.0;
273  color_.b = color.blue() / 255.0;
274  updateColor();
275  }
276 
277  void FacingObject::setColor(Ogre::ColourValue color)
278  {
279  color_ = color;
280  updateColor();
281  }
282 
284  Ogre::SceneManager* manager,
285  Ogre::SceneNode* parent,
286  rviz::DisplayContext* context,
287  double size,
288  std::string text):
289  FacingObject(manager, parent, size)
290  {
291  line_ = new rviz::BillboardLine(
292  context->getSceneManager(),
293  node_);
294  text_under_line_ = new rviz::BillboardLine(
295  context->getSceneManager(),
296  node_);
297  target_text_node_ = node_->createChildSceneNode();
298  msg_ = new rviz::MovableText("not initialized", "Liberation Sans", 0.05);
299  msg_->setVisible(false);
300  msg_->setTextAlignment(rviz::MovableText::H_LEFT,
302  target_text_node_->attachObject(msg_);
303  createArrows(context);
304  updateLine();
305  updateTextUnderLine();
306  updateText();
307  setEnable(false);
308  }
309 
311  {
312  delete line_;
313  delete text_under_line_;
314  delete msg_;
315  scene_manager_->destroyManualObject(upper_arrow_);
316  scene_manager_->destroyManualObject(lower_arrow_);
317  scene_manager_->destroyManualObject(left_arrow_);
318  scene_manager_->destroyManualObject(right_arrow_);
319  upper_material_->unload();
320  lower_material_->unload();
321  left_material_->unload();
322  right_material_->unload();
323  Ogre::MaterialManager::getSingleton().remove(upper_material_->getName());
324  Ogre::MaterialManager::getSingleton().remove(lower_material_->getName());
325  Ogre::MaterialManager::getSingleton().remove(left_material_->getName());
326  Ogre::MaterialManager::getSingleton().remove(right_material_->getName());
327  }
328 
329  void SimpleCircleFacingVisualizer::update(float wall_dt, float ros_dt)
330  {
331  double t_ = ros::WallTime::now().toSec();
332  double t_rate
334  upper_arrow_node_->setPosition(0, (1.3 - 0.3 * t_rate) * size_, 0);
335  lower_arrow_node_->setPosition(0, (-1.3 + 0.3 * t_rate) * size_, 0);
336  left_arrow_node_->setPosition((1.3 - 0.3 * t_rate) * size_, 0, 0);
337  right_arrow_node_->setPosition((-1.3 + 0.3 * t_rate) * size_, 0, 0);
338  }
339 
341  {
344  msg_->setVisible(false);
345  }
346 
347  void SimpleCircleFacingVisualizer::updateArrowsObjects(Ogre::ColourValue color)
348  {
349  const double size_factor = 0.15;
350  upper_arrow_node_->setPosition(Ogre::Vector3(0, size_ * 1.0, 0.0));
351  upper_arrow_->clear();
352  upper_arrow_->estimateVertexCount(3);
354  Ogre::RenderOperation::OT_TRIANGLE_LIST);
355 
356  upper_arrow_->colour(color);
357  upper_arrow_->position(Ogre::Vector3(0, size_ * size_factor, 0));
358  upper_arrow_->colour(color);
359  upper_arrow_->position(Ogre::Vector3(size_ * size_factor,
360  size_ * size_factor * 2,
361  0));
362  upper_arrow_->colour(color);
363  upper_arrow_->position(Ogre::Vector3(-size_ * size_factor,
364  size_ * size_factor * 2,
365  0));
366  upper_arrow_->end();
367 
368  lower_arrow_node_->setPosition(Ogre::Vector3(0, -size_ * 1.0, 0.0));
369  lower_arrow_->clear();
370  lower_arrow_->estimateVertexCount(3);
372  Ogre::RenderOperation::OT_TRIANGLE_LIST);
373 
374  lower_arrow_->colour(color);
375  lower_arrow_->position(Ogre::Vector3(0,
376  -size_ * size_factor,
377  0));
378  lower_arrow_->colour(color);
379  lower_arrow_->position(Ogre::Vector3(size_ * size_factor,
380  -size_ * size_factor * 2,
381  0));
382  lower_arrow_->colour(color);
383  lower_arrow_->position(Ogre::Vector3(-size_ * size_factor,
384  -size_ * size_factor * 2,
385  0));
386  lower_arrow_->end();
387  left_arrow_node_->setPosition(Ogre::Vector3(size_ * 1.0, 0.0, 0.0));
388  left_arrow_->clear();
389  left_arrow_->estimateVertexCount(3);
391  Ogre::RenderOperation::OT_TRIANGLE_LIST);
392 
393  left_arrow_->colour(color);
394  left_arrow_->position(Ogre::Vector3(size_ * size_factor,
395  0.0,
396  0));
397  left_arrow_->colour(color);
398  left_arrow_->position(Ogre::Vector3(size_ * size_factor * 2,
399  size_ * size_factor,
400  0));
401  left_arrow_->colour(color);
402  left_arrow_->position(Ogre::Vector3(size_ * size_factor * 2,
403  - size_ * size_factor,
404  0));
405  left_arrow_->end();
406 
407  right_arrow_node_->setPosition(Ogre::Vector3(-size_ * 1.0, 0.0, 0.0));
408  right_arrow_->clear();
409  right_arrow_->estimateVertexCount(3);
411  Ogre::RenderOperation::OT_TRIANGLE_LIST);
412 
413  right_arrow_->colour(color);
414  right_arrow_->position(Ogre::Vector3(-size_ * size_factor,
415  0.0,
416  0));
417  right_arrow_->colour(color);
418  right_arrow_->position(Ogre::Vector3(-size_ * size_factor * 2,
419  size_ * size_factor,
420  0));
421  right_arrow_->colour(color);
422  right_arrow_->position(Ogre::Vector3(-size_ * size_factor * 2,
423  - size_ * size_factor,
424  0));
425  right_arrow_->end();
426 
427 
428  upper_material_->getTechnique(0)->setLightingEnabled(false);
429  upper_material_->getTechnique(0)->setSceneBlending( Ogre::SBT_TRANSPARENT_ALPHA );
430  upper_material_->getTechnique(0)->setDepthWriteEnabled( false );
431  lower_material_->getTechnique(0)->setLightingEnabled(false);
432  lower_material_->getTechnique(0)->setSceneBlending( Ogre::SBT_TRANSPARENT_ALPHA );
433  lower_material_->getTechnique(0)->setDepthWriteEnabled( false );
434  left_material_->getTechnique(0)->setLightingEnabled(false);
435  left_material_->getTechnique(0)->setSceneBlending( Ogre::SBT_TRANSPARENT_ALPHA );
436  left_material_->getTechnique(0)->setDepthWriteEnabled( false );
437  right_material_->getTechnique(0)->setLightingEnabled(false);
438  right_material_->getTechnique(0)->setSceneBlending( Ogre::SBT_TRANSPARENT_ALPHA );
439  right_material_->getTechnique(0)->setDepthWriteEnabled( false );
440  }
441 
442  // allocate material and node for arrrows
444  rviz::DisplayContext* context)
445  {
446  static uint32_t count = 0;
448  ss << "TargetVisualizerDisplayTriangle" << count++;
449  ss << "Material";
450  ss << "0";
451  upper_material_name_ = std::string(ss.str());
452  ss << "1";
453  lower_material_name_ = std::string(ss.str());
454  ss << "2";
455  left_material_name_ = std::string(ss.str());
456  ss << "3";
457  right_material_name_ = std::string(ss.str());
458  upper_material_ = Ogre::MaterialManager::getSingleton().create(
460  Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
461  lower_material_ = Ogre::MaterialManager::getSingleton().create(
463  Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
464  left_material_ = Ogre::MaterialManager::getSingleton().create(
466  Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
467  right_material_ = Ogre::MaterialManager::getSingleton().create(
469  Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
470 
471  upper_material_->setReceiveShadows(false);
472  upper_material_->getTechnique(0)->setLightingEnabled(true);
473  upper_material_->setCullingMode(Ogre::CULL_NONE);
474  lower_material_->setReceiveShadows(false);
475  lower_material_->getTechnique(0)->setLightingEnabled(true);
476  lower_material_->setCullingMode(Ogre::CULL_NONE);
477  left_material_->setReceiveShadows(false);
478  left_material_->getTechnique(0)->setLightingEnabled(true);
479  left_material_->setCullingMode(Ogre::CULL_NONE);
480  right_material_->setReceiveShadows(false);
481  right_material_->getTechnique(0)->setLightingEnabled(true);
482  right_material_->setCullingMode(Ogre::CULL_NONE);
483 
484  upper_arrow_ = context->getSceneManager()->createManualObject(
486  upper_arrow_node_ = node_->createChildSceneNode();
487  upper_arrow_node_->attachObject(upper_arrow_);
488  lower_arrow_ = context->getSceneManager()->createManualObject(
490  lower_arrow_node_ = node_->createChildSceneNode();
491  lower_arrow_node_->attachObject(lower_arrow_);
492  left_arrow_ = context->getSceneManager()->createManualObject(
494  left_arrow_node_ = node_->createChildSceneNode();
495  left_arrow_node_->attachObject(left_arrow_);
496  right_arrow_ = context->getSceneManager()->createManualObject(
498  right_arrow_node_ = node_->createChildSceneNode();
499  right_arrow_node_->attachObject(right_arrow_);
501  }
502 
504  {
505  const int resolution = 100;
506  line_->clear();
507  line_->setColor(color_.r, color_.g, color_.b, color_.a);
508  line_->setLineWidth(0.1 * size_);
509  line_->setNumLines(1);
510  line_->setMaxPointsPerLine(1024);
511  for (size_t i = 0; i < resolution + 1; i++) {
512  double x = size_ * cos(i * 2 * M_PI / resolution);
513  double y = size_ * sin(i * 2 * M_PI / resolution);
514  double z = 0;
515  Ogre::Vector3 p;
516  p[0] = x;
517  p[1] = y;
518  p[2] = z;
519  line_->addPoint(p);
520  }
521  }
522 
523  // need msg to be initialized beforehand
525  {
526  Ogre::Vector3 text_position(size_ * cos(45.0 / 180.0 * M_PI)
527  + size_ / 2.0,
528  size_ * sin(45.0 / 180.0 * M_PI)
529  + size_ / 2.0,
530  0);
531  target_text_node_->setPosition(text_position);
532  Ogre::Vector3 msg_size = msg_->GetAABB().getSize();
535 
539  Ogre::Vector3 A(size_ * cos(45.0 / 180.0 * M_PI),
540  size_ * sin(45.0 / 180.0 * M_PI),
541  0);
542  Ogre::Vector3 B(text_position + Ogre::Vector3(- size_ / 4.0, 0, 0));
543  Ogre::Vector3 C(text_position + Ogre::Vector3(msg_size[0], 0, 0));
547  }
548 
550  {
552  updateLine();
553  updateText();
555  }
556 
558  {
559  FacingObject::setEnable(enable);
560  msg_->setVisible(enable);
561  line_->getSceneNode()->setVisible(enable);
562  text_under_line_->getSceneNode()->setVisible(enable);
563  }
564 
566  {
568  msg_->setCharacterHeight(std::max(0.15 * size_, minimum_font_size));
569  }
570 
572  {
573  text_ = text;
575  updateText();
576  }
577 
579  {
580  msg_->setColor(color_);
584  }
585 
586  FacingTexturedObject::FacingTexturedObject(Ogre::SceneManager* manager,
587  Ogre::SceneNode* parent,
588  double size):
589  FacingObject(manager, parent, size)
590  {
592  static int count = 0;
593  ss << "FacingVisualizer" << count++;
594  texture_object_.reset(new TextureObject(128, 128, ss.str()));
595  square_object_.reset(new SquareObject(manager, size, 0,
596  texture_object_->getMaterialName()));
597  node_->attachObject(square_object_->getManualObject());
598  }
599 
600 
602  {
604  square_object_->setOuterRadius(size_);
605  square_object_->rebuildPolygon();
606  }
607 
608  GISCircleVisualizer::GISCircleVisualizer(Ogre::SceneManager* manager,
609  Ogre::SceneNode* parent,
610  double size,
611  std::string text):
612  FacingTexturedObject(manager, parent, size), text_(text)
613  {
614 
615  }
616 
617  void GISCircleVisualizer::update(float wall_dt, float ros_dt)
618  {
620  std::string text = text_ + " ";
621  {
622  ScopedPixelBuffer buffer = texture_object_->getBuffer();
623  QColor transparent(0, 0, 0, 0);
624  QColor foreground = rviz::ogreToQt(color_);
625  QColor white(255, 255, 255, color_.a * 255);
626  QImage Hud = buffer.getQImage(128, 128, transparent);
627  double line_width = 5;
628  double inner_line_width = 10;
629  double l = 128;
630  //double cx = l / 2 - line_width / 4.0;
631  double cx = l / 2;
632  //double cy = l / 2 - line_width / 4.0;
633  double cy = l / 2;
634  double r = 48;
635  double inner_r = 40;
636  double mouse_r = 30;
637  double mouse_cy_offset = 5;
638 
639  QPainter painter( &Hud );
640  painter.setRenderHint(QPainter::Antialiasing, true);
641  painter.setPen(QPen(foreground, line_width, Qt::SolidLine));
642  painter.setBrush(white);
643  painter.drawEllipse(line_width / 2.0, line_width / 2.0,
644  l - line_width, l - line_width);
645  double offset_rate = fmod(now.toSec(), 10) / 10.0;
646  double theta_offset = offset_rate * M_PI * 2.0;
647  for (size_t ci = 0; ci < text.length(); ci++) {
648  double theta = M_PI * 2.0 / text.length() * ci + theta_offset;
649  painter.save();
650  QFont font("DejaVu Sans Mono");
651  font.setPointSize(8);
652  font.setBold(false);
653  painter.setFont(font);
654  painter.translate(cx + r * cos(theta),
655  cy + r * sin(theta));
656  painter.rotate(theta / M_PI * 180 + 90);
657  painter.drawText(0, 0, text.substr(ci, 1).c_str());
658  painter.restore();
659  }
660  painter.setPen(QPen(foreground, inner_line_width, Qt::SolidLine));
661  painter.setBrush(transparent);
662  painter.drawEllipse(cx - inner_r, cy - inner_r,
663  inner_r * 2, inner_r * 2);
664  double mouse_c_x = cx;
665  double mouse_c_y = cy - mouse_cy_offset;
666  double start_angle = -25 * M_PI / 180;
667  double end_angle = -125 * M_PI / 180;
668  painter.setPen(QPen(foreground, line_width, Qt::SolidLine));
669  painter.drawChord(mouse_c_x - mouse_r, mouse_c_y - mouse_r,
670  2.0 * mouse_r, 2.0 * mouse_r,
671  start_angle * 180 / M_PI * 16,
672  end_angle * 180 / M_PI * 16);
673  painter.end();
674  }
675  }
676 
677  void GISCircleVisualizer::setAnonymous(bool anonymous)
678  {
680  if (!anonymous_) {
681  square_object_->setInnerRadius(size_ * 0.6);
682  }
683  else {
684  square_object_->setInnerRadius(0.0);
685 
686  }
687  square_object_->rebuildPolygon();
688  }
689 
691  {
693  square_object_->setOuterRadius(size_);
694  if (!anonymous_) {
695  square_object_->setInnerRadius(size_ * 0.6);
696  }
697  else {
698  square_object_->setInnerRadius(0.0);
699  }
700  square_object_->rebuildPolygon();
701  }
702 
703 
704 }
rviz::BillboardLine::clear
void clear()
parse_color.h
rviz::BillboardLine::getSceneNode
Ogre::SceneNode * getSceneNode()
rviz::BillboardLine
tf_diff_text.rot
rot
Definition: tf_diff_text.py:18
jsk_rviz_plugins::GISCircleVisualizer::GISCircleVisualizer
GISCircleVisualizer(Ogre::SceneManager *manager, Ogre::SceneNode *parent, double size, std::string text="")
Definition: facing_visualizer.cpp:640
jsk_rviz_plugins::SquareObject::name_
std::string name_
Definition: facing_visualizer.h:149
jsk_rviz_plugins::SimpleCircleFacingVisualizer::msg_
rviz::MovableText * msg_
Definition: facing_visualizer.h:226
rviz::BillboardLine::setLineWidth
void setLineWidth(float width)
jsk_rviz_plugins::SimpleCircleFacingVisualizer::upper_arrow_node_
Ogre::SceneNode * upper_arrow_node_
Definition: facing_visualizer.h:214
overlay_sample.line_width
line_width
Definition: overlay_sample.py:29
jsk_rviz_plugins::FacingTexturedObject::setSize
virtual void setSize(double size)
Definition: facing_visualizer.cpp:633
jsk_rviz_plugins::GISCircleVisualizer::anonymous_
bool anonymous_
Definition: facing_visualizer.h:271
jsk_rviz_plugins::SimpleCircleFacingVisualizer::upper_material_
Ogre::MaterialPtr upper_material_
Definition: facing_visualizer.h:218
jsk_rviz_plugins::SquareObject::setPolygonType
virtual void setPolygonType(PolygonType type)
Definition: facing_visualizer.cpp:186
bounding_box_sample.now
now
Definition: bounding_box_sample.py:20
jsk_rviz_plugins::SimpleCircleFacingVisualizer::createArrows
virtual void createArrows(rviz::DisplayContext *context)
Definition: facing_visualizer.cpp:475
jsk_rviz_plugins::SimpleCircleFacingVisualizer::updateText
virtual void updateText()
Definition: facing_visualizer.cpp:597
tf_diff_text.pos
pos
Definition: tf_diff_text.py:18
rviz::QtOgreRenderWindow::getCamera
Ogre::Camera * getCamera() const
jsk_rviz_plugins::TextureObject::name_
const std::string name_
Definition: facing_visualizer.h:141
jsk_rviz_plugins::SimpleCircleFacingVisualizer::lower_material_
Ogre::MaterialPtr lower_material_
Definition: facing_visualizer.h:219
jsk_rviz_plugins::FacingObject::setOrientation
virtual void setOrientation(rviz::DisplayContext *context)
Definition: facing_visualizer.cpp:263
jsk_rviz_plugins::SquareObject
Definition: facing_visualizer.h:89
jsk_rviz_plugins::ScopedPixelBuffer
Definition: overlay_utils.h:101
p
p
jsk_rviz_plugins::SquareObject::~SquareObject
virtual ~SquareObject()
Definition: facing_visualizer.cpp:92
jsk_rviz_plugins::SquareObject::setOuterRadius
virtual void setOuterRadius(double outer_radius)
Definition: facing_visualizer.cpp:103
bounding_box_sample.z
z
Definition: bounding_box_sample.py:32
jsk_rviz_plugins::FacingObject::size_
double size_
Definition: facing_visualizer.h:174
jsk_rviz_plugins::SquareObject::manual_
Ogre::ManualObject * manual_
Definition: facing_visualizer.h:145
jsk_rviz_plugins::SquareObject::inner_radius_
double inner_radius_
Definition: facing_visualizer.h:148
counter
int counter
rviz::MovableText::setCaption
void setCaption(const Ogre::String &caption)
name_
std::string name_
overlay_sample.theta
int theta
Definition: overlay_sample.py:22
TimeBase< WallTime, WallDuration >::toSec
double toSec() const
jsk_rviz_plugins::SimpleCircleFacingVisualizer::upper_material_name_
std::string upper_material_name_
Definition: facing_visualizer.h:222
jsk_rviz_plugins::FacingTexturedObject::square_object_
SquareObject::Ptr square_object_
Definition: facing_visualizer.h:245
jsk_rviz_plugins::FacingObject::setPosition
virtual void setPosition(Ogre::Vector3 &pos)
Definition: facing_visualizer.cpp:258
jsk_rviz_plugins::TextureObject::material_
Ogre::MaterialPtr material_
Definition: facing_visualizer.h:138
jsk_rviz_plugins::SimpleCircleFacingVisualizer::SimpleCircleFacingVisualizer
SimpleCircleFacingVisualizer(Ogre::SceneManager *manager, Ogre::SceneNode *parent, rviz::DisplayContext *context, double size, std::string text="")
Definition: facing_visualizer.cpp:315
jsk_rviz_plugins::SimpleCircleFacingVisualizer::updateLine
virtual void updateLine()
Definition: facing_visualizer.cpp:535
rviz::MovableText::setCharacterHeight
void setCharacterHeight(Ogre::Real height)
anonymous
anonymous
rviz::UniformStringStream
jsk_rviz_plugins::GISCircleVisualizer::update
virtual void update(float wall_dt, float ros_dt)
Definition: facing_visualizer.cpp:649
jsk_rviz_plugins::SimpleCircleFacingVisualizer::text_under_line_
rviz::BillboardLine * text_under_line_
Definition: facing_visualizer.h:209
jsk_rviz_plugins::SquareObject::CIRCLE
@ CIRCLE
Definition: facing_visualizer.h:135
rviz::BillboardLine::setMaxPointsPerLine
void setMaxPointsPerLine(uint32_t max)
rviz::MovableText
rviz::DisplayContext::getSceneManager
virtual Ogre::SceneManager * getSceneManager() const=0
jsk_rviz_plugins::FacingTexturedObject
Definition: facing_visualizer.h:232
jsk_rviz_plugins::FacingObject::enable_
bool enable_
Definition: facing_visualizer.h:175
rviz::DisplayContext::getViewManager
virtual ViewManager * getViewManager() const=0
overlay_sample.text
text
Definition: overlay_sample.py:21
jsk_rviz_plugins::SquareObject::SquareObject
SquareObject(Ogre::SceneManager *manager, double outer_radius, double inner_radius, std::string name)
Definition: facing_visualizer.cpp:81
jsk_rviz_plugins::SquareObject::manager_
Ogre::SceneManager * manager_
Definition: facing_visualizer.h:146
jsk_rviz_plugins::SquareObject::outer_radius_
double outer_radius_
Definition: facing_visualizer.h:147
jsk_rviz_plugins::SimpleCircleFacingVisualizer::line_
rviz::BillboardLine * line_
Definition: facing_visualizer.h:208
jsk_rviz_plugins::SimpleCircleFacingVisualizer::updateArrowsObjects
virtual void updateArrowsObjects(Ogre::ColourValue color)
Definition: facing_visualizer.cpp:379
A
rviz::ViewManager::getRenderPanel
RenderPanel * getRenderPanel() const
jsk_rviz_plugins::FacingObject::FacingObject
FacingObject(Ogre::SceneManager *manager, Ogre::SceneNode *parent, double size)
Definition: facing_visualizer.cpp:244
overlay_sample.font
font
Definition: overlay_sample.py:30
jsk_rviz_plugins::SimpleCircleFacingVisualizer::right_material_name_
std::string right_material_name_
Definition: facing_visualizer.h:225
jsk_rviz_plugins::GISCircleVisualizer::setAnonymous
virtual void setAnonymous(bool anonymous)
Definition: facing_visualizer.cpp:709
render_panel.h
jsk_rviz_plugins::FacingObject::setText
virtual void setText(std::string text)
Definition: facing_visualizer.cpp:288
jsk_rviz_plugins::SimpleCircleFacingVisualizer::left_material_
Ogre::MaterialPtr left_material_
Definition: facing_visualizer.h:220
bounding_box_sample.q
q
Definition: bounding_box_sample.py:29
ros::WallTime::now
static WallTime now()
jsk_rviz_plugins::FacingObject::scene_manager_
Ogre::SceneManager * scene_manager_
Definition: facing_visualizer.h:171
bounding_box_sample.x
x
Definition: bounding_box_sample.py:30
jsk_rviz_plugins::SimpleCircleFacingVisualizer::left_arrow_
Ogre::ManualObject * left_arrow_
Definition: facing_visualizer.h:212
jsk_rviz_plugins::SimpleCircleFacingVisualizer::right_arrow_node_
Ogre::SceneNode * right_arrow_node_
Definition: facing_visualizer.h:217
bounding_box_sample.r
r
Definition: bounding_box_sample.py:10
jsk_rviz_plugins::TextureObject::TextureObject
TextureObject(const int width, const int height, const std::string name)
Definition: facing_visualizer.cpp:191
jsk_rviz_plugins::SquareObject::setInnerRadius
virtual void setInnerRadius(double inner_radius)
Definition: facing_visualizer.cpp:108
rviz::BillboardLine::setNumLines
void setNumLines(uint32_t num)
contact_state_marker.alpha
alpha
Definition: contact_state_marker.py:90
jsk_rviz_plugins::SimpleCircleFacingVisualizer::update
virtual void update(float wall_dt, float ros_dt)
Definition: facing_visualizer.cpp:361
rviz::DisplayContext
jsk_rviz_plugins::TextureObject::texture_
Ogre::TexturePtr texture_
Definition: facing_visualizer.h:137
ros::WallTime
jsk_rviz_plugins::GISCircleVisualizer::setSize
virtual void setSize(double size)
Definition: facing_visualizer.cpp:722
bounding_box_sample.y
y
Definition: bounding_box_sample.py:31
jsk_rviz_plugins::SquareObject::polygon_type_
PolygonType polygon_type_
Definition: facing_visualizer.h:150
width
width
rviz::ViewManager
jsk_rviz_plugins::FacingObject::updateText
virtual void updateText()=0
jsk_rviz_plugins::FacingObject::node_
Ogre::SceneNode * node_
Definition: facing_visualizer.h:172
jsk_rviz_plugins::SimpleCircleFacingVisualizer::left_arrow_node_
Ogre::SceneNode * left_arrow_node_
Definition: facing_visualizer.h:216
jsk_rviz_plugins::arrow_animation_duration
const float arrow_animation_duration
Definition: facing_visualizer.cpp:79
jsk_rviz_plugins::TextureObject::getBuffer
virtual ScopedPixelBuffer getBuffer()
Definition: facing_visualizer.cpp:234
jsk_rviz_plugins::FacingObject
Definition: facing_visualizer.h:146
jsk_rviz_plugins::FacingTexturedObject::FacingTexturedObject
FacingTexturedObject(Ogre::SceneManager *manager, Ogre::SceneNode *parent, double size)
Definition: facing_visualizer.cpp:618
view_manager.h
jsk_rviz_plugins::FacingObject::setSize
virtual void setSize(double size)
Definition: facing_visualizer.cpp:277
jsk_rviz_plugins::TextureObject::~TextureObject
virtual ~TextureObject()
Definition: facing_visualizer.cpp:228
jsk_rviz_plugins::SimpleCircleFacingVisualizer::lower_arrow_node_
Ogre::SceneNode * lower_arrow_node_
Definition: facing_visualizer.h:215
jsk_rviz_plugins::SimpleCircleFacingVisualizer::right_arrow_
Ogre::ManualObject * right_arrow_
Definition: facing_visualizer.h:213
jsk_rviz_plugins::SquareObject::rebuildPolygon
virtual void rebuildPolygon()
Definition: facing_visualizer.cpp:113
f
f
jsk_rviz_plugins::FacingObject::setEnable
virtual void setEnable(bool enable)
Definition: facing_visualizer.cpp:282
jsk_rviz_plugins::SimpleCircleFacingVisualizer::setEnable
virtual void setEnable(bool enable)
Definition: facing_visualizer.cpp:589
jsk_rviz_plugins::SimpleCircleFacingVisualizer::right_material_
Ogre::MaterialPtr right_material_
Definition: facing_visualizer.h:221
jsk_rviz_plugins::SimpleCircleFacingVisualizer::setSize
virtual void setSize(double size)
Definition: facing_visualizer.cpp:581
jsk_rviz_plugins::SquareObject::SQUARE
@ SQUARE
Definition: facing_visualizer.h:135
sparse_occupancy_grid_sample.resolution
resolution
Definition: sparse_occupancy_grid_sample.py:28
facing_visualizer.h
point_test.count
int count
Definition: point_test.py:15
rviz::ogreToQt
QColor ogreToQt(const Ogre::ColourValue &c)
rviz::MovableText::GetAABB
Ogre::AxisAlignedBox GetAABB()
jsk_rviz_plugins::ScopedPixelBuffer::getQImage
virtual QImage getQImage(unsigned int width, unsigned int height)
Definition: overlay_utils.cpp:89
jsk_rviz_plugins::FacingObject::color_
Ogre::ColourValue color_
Definition: facing_visualizer.h:173
jsk_rviz_plugins::FacingObject::setColor
virtual void setColor(QColor color)
Definition: facing_visualizer.cpp:301
jsk_rviz_plugins::GISCircleVisualizer::text_
std::string text_
Definition: facing_visualizer.h:272
jsk_rviz_plugins::SimpleCircleFacingVisualizer::target_text_node_
Ogre::SceneNode * target_text_node_
Definition: facing_visualizer.h:227
rviz::RenderPanel
jsk_rviz_plugins::SimpleCircleFacingVisualizer::reset
virtual void reset()
Definition: facing_visualizer.cpp:372
jsk_rviz_plugins::SimpleCircleFacingVisualizer::lower_arrow_
Ogre::ManualObject * lower_arrow_
Definition: facing_visualizer.h:211
height
height
jsk_rviz_plugins::SimpleCircleFacingVisualizer::~SimpleCircleFacingVisualizer
virtual ~SimpleCircleFacingVisualizer()
Definition: facing_visualizer.cpp:342
jsk_rviz_plugins::FacingTexturedObject::texture_object_
TextureObject::Ptr texture_object_
Definition: facing_visualizer.h:246
rviz::MovableText::setColor
void setColor(const Ogre::ColourValue &color)
jsk_rviz_plugins::TextureObject::getMaterialName
virtual std::string getMaterialName()
Definition: facing_visualizer.cpp:239
jsk_rviz_plugins::SimpleCircleFacingVisualizer::left_material_name_
std::string left_material_name_
Definition: facing_visualizer.h:223
jsk_rviz_plugins::minimum_font_size
const double minimum_font_size
Definition: facing_visualizer.cpp:78
jsk_rviz_plugins::SimpleCircleFacingVisualizer::setText
virtual void setText(std::string text)
Definition: facing_visualizer.cpp:603
jsk_rviz_plugins::TextureObject
Definition: facing_visualizer.h:122
jsk_rviz_plugins::SimpleCircleFacingVisualizer::updateTextUnderLine
virtual void updateTextUnderLine()
Definition: facing_visualizer.cpp:556
pictogram.size
size
Definition: pictogram.py:1713
jsk_rviz_plugins::FacingObject::text_
std::string text_
Definition: facing_visualizer.h:176
jsk_rviz_plugins::FacingObject::setAlpha
virtual void setAlpha(double alpha)
Definition: facing_visualizer.cpp:295
jsk_rviz_plugins
Definition: __init__.py:1
jsk_rviz_plugins::SquareObject::getManualObject
virtual Ogre::ManualObject * getManualObject()
Definition: facing_visualizer.cpp:98
rviz::MovableText::H_LEFT
H_LEFT
jsk_rviz_plugins::FacingObject::updateColor
virtual void updateColor()=0
jsk_rviz_plugins::SimpleCircleFacingVisualizer::updateColor
virtual void updateColor()
Definition: facing_visualizer.cpp:610
rviz::MovableText::V_ABOVE
V_ABOVE
rviz::BillboardLine::setColor
void setColor(float r, float g, float b, float a) override
jsk_rviz_plugins::SimpleCircleFacingVisualizer::lower_material_name_
std::string lower_material_name_
Definition: facing_visualizer.h:224
jsk_rviz_plugins::FacingObject::~FacingObject
virtual ~FacingObject()
Definition: facing_visualizer.cpp:252
jsk_rviz_plugins::SimpleCircleFacingVisualizer::upper_arrow_
Ogre::ManualObject * upper_arrow_
Definition: facing_visualizer.h:210
uniform_string_stream.h
rviz::BillboardLine::addPoint
void addPoint(const Ogre::Vector3 &point)


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Fri Dec 13 2024 03:49:56