screw_display.h
Go to the documentation of this file.
1 #ifndef SCREW_DISPLAY_H
2 #define SCREW_DISPLAY_H
3 
4 #ifndef Q_MOC_RUN
5 #include <boost/circular_buffer.hpp>
6 #endif
7 
9 
10 #include <geometry_msgs/AccelStamped.h>
11 #include <geometry_msgs/TwistStamped.h>
12 #include <geometry_msgs/WrenchStamped.h>
13 
14 namespace Ogre
15 {
16 class SceneNode;
17 }
18 
19 namespace rviz
20 {
21 class ColorProperty;
22 class ROSTopicStringProperty;
23 class FloatProperty;
24 class IntProperty;
25 } // namespace rviz
26 
27 namespace rviz
28 {
29 class ScrewVisual;
30 
31 template <class MessageType>
32 class ScrewDisplay : public rviz::MessageFilterDisplay<MessageType>
33 {
34 public:
35  // Constructor. pluginlib::ClassLoader creates instances by calling
36  // the default constructor, so make sure you have one.
37  ScrewDisplay();
38  ~ScrewDisplay() override = default;
39 
40 protected:
41  // Overrides of public virtual functions from the Display class.
42  void onInitialize() override;
43  void reset() override;
44 
45  // Helper function to properties for all visuals.
46  void updateProperties();
47  void updateHistoryLength();
48 
49  void processMessagePrivate(const std_msgs::Header& header,
50  const geometry_msgs::Vector3& linear,
51  const geometry_msgs::Vector3& angular);
52 
53  // Storage for the list of visuals par each joint intem
54  // Storage for the list of visuals. It is a circular buffer where
55  // data gets popped from the front (oldest) and pushed to the back (newest)
56  boost::circular_buffer<boost::shared_ptr<ScrewVisual> > visuals_;
57 
58  // Property objects for user-editable properties.
64 };
65 
66 class AccelStampedDisplay : public ScrewDisplay<geometry_msgs::AccelStamped>
67 {
68  Q_OBJECT
69 
70  // Function to handle an incoming ROS message.
71  void processMessage(const geometry_msgs::AccelStamped::ConstPtr& msg) override
72  {
73  processMessagePrivate(msg->header, msg->accel.linear, msg->accel.angular);
74  }
75 };
76 
77 class TwistStampedDisplay : public ScrewDisplay<geometry_msgs::TwistStamped>
78 {
79  Q_OBJECT
80 
81  // Function to handle an incoming ROS message.
82  void processMessage(const geometry_msgs::TwistStamped::ConstPtr& msg) override
83  {
84  processMessagePrivate(msg->header, msg->twist.linear, msg->twist.angular);
85  }
86 };
87 
88 class WrenchStampedDisplay : public ScrewDisplay<geometry_msgs::WrenchStamped>
89 {
90  Q_OBJECT
91 
92  // Function to handle an incoming ROS message.
93  void processMessage(const geometry_msgs::WrenchStamped::ConstPtr& msg) override
94  {
95  processMessagePrivate(msg->header, msg->wrench.force, msg->wrench.torque);
96  }
97 };
98 } // namespace rviz
99 
100 #endif // SCREW_DISPLAY_H
rviz::ScrewDisplay::alpha_property_
rviz::FloatProperty * alpha_property_
Definition: screw_display.h:60
rviz::ScrewDisplay::linear_color_property_
rviz::ColorProperty * linear_color_property_
Definition: screw_display.h:59
rviz::MessageFilterDisplay
Display subclass using a tf2_ros::MessageFilter, templated on the ROS message type.
Definition: message_filter_display.h:90
Ogre
Definition: axes_display.h:35
rviz::ScrewDisplay::onInitialize
void onInitialize() override
Override this function to do subclass-specific initialization.
Definition: screw_display.cpp:92
message_filter_display.h
linear
constexpr const char * linear()
Definition: screw_display.cpp:18
rviz::ScrewDisplay::hide_small_values_property_
rviz::BoolProperty * hide_small_values_property_
Definition: screw_display.h:63
rviz::BoolProperty
Property specialized to provide getter for booleans.
Definition: bool_property.h:38
rviz::AccelStampedDisplay::processMessage
void processMessage(const geometry_msgs::AccelStamped::ConstPtr &msg) override
Definition: screw_display.h:71
rviz::ScrewDisplay::history_length_property_
rviz::IntProperty * history_length_property_
Definition: screw_display.h:62
rviz::ScrewDisplay::linear_scale_property_
rviz::FloatProperty * linear_scale_property_
Definition: screw_display.h:60
rviz::ScrewDisplay::width_property_
rviz::FloatProperty * width_property_
Definition: screw_display.h:61
rviz::ColorProperty
Definition: color_property.h:40
rviz::FloatProperty
Property specialized to enforce floating point max/min.
Definition: float_property.h:37
rviz::ScrewDisplay::visuals_
boost::circular_buffer< boost::shared_ptr< ScrewVisual > > visuals_
Definition: screw_display.h:56
rviz::WrenchStampedDisplay::processMessage
void processMessage(const geometry_msgs::WrenchStamped::ConstPtr &msg) override
Definition: screw_display.h:93
rviz::WrenchStampedDisplay
Definition: screw_display.h:88
rviz
Definition: add_display_dialog.cpp:54
rviz::ScrewDisplay
Definition: screw_display.h:32
rviz::ScrewDisplay::angular_color_property_
rviz::ColorProperty * angular_color_property_
Definition: screw_display.h:59
rviz::ScrewDisplay::angular_scale_property_
rviz::FloatProperty * angular_scale_property_
Definition: screw_display.h:60
rviz::ScrewDisplay::updateProperties
void updateProperties()
Definition: screw_display.cpp:107
angular
constexpr const char * angular()
Definition: screw_display.cpp:23
rviz::TwistStampedDisplay
Definition: screw_display.h:77
rviz::AccelStampedDisplay
Definition: screw_display.h:66
rviz::TwistStampedDisplay::processMessage
void processMessage(const geometry_msgs::TwistStamped::ConstPtr &msg) override
Definition: screw_display.h:82
rviz::ScrewDisplay::~ScrewDisplay
~ScrewDisplay() override=default
rviz::ScrewDisplay::updateHistoryLength
void updateHistoryLength()
Definition: screw_display.cpp:130
header
const std::string header
rviz::ScrewDisplay::reset
void reset() override
Called to tell the display to clear its state.
Definition: screw_display.cpp:100
rviz::ScrewDisplay::ScrewDisplay
ScrewDisplay()
Definition: screw_display.cpp:42
rviz::ScrewDisplay::processMessagePrivate
void processMessagePrivate(const std_msgs::Header &header, const geometry_msgs::Vector3 &linear, const geometry_msgs::Vector3 &angular)
Definition: screw_display.cpp:137
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:10