effort_display.h
Go to the documentation of this file.
1 #ifndef EFFORT_DISPLAY_H
2 #define EFFORT_DISPLAY_H
3 
4 #ifndef Q_MOC_RUN
5 #include <boost/circular_buffer.hpp>
6 #endif
7 
8 #include <sensor_msgs/JointState.h>
10 
11 namespace Ogre
12 {
13 class SceneNode;
14 }
15 
16 namespace rviz
17 {
18 class FloatProperty;
19 class IntProperty;
20 class StringProperty;
21 class CategoryProperty;
22 class BoolProperty;
23 } // namespace rviz
24 
25 namespace urdf
26 {
27 class Model;
28 }
29 
30 #ifndef Q_MOC_RUN
32 #endif
33 
35 
36 namespace rviz
37 {
38 class JointInfo : public QObject
39 {
40  Q_OBJECT
41 public:
42  JointInfo(const std::string& name, rviz::Property* parent_category);
43  ~JointInfo() override;
44 
45  void setEffort(double e);
46  inline double getEffort()
47  {
48  return effort_;
49  }
50  void setMaxEffort(double m);
51  inline double getMaxEffort()
52  {
53  return max_effort_;
54  }
55  bool getEnabled() const;
56 
58 
59 public Q_SLOTS:
60  void updateVisibility();
61 
62 private:
63  std::string name_;
65 
69 };
70 
71 typedef std::set<JointInfo*> S_JointInfo;
72 typedef std::vector<std::string> V_string;
73 
74 class EffortVisual;
75 
76 class EffortDisplay : public rviz::MessageFilterDisplay<sensor_msgs::JointState>
77 {
78  Q_OBJECT
79 public:
80  EffortDisplay();
81  ~EffortDisplay() override;
82 
83  // Overrides of public virtual functions from the Display class.
84  void onInitialize() override;
85  void reset() override;
86 
87 private Q_SLOTS:
88  // Helper function to apply color and alpha to all visuals.
89  void updateColorAndAlpha();
90  void updateHistoryLength();
92  void updateTfPrefix();
93 
94  JointInfo* getJointInfo(const std::string& joint);
95  JointInfo* createJoint(const std::string& joint);
96 
97 protected:
98  // overrides from Display
99  void onEnable() override;
100  void onDisable() override;
101 
102  // load
103  using MFDClass::load;
104  void load();
105  void clear();
106 
107  // The object for urdf model
109 
110  std::string robot_description_;
111 
112 private:
113  void processMessage(const sensor_msgs::JointState::ConstPtr& msg) override;
114 
115  // Storage for the list of visuals. It is a circular buffer where
116  // data gets popped from the front (oldest) and pushed to the back (newest)
117  boost::circular_buffer<boost::shared_ptr<EffortVisual> > visuals_;
118 
119  typedef std::map<std::string, JointInfo*> M_JointInfo;
121 
122  // Property objects for user-editable properties.
125 
130 };
131 } // namespace rviz
132 
133 #endif // EFFORT_DISPLAY_H
rviz::JointInfo::setEffort
void setEffort(double e)
Definition: effort_display.cpp:47
rviz::EffortDisplay::EffortDisplay
EffortDisplay()
Definition: effort_display.cpp:81
rviz::MessageFilterDisplay
Display subclass using a tf2_ros::MessageFilter, templated on the ROS message type.
Definition: message_filter_display.h:90
rviz::JointInfo
Definition: effort_display.h:38
rviz::EffortDisplay::robot_model_
boost::shared_ptr< urdf::Model > robot_model_
Definition: effort_display.h:108
Ogre
Definition: axes_display.h:35
rviz::EffortDisplay::robot_description_
std::string robot_description_
Definition: effort_display.h:110
message_filter_display.h
boost::shared_ptr< urdf::Model >
rviz::JointInfo::name_
std::string name_
Definition: effort_display.h:63
rviz::JointInfo::last_update_
ros::Time last_update_
Definition: effort_display.h:57
rviz::EffortDisplay::load
void load()
Definition: effort_display.cpp:177
rviz::JointInfo::getMaxEffort
double getMaxEffort()
Definition: effort_display.h:51
rviz::EffortDisplay::history_length_property_
rviz::IntProperty * history_length_property_
Definition: effort_display.h:124
rviz::BoolProperty
Property specialized to provide getter for booleans.
Definition: bool_property.h:38
rviz::S_JointInfo
std::set< JointInfo * > S_JointInfo
Definition: effort_display.h:71
rviz::EffortDisplay::joints_
M_JointInfo joints_
Definition: effort_display.h:120
rviz::JointInfo::JointInfo
JointInfo(const std::string &name, rviz::Property *parent_category)
Definition: effort_display.cpp:20
rviz::JointInfo::getEnabled
bool getEnabled() const
Definition: effort_display.cpp:58
rviz::FloatProperty
Property specialized to enforce floating point max/min.
Definition: float_property.h:37
rviz::EffortDisplay::all_enabled_property_
rviz::BoolProperty * all_enabled_property_
Definition: effort_display.h:129
rviz::JointInfo::getEffort
double getEffort()
Definition: effort_display.h:46
rviz::Property
A single element of a property tree, with a name, value, description, and possibly children.
Definition: property.h:100
rviz::EffortDisplay::visuals_
boost::circular_buffer< boost::shared_ptr< EffortVisual > > visuals_
Definition: effort_display.h:117
rviz::V_string
std::vector< std::string > V_string
Definition: effort_display.h:72
rviz::EffortDisplay::~EffortDisplay
~EffortDisplay() override
Definition: effort_display.cpp:126
rviz::JointInfo::setMaxEffort
void setMaxEffort(double m)
Definition: effort_display.cpp:52
rviz::JointInfo::max_effort_property_
rviz::FloatProperty * max_effort_property_
Definition: effort_display.h:68
rviz::EffortDisplay
Definition: effort_display.h:76
rviz::EffortDisplay::scale_property_
rviz::FloatProperty * scale_property_
Definition: effort_display.h:123
rviz::EffortDisplay::reset
void reset() override
Called to tell the display to clear its state.
Definition: effort_display.cpp:131
rviz
Definition: add_display_dialog.cpp:54
subscriber.h
rviz::StringProperty
Property specialized for string values.
Definition: string_property.h:39
rviz::EffortDisplay::updateColorAndAlpha
void updateColorAndAlpha()
Definition: effort_display.cpp:150
rviz::EffortDisplay::robot_description_property_
rviz::StringProperty * robot_description_property_
Definition: effort_display.h:126
rviz::JointInfo::updateVisibility
void updateVisibility()
Definition: effort_display.cpp:43
rviz::EffortDisplay::onDisable
void onDisable() override
Derived classes override this to do the actual work of disabling themselves.
Definition: effort_display.cpp:250
rviz::Display::load
void load(const Config &config) override
Load the settings for this display from the given Config node, which must be a map.
Definition: display.cpp:231
rviz::EffortVisual
Definition: effort_visual.h:18
rviz::EffortDisplay::tf_prefix_property_
rviz::StringProperty * tf_prefix_property_
Definition: effort_display.h:127
rviz::EffortDisplay::joints_category_
rviz::Property * joints_category_
Definition: effort_display.h:128
rviz::EffortDisplay::alpha_property_
rviz::FloatProperty * alpha_property_
Definition: effort_display.h:123
rviz::JointInfo::max_effort_
double max_effort_
Definition: effort_display.h:64
rviz::EffortDisplay::updateTfPrefix
void updateTfPrefix()
Definition: effort_display.cpp:137
ros::Time
urdf
rviz::EffortDisplay::processMessage
void processMessage(const sensor_msgs::JointState::ConstPtr &msg) override
Definition: effort_display.cpp:256
rviz::EffortDisplay::createJoint
JointInfo * createJoint(const std::string &joint)
Definition: effort_display.cpp:74
rviz::EffortDisplay::onInitialize
void onInitialize() override
Override this function to do subclass-specific initialization.
Definition: effort_display.cpp:113
rviz::EffortDisplay::clear
void clear()
Definition: effort_display.cpp:143
rviz::EffortDisplay::M_JointInfo
std::map< std::string, JointInfo * > M_JointInfo
Definition: effort_display.h:119
rviz::EffortDisplay::getJointInfo
JointInfo * getJointInfo(const std::string &joint)
Definition: effort_display.cpp:63
rviz::JointInfo::~JointInfo
~JointInfo() override
Definition: effort_display.cpp:39
rviz::EffortDisplay::width_property_
rviz::FloatProperty * width_property_
Definition: effort_display.h:123
rviz::JointInfo::effort_property_
rviz::FloatProperty * effort_property_
Definition: effort_display.h:67
rviz::JointInfo::category_
rviz::Property * category_
Definition: effort_display.h:66
rviz::EffortDisplay::updateHistoryLength
void updateHistoryLength()
Definition: effort_display.cpp:172
rviz::EffortDisplay::onEnable
void onEnable() override
Derived classes override this to do the actual work of enabling themselves.
Definition: effort_display.cpp:245
rviz::EffortDisplay::updateRobotDescription
void updateRobotDescription()
Definition: effort_display.cpp:162
rviz::JointInfo::effort_
double effort_
Definition: effort_display.h:64
rviz::IntProperty
Property specialized to provide max/min enforcement for integers.
Definition: int_property.h:37


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Aug 2 2024 08:43:09