40 #include <QApplication> 46 : robot_(root_node, context, name, parent_property)
50 , visual_visible_(true)
51 , collision_visible_(false)
69 QApplication::processEvents();
89 const std_msgs::ColorRGBA& default_attached_object_color)
95 const std_msgs::ColorRGBA& default_attached_object_color,
96 const std::map<std::string, std_msgs::ColorRGBA>& color_map)
98 updateHelper(kinematic_state, default_attached_object_color, &color_map);
102 const std_msgs::ColorRGBA& default_attached_object_color,
103 const std::map<std::string, std_msgs::ColorRGBA>* color_map)
108 std::vector<const robot_state::AttachedBody*> attached_bodies;
109 kinematic_state->getAttachedBodies(attached_bodies);
110 for (std::size_t i = 0; i < attached_bodies.size(); ++i)
112 std_msgs::ColorRGBA color = default_attached_object_color;
116 std::map<std::string, std_msgs::ColorRGBA>::const_iterator it = color_map->find(attached_bodies[i]->
getName());
117 if (it != color_map->end())
119 color.r = std::max(1.0
f, it->second.r * 1.05f);
120 color.g = std::max(1.0
f, it->second.g * 1.05f);
121 color.b = std::max(1.0
f, it->second.b * 1.05f);
122 alpha = color.a = it->second.a;
127 const std::vector<shapes::ShapeConstPtr>& ab_shapes = attached_bodies[i]->getShapes();
128 for (std::size_t j = 0; j < ab_shapes.size(); ++j)
virtual void update(const LinkUpdater &updater)
RenderShapesPtr render_shapes_
void setAlpha(float alpha)
void setDefaultAttachedObjectColor(const std_msgs::ColorRGBA &default_attached_object_color)
std::vector< Eigen::Affine3d, Eigen::aligned_allocator< Eigen::Affine3d > > vector_Affine3d
void setVisualVisible(bool visible)
Set whether the visual meshes of the robot should be visible.
void setCollisionVisible(bool visible)
Set whether the collision meshes/primitives of the robot should be visible.
void load(const urdf::ModelInterface &descr, bool visual=true, bool collision=true)
std::string getName(void *handle)
virtual void load(const urdf::ModelInterface &urdf, bool visual=true, bool collision=true)
Ogre::SceneNode * getCollisionNode()
OctreeVoxelRenderMode octree_voxel_render_mode_
std_msgs::ColorRGBA default_attached_object_color_
void setCollisionVisible(bool visible)
void setVisible(bool visible)
Set the robot as a whole to be visible or not.
Ogre::SceneNode * getVisualNode()
void update(const robot_state::RobotStateConstPtr &kinematic_state)
void updateHelper(const robot_state::RobotStateConstPtr &kinematic_state, const std_msgs::ColorRGBA &default_attached_object_color, const std::map< std::string, std_msgs::ColorRGBA > *color_map)
void setVisualVisible(bool visible)
RobotStateVisualization(Ogre::SceneNode *root_node, rviz::DisplayContext *context, const std::string &name, rviz::Property *parent_property)
virtual void setVisible(bool visible)
OctreeVoxelColorMode octree_voxel_color_mode_
Update the links of an rviz::Robot using a robot_state::RobotState.