30 #include <OgreSceneNode.h> 31 #include <OgreSceneManager.h> 55 "Buffer Length", 1,
"Number of prior measurements to display.",
this, SLOT(
updateBufferLength()));
59 "Size of the tf message filter queue. It usually needs to be " 60 "set at least as high as the number of sonar frames.",
73 for (
size_t i = 0; i <
cones_.size(); i++)
94 for (
size_t i = 0; i <
cones_.size(); i++)
96 cones_[i]->setColor(oc.r, oc.g, oc.b, alpha);
106 for (
size_t i = 0; i <
cones_.size(); i++)
110 cones_.resize(buffer_length);
111 for (
size_t i = 0; i <
cones_.size(); i++)
116 Ogre::Vector3 position;
117 Ogre::Quaternion orientation;
118 geometry_msgs::Pose pose;
119 pose.orientation.w = 1;
120 Ogre::Vector3 scale(0, 0, 0);
122 cone->
setColor(color.redF(), color.greenF(), color.blueF(), 0);
130 Ogre::Vector3 position;
131 Ogre::Quaternion orientation;
132 geometry_msgs::Pose pose;
133 float displayed_range = 0.0;
134 if (msg->min_range <= msg->range && msg->range <= msg->max_range)
136 displayed_range = msg->range;
138 else if (msg->min_range == msg->max_range)
140 if (msg->range < 0 && !std::isfinite(msg->range))
142 displayed_range = msg->min_range;
147 displayed_range / 2 -
148 .008824 * displayed_range;
149 pose.orientation.z = 0.707;
150 pose.orientation.w = 0.707;
154 ROS_DEBUG(
"Error transforming from frame '%s' to frame '%s'", msg->header.frame_id.c_str(),
161 double cone_width = 2.0 * displayed_range *
tan(msg->field_of_view / 2.0);
162 Ogre::Vector3 scale(cone_width, displayed_range, cone_width);
ColorProperty * color_property_
tf2_ros::MessageFilter< sensor_msgs::Range > * tf_filter_
void processMessage(const sensor_msgs::Range::ConstPtr &msg) override
Overridden from MessageFilterDisplay.
void setOrientation(const Ogre::Quaternion &orientation) override
Set the orientation of the object.
DisplayContext * context_
This DisplayContext pointer is the main connection a Display has into the rest of rviz...
virtual QColor getColor() const
void setScale(const Ogre::Vector3 &scale) override
Set the scale of the object. Always relative to the identity orientation of the object.
Ogre::ColourValue getOgreColor() const
void updateColorAndAlpha()
Property specialized to enforce floating point max/min.
void setColor(float r, float g, float b, float a) override
Set the color of the object. Values are in the range [0, 1].
Property specialized to provide max/min enforcement for integers.
Ogre::SceneNode * scene_node_
The Ogre::SceneNode to hold all 3D scene elements shown by this Display.
void updateBufferLength()
QString fixed_frame_
A convenience variable equal to context_->getFixedFrame().
IntProperty * queue_size_property_
void reset() override
Overridden from Display.
FloatProperty * alpha_property_
bool transform(const Header &header, const geometry_msgs::Pose &pose, Ogre::Vector3 &position, Ogre::Quaternion &orientation)
Transform a pose from a frame into the fixed frame.
virtual FrameManager * getFrameManager() const =0
Return the FrameManager instance.
virtual void setQueueSize(uint32_t new_queue_size)
uint32_t messages_received_
virtual int getInt() const
Return the internal property value as an integer.
void setPosition(const Ogre::Vector3 &position) override
Set the position of this object.
virtual Ogre::SceneManager * getSceneManager() const =0
Returns the Ogre::SceneManager used for the main RenderPanel.
virtual void queueRender()=0
Queues a render. Multiple calls before a render happens will only cause a single render.
Displays a sensor_msgs::Range message as a cone.
virtual float getFloat() const
void onInitialize() override
Overridden from Display.
void onInitialize() override
INLINE Rall1d< T, V, S > tan(const Rall1d< T, V, S > &arg)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
std::vector< Shape * > cones_
Handles actually drawing the cones.
IntProperty * buffer_length_property_