MultiRobotInfoVisual.h
Go to the documentation of this file.
1 #ifndef MULTI_ROBOT_INFO_VISUAL_HPP
2 #define MULTI_ROBOT_INFO_VISUAL_HPP
3 
4 #include <rviz/tool.h>
5 #include <ros/ros.h>
13 #include <memory>
14 #include <vector>
15 #include <map>
16 #include <boost/circular_buffer.hpp>
17 #include "TextVisual.h"
18 
19 #include <tuw_multi_robot_msgs/RobotInfo.h>
20 #include <geometry_msgs/PoseWithCovariance.h>
21 
22 namespace tuw_multi_robot_rviz
23 {
24 
26 {
27 public:
28 
29  MultiRobotInfoVisual(Ogre::SceneManager *_scene_manager, Ogre::SceneNode *_parent_node);
30 
31  virtual ~MultiRobotInfoVisual();
32 
33  void setMessage(const tuw_multi_robot_msgs::RobotInfoConstPtr _msg);
34 
35  void setFramePosition( const Ogre::Vector3& _position);
36  void setFrameOrientation( const Ogre::Quaternion& orientation );
37 
38  // Set the scale of the visual, which is an user-editable
39  // parameter and therefore don't come from the RobotGoalsArrayStamped message.
40  void setScalePose( float scale );
41 
42  // Set the color of the visual's Pose, which is an user-editable
43  // parameter and therefore don't come from the RobotGoalsArrayStamped message.
44  void setColorPose( Ogre::ColourValue color );
45 
46  void disableRobot( const std::string &rName );
47 
48  void enableRobot( const std::string &rName );
49 
50  void resetDuration( const ros::Duration &ts);
51 
52  void resetKeepMeasurementsCount ( const unsigned int c );
53 
54  void doRender();
55 
56  std::vector<rviz::Object *> make_robot(Ogre::Vector3 &position, Ogre::Quaternion &orientation);
57 
58 private:
59  using internal_map_type = std::pair<std::string,boost::circular_buffer<geometry_msgs::PoseWithCovariance>>;
60  using map_type = std::map<std::string,boost::circular_buffer<geometry_msgs::PoseWithCovariance>>;
61  using map_iterator = std::map<std::string,boost::circular_buffer<geometry_msgs::PoseWithCovariance>>::iterator;
62  using recycle_map_type = std::map<std::string, ros::Time>;
63 
64  std::vector<std::string> recycle();
65 
66  // The object implementing the actual pose shape
67  std::map<std::string, std::vector<rviz::Object*>> robot_renderings_map_;
68  std::set<std::string> disabled_robots_;
69 
72 
73  int default_size_ = {5};
77  // A SceneNode whose pose is set to match the coordinate frame of
78  // the Imu message header.
79  Ogre::SceneNode* frame_node_;
80 
81  // The SceneManager, kept here only so the destructor can ask it to
82  // destroy the ``frame_node_``.
83  Ogre::SceneManager* scene_manager_;
84 
85  // The pose Shape object's scale
86  float scale_pose_;
87 
88  // The pose Shape object's color
89  Ogre::ColourValue color_pose_;
90 
91  // The variance Shape object's color
92  Ogre::ColourValue color_variance_;
93 };
94 
95 }
96 
97 #endif
void setMessage(const tuw_multi_robot_msgs::RobotInfoConstPtr _msg)
void resetKeepMeasurementsCount(const unsigned int c)
std::map< std::string, ros::Time > recycle_map_type
std::vector< rviz::Object * > make_robot(Ogre::Vector3 &position, Ogre::Quaternion &orientation)
void setFramePosition(const Ogre::Vector3 &_position)
std::pair< std::string, boost::circular_buffer< geometry_msgs::PoseWithCovariance >> internal_map_type
MultiRobotInfoVisual(Ogre::SceneManager *_scene_manager, Ogre::SceneNode *_parent_node)
std::map< std::string, boost::circular_buffer< geometry_msgs::PoseWithCovariance >> map_type
std::map< std::string, boost::circular_buffer< geometry_msgs::PoseWithCovariance >>::iterator map_iterator
std::map< std::string, std::vector< rviz::Object * > > robot_renderings_map_
void setFrameOrientation(const Ogre::Quaternion &orientation)


tuw_multi_robot_rviz
Author(s): Benjamin Binder
autogenerated on Mon Jun 10 2019 15:42:40