robot.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, Willow Garage, Inc.
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
9  * notice, 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 the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific 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 #include "robot.h"
31 #include "robot_link.h"
32 #include "robot_joint.h"
33 #include "properties/property.h"
36 #include "display_context.h"
37 
38 #include "ogre_helpers/object.h"
39 #include "ogre_helpers/shape.h"
40 #include "ogre_helpers/axes.h"
41 
42 #include <urdf_model/model.h>
43 
44 #include <OgreSceneNode.h>
45 #include <OgreSceneManager.h>
46 #include <OgreEntity.h>
47 #include <OgreMaterialManager.h>
48 #include <OgreMaterial.h>
49 #include <OgreResourceGroupManager.h>
50 
51 #include <ros/console.h>
52 #include <ros/assert.h>
53 
54 namespace rviz
55 {
56 Robot::Robot(Ogre::SceneNode* root_node,
57  DisplayContext* context,
58  const std::string& name,
59  Property* parent_property)
60  : scene_manager_(context->getSceneManager())
61  , visible_(true)
62  , visual_visible_(true)
63  , collision_visible_(false)
64  , context_(context)
65  , doing_set_checkbox_(false)
66  , robot_loaded_(false)
67  , inChangedEnableAllLinks(false)
68  , name_(name)
69 {
70  root_visual_node_ = root_node->createChildSceneNode();
71  root_collision_node_ = root_node->createChildSceneNode();
72  root_other_node_ = root_node->createChildSceneNode();
73 
74  link_factory_ = new LinkFactory();
75 
78  setAlpha(1.0f);
79 
80  link_tree_ = new Property("Links", QVariant(), "", parent_property);
81  link_tree_->hide(); // hide until loaded
82 
83  link_tree_style_ = new EnumProperty("Link Tree Style", "", "How the list of links is displayed",
84  link_tree_, SLOT(changedLinkTreeStyle()), this);
86  expand_tree_ = new BoolProperty("Expand Tree", false, "Expand or collapse link tree", link_tree_,
87  SLOT(changedExpandTree()), this);
89  new BoolProperty("Expand Link Details", false,
90  "Expand link details (sub properties) to see all info for all links.", link_tree_,
91  SLOT(changedExpandLinkDetails()), this);
93  new BoolProperty("Expand Joint Details", false,
94  "Expand joint details (sub properties) to see all info for all joints.",
95  link_tree_, SLOT(changedExpandJointDetails()), this);
96  enable_all_links_ = new BoolProperty("All Links Enabled", true, "Turn all links on or off.",
97  link_tree_, SLOT(changedEnableAllLinks()), this);
98 }
99 
101 {
102  clear();
103 
104  scene_manager_->destroySceneNode(root_visual_node_->getName());
105  scene_manager_->destroySceneNode(root_collision_node_->getName());
106  scene_manager_->destroySceneNode(root_other_node_->getName());
107  delete link_factory_;
108  delete link_tree_;
109 }
110 
112 {
113  if (link_factory)
114  {
115  delete link_factory_;
116  link_factory_ = link_factory;
117  }
118 }
119 
120 void Robot::setVisible(bool visible)
121 {
122  visible_ = visible;
123  if (visible)
124  {
125  root_visual_node_->setVisible(visual_visible_);
128  }
129  else
130  {
131  root_visual_node_->setVisible(false);
132  root_collision_node_->setVisible(false);
134  }
135 }
136 
137 void Robot::setVisualVisible(bool visible)
138 {
139  visual_visible_ = visible;
141 }
142 
143 void Robot::setCollisionVisible(bool visible)
144 {
145  collision_visible_ = visible;
147 }
148 
150 {
151  M_NameToLink::iterator it = links_.begin();
152  M_NameToLink::iterator end = links_.end();
153  for (; it != end; ++it)
154  {
155  RobotLink* link = it->second;
156  link->updateVisibility();
157  }
158 }
159 
161 {
162  return visible_;
163 }
164 
166 {
167  return visual_visible_;
168 }
169 
171 {
172  return collision_visible_;
173 }
174 
175 void Robot::setAlpha(float a)
176 {
177  alpha_ = a;
178 
179  M_NameToLink::iterator it = links_.begin();
180  M_NameToLink::iterator end = links_.end();
181  for (; it != end; ++it)
182  {
183  RobotLink* link = it->second;
184 
185  link->setRobotAlpha(alpha_);
186  }
187 }
188 
190 {
191  // unparent all link and joint properties so they can be deleted in arbitrary
192  // order without being delete by their parent propeties (which vary based on
193  // style)
195 
196  M_NameToLink::iterator link_it = links_.begin();
197  M_NameToLink::iterator link_end = links_.end();
198  for (; link_it != link_end; ++link_it)
199  {
200  RobotLink* link = link_it->second;
201  delete link;
202  }
203 
204  M_NameToJoint::iterator joint_it = joints_.begin();
205  M_NameToJoint::iterator joint_end = joints_.end();
206  for (; joint_it != joint_end; ++joint_it)
207  {
208  RobotJoint* joint = joint_it->second;
209  delete joint;
210  }
211 
212  links_.clear();
213  joints_.clear();
214  root_visual_node_->removeAndDestroyAllChildren();
215  root_collision_node_->removeAndDestroyAllChildren();
216  root_other_node_->removeAndDestroyAllChildren();
217 }
218 
220  const urdf::LinkConstSharedPtr& link,
221  const std::string& parent_joint_name,
222  bool visual,
223  bool collision)
224 {
225  return new RobotLink(robot, link, parent_joint_name, visual, collision);
226 }
227 
228 RobotJoint* Robot::LinkFactory::createJoint(Robot* robot, const urdf::JointConstSharedPtr& joint)
229 {
230  return new RobotJoint(robot, joint);
231 }
232 
233 void Robot::load(const urdf::ModelInterface& urdf, bool visual, bool collision)
234 {
235  link_tree_->hide(); // hide until loaded
236  robot_loaded_ = false;
237 
238  // clear out any data (properties, shapes, etc) from a previously loaded robot.
239  clear();
240 
241  // the root link is discovered below. Set to NULL until found.
242  root_link_ = nullptr;
243 
244  // Create properties for each link.
245  // Properties are not added to display until changedLinkTreeStyle() is called (below).
246  {
247  typedef std::map<std::string, urdf::LinkSharedPtr> M_NameToUrdfLink;
248  M_NameToUrdfLink::const_iterator link_it = urdf.links_.begin();
249  M_NameToUrdfLink::const_iterator link_end = urdf.links_.end();
250  for (; link_it != link_end; ++link_it)
251  {
252  const urdf::LinkConstSharedPtr& urdf_link = link_it->second;
253  std::string parent_joint_name;
254 
255  if (urdf_link != urdf.getRoot() && urdf_link->parent_joint)
256  {
257  parent_joint_name = urdf_link->parent_joint->name;
258  }
259 
260  RobotLink* link = link_factory_->createLink(this, urdf_link, parent_joint_name, visual, collision);
261 
262  if (urdf_link == urdf.getRoot())
263  {
264  root_link_ = link;
265  }
266 
267  links_[urdf_link->name] = link;
268 
269  link->setRobotAlpha(alpha_);
270  }
271  }
272 
273  // Create properties for each joint.
274  // Properties are not added to display until changedLinkTreeStyle() is called (below).
275  {
276  typedef std::map<std::string, urdf::JointSharedPtr> M_NameToUrdfJoint;
277  M_NameToUrdfJoint::const_iterator joint_it = urdf.joints_.begin();
278  M_NameToUrdfJoint::const_iterator joint_end = urdf.joints_.end();
279  for (; joint_it != joint_end; ++joint_it)
280  {
281  const urdf::JointConstSharedPtr& urdf_joint = joint_it->second;
282  RobotJoint* joint = link_factory_->createJoint(this, urdf_joint);
283 
284  joints_[urdf_joint->name] = joint;
285 
286  joint->setRobotAlpha(alpha_);
287  }
288  }
289 
290  // robot is now loaded
291  robot_loaded_ = true;
292  link_tree_->show();
293 
294  // set the link tree style and add link/joint properties to rviz pane.
297 
298  // at startup the link tree is collapsed since it is large and not often needed.
299  link_tree_->collapse();
300 
303 }
304 
306 {
307  // remove link properties from their parents
308  M_NameToLink::iterator link_it = links_.begin();
309  M_NameToLink::iterator link_end = links_.end();
310  for (; link_it != link_end; ++link_it)
311  {
312  link_it->second->setParentProperty(nullptr);
313  }
314 
315  // remove joint properties from their parents
316  M_NameToJoint::iterator joint_it = joints_.begin();
317  M_NameToJoint::iterator joint_end = joints_.end();
318  for (; joint_it != joint_end; ++joint_it)
319  {
320  joint_it->second->setParentProperty(nullptr);
321  }
322 }
323 
324 void Robot::useDetailProperty(bool use_detail)
325 {
326  // remove sub properties and add them to detail
327  M_NameToLink::iterator link_it = links_.begin();
328  M_NameToLink::iterator link_end = links_.end();
329  for (; link_it != link_end; ++link_it)
330  {
331  link_it->second->useDetailProperty(use_detail);
332  }
333 
334  // remove joint properties from their parents
335  M_NameToJoint::iterator joint_it = joints_.begin();
336  M_NameToJoint::iterator joint_end = joints_.end();
337  for (; joint_it != joint_end; ++joint_it)
338  {
339  joint_it->second->useDetailProperty(use_detail);
340  }
341 }
342 
344 {
345  bool expand = expand_tree_->getBool();
346 
347  M_NameToLink::iterator link_it = links_.begin();
348  M_NameToLink::iterator link_end = links_.end();
349  for (; link_it != link_end; ++link_it)
350  {
351  if (expand)
352  link_it->second->getLinkProperty()->expand();
353  else
354  link_it->second->getLinkProperty()->collapse();
355  }
356 
357  M_NameToJoint::iterator joint_it = joints_.begin();
358  M_NameToJoint::iterator joint_end = joints_.end();
359  for (; joint_it != joint_end; ++joint_it)
360  {
361  if (expand)
362  joint_it->second->getJointProperty()->expand();
363  else
364  joint_it->second->getJointProperty()->collapse();
365  }
366 }
367 
369 {
370  bool hide = /* !show_details_->getBool(); */ false;
371 
372  M_NameToLink::iterator link_it = links_.begin();
373  M_NameToLink::iterator link_end = links_.end();
374  for (; link_it != link_end; ++link_it)
375  {
376  link_it->second->hideSubProperties(hide);
377  }
378 
379  M_NameToJoint::iterator joint_it = joints_.begin();
380  M_NameToJoint::iterator joint_end = joints_.end();
381  for (; joint_it != joint_end; ++joint_it)
382  {
383  joint_it->second->hideSubProperties(hide);
384  }
385 }
386 
388 {
389  bool expand = expand_link_details_->getBool();
390 
391  M_NameToLink::iterator link_it = links_.begin();
392  M_NameToLink::iterator link_end = links_.end();
393  for (; link_it != link_end; ++link_it)
394  {
395  link_it->second->expandDetails(expand);
396  }
397 }
398 
400 {
401  bool expand = expand_joint_details_->getBool();
402 
403  M_NameToJoint::iterator joint_it = joints_.begin();
404  M_NameToJoint::iterator joint_end = joints_.end();
405  for (; joint_it != joint_end; ++joint_it)
406  {
407  joint_it->second->expandDetails(expand);
408  }
409 }
410 
412 {
414  return;
415 
416  bool enable = enable_all_links_->getBool();
417 
419 
420  M_NameToLink::iterator link_it = links_.begin();
421  M_NameToLink::iterator link_end = links_.end();
422  for (; link_it != link_end; ++link_it)
423  {
424  if (link_it->second->hasGeometry())
425  {
426  link_it->second->getLinkProperty()->setValue(enable);
427  }
428  }
429 
430  M_NameToJoint::iterator joint_it = joints_.begin();
431  M_NameToJoint::iterator joint_end = joints_.end();
432  for (; joint_it != joint_end; ++joint_it)
433  {
434  if (joint_it->second->hasDescendentLinksWithGeometry())
435  {
436  joint_it->second->getJointProperty()->setValue(enable);
437  }
438  }
439 
440  inChangedEnableAllLinks = false;
441 }
442 
444 {
445  // doing_set_checkbox_ prevents changedEnableAllLinks from turning all
446  // links off when we modify the enable_all_links_ property.
447  doing_set_checkbox_ = true;
449  doing_set_checkbox_ = false;
450 }
451 
453 {
454  style_name_map_.clear();
455  style_name_map_[STYLE_LINK_LIST] = "Links in Alphabetic Order";
456  style_name_map_[STYLE_JOINT_LIST] = "Joints in Alphabetic Order";
457  style_name_map_[STYLE_LINK_TREE] = "Tree of links";
458  style_name_map_[STYLE_JOINT_LINK_TREE] = "Tree of links and joints";
459 
461  std::map<LinkTreeStyle, std::string>::const_iterator style_it = style_name_map_.begin();
462  std::map<LinkTreeStyle, std::string>::const_iterator style_end = style_name_map_.end();
463  for (; style_it != style_end; ++style_it)
464  {
465  link_tree_style_->addOptionStd(style_it->second, style_it->first);
466  }
467 }
468 
470 {
471  return style == STYLE_LINK_LIST || style == STYLE_LINK_TREE || style == STYLE_JOINT_LINK_TREE;
472 }
473 
475 {
476  return style == STYLE_JOINT_LIST || style == STYLE_JOINT_LINK_TREE;
477 }
478 
480 {
481  return style == STYLE_LINK_TREE || style == STYLE_JOINT_LINK_TREE;
482 }
483 
485 {
486  std::map<LinkTreeStyle, std::string>::const_iterator style_it = style_name_map_.find(style);
487  if (style_it == style_name_map_.end())
489  else
490  link_tree_style_->setValue(style_it->second.c_str());
491 }
492 
493 // insert properties into link_tree_ according to style
495 {
496  if (!robot_loaded_)
497  return;
498 
500 
502 
503  // expand_tree_->setValue(false);
504 
505  switch (style)
506  {
507  case STYLE_LINK_TREE:
509  useDetailProperty(true);
510  if (root_link_)
511  {
513  }
514  break;
515 
516  case STYLE_JOINT_LIST:
517  {
518  useDetailProperty(false);
519  M_NameToJoint::iterator joint_it = joints_.begin();
520  M_NameToJoint::iterator joint_end = joints_.end();
521  for (; joint_it != joint_end; ++joint_it)
522  {
523  joint_it->second->setParentProperty(link_tree_);
524  joint_it->second->setJointPropertyDescription();
525  }
526  break;
527  }
528 
529  case STYLE_LINK_LIST:
530  default:
531  useDetailProperty(false);
532  M_NameToLink::iterator link_it = links_.begin();
533  M_NameToLink::iterator link_end = links_.end();
534  for (; link_it != link_end; ++link_it)
535  {
536  link_it->second->setParentProperty(link_tree_);
537  }
538  break;
539  }
540 
541  switch (style)
542  {
543  case STYLE_LINK_TREE:
544  link_tree_->setName("Link Tree");
546  "A tree of all links in the robot. Uncheck a link to hide its geometry.");
547  expand_tree_->show();
550  break;
552  link_tree_->setName("Link/Joint Tree");
554  "A tree of all joints and links in the robot. Uncheck a link to hide its geometry.");
555  expand_tree_->show();
558  break;
559  case STYLE_JOINT_LIST:
560  link_tree_->setName("Joints");
561  link_tree_->setDescription("All joints in the robot in alphabetic order.");
562  expand_tree_->hide();
565  break;
566  case STYLE_LINK_LIST:
567  default:
568  link_tree_->setName("Links");
570  "All links in the robot in alphabetic order. Uncheck a link to hide its geometry.");
571  expand_tree_->hide();
574  break;
575  }
576 
579  expand_tree_->setValue(false);
581 }
582 
583 
584 // recursive helper for setLinkTreeStyle() when style is *_TREE
586 {
587  if (styleShowLink(style))
588  {
589  link->setParentProperty(parent);
590  parent = link->getLinkProperty();
591  }
592 
593  std::vector<std::string>::const_iterator child_joint_it = link->getChildJointNames().begin();
594  std::vector<std::string>::const_iterator child_joint_end = link->getChildJointNames().end();
595  for (; child_joint_it != child_joint_end; ++child_joint_it)
596  {
597  RobotJoint* child_joint = getJoint(*child_joint_it);
598  if (child_joint)
599  {
600  addJointToLinkTree(style, parent, child_joint);
601  }
602  }
603 }
604 
605 // recursive helper for setLinkTreeStyle() when style is *_TREE
607 {
608  if (styleShowJoint(style))
609  {
610  joint->setParentProperty(parent);
611  parent = joint->getJointProperty();
613  }
614 
615  RobotLink* link = getLink(joint->getChildLinkName());
616  if (link)
617  {
618  addLinkToLinkTree(style, parent, link);
619  }
620 }
621 
622 RobotLink* Robot::getLink(const std::string& name)
623 {
624  M_NameToLink::iterator it = links_.find(name);
625  if (it == links_.end())
626  {
627  ROS_WARN("Link [%s] does not exist", name.c_str());
628  return nullptr;
629  }
630 
631  return it->second;
632 }
633 
634 RobotJoint* Robot::getJoint(const std::string& name)
635 {
636  M_NameToJoint::iterator it = joints_.find(name);
637  if (it == joints_.end())
638  {
639  ROS_WARN("Joint [%s] does not exist", name.c_str());
640  return nullptr;
641  }
642 
643  return it->second;
644 }
645 
647 {
649  return;
650 
651  int links_with_geom_checked = 0;
652  int links_with_geom_unchecked = 0;
653 
654  // check root link
655  RobotLink* link = root_link_;
656 
657  if (!link)
658  {
659  setEnableAllLinksCheckbox(QVariant());
660  return;
661  }
662 
663  if (link->hasGeometry())
664  {
665  bool checked = link->getLinkProperty()->getValue().toBool();
666  links_with_geom_checked += checked ? 1 : 0;
667  links_with_geom_unchecked += checked ? 0 : 1;
668  }
669  int links_with_geom = links_with_geom_checked + links_with_geom_unchecked;
670 
671  // check all child links and joints recursively
672  std::vector<std::string>::const_iterator child_joint_it = link->getChildJointNames().begin();
673  std::vector<std::string>::const_iterator child_joint_end = link->getChildJointNames().end();
674  for (; child_joint_it != child_joint_end; ++child_joint_it)
675  {
676  RobotJoint* child_joint = getJoint(*child_joint_it);
677  if (child_joint)
678  {
679  int child_links_with_geom;
680  int child_links_with_geom_checked;
681  int child_links_with_geom_unchecked;
683  child_links_with_geom, child_links_with_geom_checked, child_links_with_geom_unchecked);
684  links_with_geom_checked += child_links_with_geom_checked;
685  links_with_geom_unchecked += child_links_with_geom_unchecked;
686  }
687  }
688  links_with_geom = links_with_geom_checked + links_with_geom_unchecked;
689 
690  if (!links_with_geom)
691  {
692  setEnableAllLinksCheckbox(QVariant());
693  }
694  else
695  {
696  setEnableAllLinksCheckbox(links_with_geom_unchecked == 0);
697  }
698 }
699 
700 void Robot::update(const LinkUpdater& updater)
701 {
702  M_NameToLink::iterator link_it = links_.begin();
703  M_NameToLink::iterator link_end = links_.end();
704  for (; link_it != link_end; ++link_it)
705  {
706  RobotLink* link = link_it->second;
707 
708  Ogre::Vector3 visual_position, collision_position;
709  Ogre::Quaternion visual_orientation, collision_orientation;
710  if (updater.getLinkTransforms(link->getName(), visual_position, visual_orientation,
711  collision_position, collision_orientation))
712  {
713  link->setToNormalMaterial();
714 
715  // Check if visual_orientation, visual_position, collision_orientation, and collision_position are
716  // NaN.
717  if (visual_orientation.isNaN())
718  {
719  ROS_ERROR_THROTTLE(1.0,
720  "visual orientation of %s contains NaNs. "
721  "Skipping render as long as the orientation is invalid.",
722  link->getName().c_str());
723  continue;
724  }
725  if (visual_position.isNaN())
726  {
728  1.0,
729  "visual position of %s contains NaNs. Skipping render as long as the position is invalid.",
730  link->getName().c_str());
731  continue;
732  }
733  if (collision_orientation.isNaN())
734  {
735  ROS_ERROR_THROTTLE(1.0,
736  "collision orientation of %s contains NaNs. "
737  "Skipping render as long as the orientation is invalid.",
738  link->getName().c_str());
739  continue;
740  }
741  if (collision_position.isNaN())
742  {
743  ROS_ERROR_THROTTLE(1.0,
744  "collision position of %s contains NaNs. "
745  "Skipping render as long as the position is invalid.",
746  link->getName().c_str());
747  continue;
748  }
749  link->setTransforms(visual_position, visual_orientation, collision_position, collision_orientation);
750 
751  std::vector<std::string>::const_iterator joint_it = link->getChildJointNames().begin();
752  std::vector<std::string>::const_iterator joint_end = link->getChildJointNames().end();
753  for (; joint_it != joint_end; ++joint_it)
754  {
755  RobotJoint* joint = getJoint(*joint_it);
756  if (joint)
757  {
758  joint->setTransforms(visual_position, visual_orientation);
759  }
760  }
761  }
762  else
763  {
764  link->setToErrorMaterial();
765  }
766  }
767 }
768 
769 void Robot::setPosition(const Ogre::Vector3& position)
770 {
771  root_visual_node_->setPosition(position);
772  root_collision_node_->setPosition(position);
773 }
774 
775 void Robot::setOrientation(const Ogre::Quaternion& orientation)
776 {
777  root_visual_node_->setOrientation(orientation);
778  root_collision_node_->setOrientation(orientation);
779 }
780 
781 void Robot::setScale(const Ogre::Vector3& scale)
782 {
783  root_visual_node_->setScale(scale);
784  root_collision_node_->setScale(scale);
785 }
786 
787 const Ogre::Vector3& Robot::getPosition()
788 {
789  return root_visual_node_->getPosition();
790 }
791 
792 const Ogre::Quaternion& Robot::getOrientation()
793 {
794  return root_visual_node_->getOrientation();
795 }
796 
797 } // namespace rviz
virtual void update(const LinkUpdater &updater)
Definition: robot.cpp:700
void setParentProperty(Property *new_parent)
Robot(Ogre::SceneNode *root_node, DisplayContext *context, const std::string &name, Property *parent_property)
Definition: robot.cpp:56
void setEnableAllLinksCheckbox(QVariant val)
Definition: robot.cpp:443
const Property * getJointProperty() const
Definition: robot_joint.h:107
float alpha_
Definition: robot.h:311
void addLinkToLinkTree(LinkTreeStyle style, Property *parent, RobotLink *link)
Definition: robot.cpp:585
void setJointPropertyDescription()
M_NameToJoint joints_
Map of name to joint info, stores all loaded joints.
Definition: robot.h:281
void setRobotAlpha(float)
Definition: robot_joint.h:125
virtual void clear()
Clears all data loaded from a URDF.
Definition: robot.cpp:189
void setAlpha(float a)
Definition: robot.cpp:175
f
LinkTreeStyle
Definition: robot.h:225
virtual bool setValue(const QVariant &new_value)
Set the new value for this property. Returns true if the new value is different from the old value...
Definition: property.cpp:134
void useDetailProperty(bool use_detail)
Definition: robot.cpp:324
A single element of a property tree, with a name, value, description, and possibly children...
Definition: property.h:100
void calculateJointCheckboxesRecursive(int &links_with_geom, int &links_with_geom_checked, int &links_with_geom_unchecked)
virtual void clearOptions()
Clear the list of options.
~Robot() override
Definition: robot.cpp:100
virtual void setName(const QString &name)
Set the name.
Definition: property.cpp:155
void changedLinkTreeStyle()
Definition: robot.cpp:494
BoolProperty * expand_joint_details_
Definition: robot.h:299
LinkFactory * link_factory_
factory for generating links and joints
Definition: robot.h:284
virtual void setPosition(const Ogre::Vector3 &position)
Definition: robot.cpp:769
virtual RobotLink * createLink(Robot *robot, const urdf::LinkConstSharedPtr &link, const std::string &parent_joint_name, bool visual, bool collision)
Definition: robot.cpp:219
void setTransforms(const Ogre::Vector3 &parent_link_position, const Ogre::Quaternion &parent_link_orientation)
virtual const Ogre::Vector3 & getPosition()
Definition: robot.cpp:787
#define ROS_WARN(...)
virtual void setDescription(const QString &description)
Set the description.
Definition: property.cpp:169
RobotLink * getLink(const std::string &name)
Definition: robot.cpp:622
bool isCollisionVisible()
Returns whether or not the collision representation is set to be visible To be visible this and isVis...
Definition: robot.cpp:170
void calculateJointCheckboxes()
Definition: robot.cpp:646
std::map< LinkTreeStyle, std::string > style_name_map_
Definition: robot.h:301
static bool styleShowJoint(LinkTreeStyle style)
Definition: robot.cpp:474
virtual void load(const urdf::ModelInterface &urdf, bool visual=true, bool collision=true)
Loads meshes/primitives from a robot description. Calls clear() before loading.
Definition: robot.cpp:233
virtual void collapse()
Collapse (hide the children of) this Property.
Definition: property.cpp:572
bool visual_visible_
Should we show the visual representation?
Definition: robot.h:291
virtual void setScale(const Ogre::Vector3 &scale)
Definition: robot.cpp:781
void setLinkFactory(LinkFactory *link_factory)
Definition: robot.cpp:111
void changedExpandLinkDetails()
Definition: robot.cpp:387
Pure-virtual base class for objects which give Display subclasses context in which to work...
RobotLink * root_link_
Definition: robot.h:282
const std::string & getChildLinkName() const
Definition: robot_joint.h:103
Ogre::SceneNode * root_visual_node_
Node all our visual nodes are children of.
Definition: robot.h:286
void setCollisionVisible(bool visible)
Set whether the collision meshes/primitives of the robot should be visible.
Definition: robot.cpp:143
void setLinkTreeStyle(LinkTreeStyle style)
Definition: robot.cpp:484
void show()
Show this Property in any PropertyTreeWidgets.
Definition: property.h:410
bool isVisible()
Returns whether anything is visible.
Definition: robot.cpp:160
#define ROS_ERROR_THROTTLE(period,...)
void updateLinkVisibilities()
Call RobotLink::updateVisibility() on each link.
Definition: robot.cpp:149
void changedExpandJointDetails()
Definition: robot.cpp:399
BoolProperty * enable_all_links_
Definition: robot.h:300
BoolProperty * expand_tree_
Definition: robot.h:297
virtual bool getLinkTransforms(const std::string &link_name, Ogre::Vector3 &visual_position, Ogre::Quaternion &visual_orientation, Ogre::Vector3 &collision_position, Ogre::Quaternion &collision_orientation) const =0
void addJointToLinkTree(LinkTreeStyle style, Property *parent, RobotJoint *joint)
Definition: robot.cpp:606
void addOptionStd(const std::string &option, int value=0)
Definition: enum_property.h:62
Contains any data we need from a joint in the robot.
Definition: robot_joint.h:84
virtual void setOrientation(const Ogre::Quaternion &orientation)
Definition: robot.cpp:775
Ogre::SceneManager * scene_manager_
Definition: robot.h:278
bool visible_
Should we show anything at all? (affects visual, collision, axes, and trails)
Definition: robot.h:290
bool inChangedEnableAllLinks
Definition: robot.h:308
BoolProperty * expand_link_details_
Definition: robot.h:298
Property specialized to provide getter for booleans.
Definition: bool_property.h:38
static bool styleShowLink(LinkTreeStyle style)
Definition: robot.cpp:469
bool robot_loaded_
Definition: robot.h:304
void setVisualVisible(bool visible)
Set whether the visual meshes of the robot should be visible.
Definition: robot.cpp:137
void changedHideSubProperties()
Definition: robot.cpp:368
bool doing_set_checkbox_
Definition: robot.h:303
EnumProperty * link_tree_style_
Definition: robot.h:296
Ogre::SceneNode * root_other_node_
Definition: robot.h:288
virtual RobotJoint * createJoint(Robot *robot, const urdf::JointConstSharedPtr &joint)
Definition: robot.cpp:228
void hide()
Hide this Property in any PropertyTreeWidgets.
Definition: property.h:401
Property * link_tree_
Definition: robot.h:295
virtual QVariant getValue() const
Return the value of this Property as a QVariant. If the value has never been set, an invalid QVariant...
Definition: property.cpp:150
bool collision_visible_
Should we show the collision representation?
Definition: robot.h:292
Ogre::SceneNode * root_collision_node_
Node all our collision nodes are children of.
Definition: robot.h:287
virtual void setVisible(bool visible)
Set the robot as a whole to be visible or not.
Definition: robot.cpp:120
virtual bool getBool() const
virtual int getOptionInt()
Return the int value of the currently-chosen option, or 0 if the current option string does not have ...
virtual const Ogre::Quaternion & getOrientation()
Definition: robot.cpp:792
M_NameToLink links_
Map of name to link info, stores all loaded links.
Definition: robot.h:280
Enum property.
Definition: enum_property.h:46
bool isVisualVisible()
Returns whether or not the visual representation is set to be visible To be visible this and isVisibl...
Definition: robot.cpp:165
void changedEnableAllLinks()
Definition: robot.cpp:411
static bool styleIsTree(LinkTreeStyle style)
Definition: robot.cpp:479
void unparentLinkProperties()
Definition: robot.cpp:305
void changedExpandTree()
Definition: robot.cpp:343
void initLinkTreeStyle()
Definition: robot.cpp:452
RobotJoint * getJoint(const std::string &name)
Definition: robot.cpp:634


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Sat May 27 2023 02:06:25