30 #include <OgreEntity.h> 31 #include <OgreSceneNode.h> 53 #include <Eigen/Dense> 80 new VectorProperty(
"Covariance Position", Ogre::Vector3::ZERO,
"", cat);
84 new VectorProperty(
"Covariance Orientation", Ogre::Vector3::ZERO,
"", cat);
108 aabbs.push_back(
display_->
covariance_->getPositionShape()->getEntity()->getWorldBoundingBox());
114 ->getWorldBoundingBox());
117 ->getWorldBoundingBox());
120 ->getWorldBoundingBox());
126 void setMessage(
const geometry_msgs::PoseWithCovarianceStampedConstPtr& message)
136 message->pose.pose.position.x, message->pose.pose.position.y, message->pose.pose.position.z));
138 Ogre::Quaternion(message->pose.pose.orientation.w, message->pose.pose.orientation.x,
139 message->pose.pose.orientation.y, message->pose.pose.orientation.z));
141 message->pose.covariance[1 + 1 * 6],
142 message->pose.covariance[2 + 2 * 6]));
145 message->pose.covariance[4 + 4 * 6],
146 message->pose.covariance[5 + 5 * 6]));
175 "Shaft Length", 1,
"Length of the arrow's shaft, in meters.",
this, SLOT(
updateArrowGeometry()));
179 new FloatProperty(
"Shaft Radius", 0.05,
"Radius of the arrow's shaft, in meters.",
this,
197 "Whether or not the covariances of the messages should be shown.",
this,
223 coll_handler_->addTrackedObjects(covariance_->getPositionSceneNode());
224 coll_handler_->addTrackedObjects(covariance_->getOrientationSceneNode());
302 const geometry_msgs::PoseWithCovarianceStamped::ConstPtr& message)
307 "Message contained invalid floating point values (nans or infs)");
314 "PoseWithCovariance '%s' contains unnormalized quaternions. " 315 "This warning will only be output once but may be true for others; " 316 "enable DEBUG messages for ros.rviz.quaternions to see more details.",
318 ROS_DEBUG_NAMED(
"quaternions",
"PoseWithCovariance '%s' contains unnormalized quaternions.",
322 Ogre::Vector3 position;
323 Ogre::Quaternion orientation;
326 ROS_ERROR(
"Error transforming pose '%s' from frame '%s' to frame '%s'", qPrintable(
getName()),
327 message->header.frame_id.c_str(), qPrintable(
fixed_frame_));
338 arrow_->
setOrientation(orientation * Ogre::Quaternion(Ogre::Degree(-90), Ogre::Vector3::UNIT_Y));
rviz::FloatProperty * head_length_property_
void setOrientation(const Ogre::Quaternion &orientation) override
Set the orientation of the object.
Displays the pose from a geometry_msgs::PoseWithCovarianceStamped message.
rviz::FloatProperty * axes_length_property_
void updateArrowGeometry()
virtual bool setVector(const Ogre::Vector3 &vector)
StringProperty * frame_property_
bool getOrientationBool()
DisplayContext * context_
This DisplayContext pointer is the main connection a Display has into the rest of rviz...
void setPosition(const Ogre::Vector3 &position) override
Set the position of the base of the arrow.
~PoseWithCovarianceDisplay() override
A single element of a property tree, with a name, value, description, and possibly children...
void setReadOnly(bool read_only) override
Overridden from Property to propagate read-only-ness to children.
void updateShapeVisibility()
PoseWithCovarianceDisplay()
void reset() override
Called to tell the display to clear its state.
Ogre::ColourValue getOgreColor() const
Property specialized to enforce floating point max/min.
void set(float shaft_length, float shaft_diameter, float head_length, float head_diameter)
Set the parameters for this arrow.
void setReadOnly(bool read_only) override
Overridden from Property to propagate read-only-ness to children.
void createProperties(const Picked &, Property *parent_property) override
Override to create properties of the given picked object(s).
rviz::EnumProperty * shape_property_
Ogre::SceneNode * scene_node_
The Ogre::SceneNode to hold all 3D scene elements shown by this Display.
rviz::FloatProperty * axes_radius_property_
CovarianceVisualPtr createAndPushBackVisual(Ogre::SceneManager *scene_manager, Ogre::SceneNode *parent_node)
Ogre::SceneNode * getSceneNode()
Get the scene node associated with this arrow.
QString fixed_frame_
A convenience variable equal to context_->getFixedFrame().
#define ROS_DEBUG_NAMED(name,...)
CovarianceProperty * covariance_property_
Pure-virtual base class for objects which give Display subclasses context in which to work...
std::vector< Ogre::AxisAlignedBox > V_AABB
PoseWithCovarianceDisplay * display_
bool validateFloats(const sensor_msgs::CameraInfo &msg)
virtual void addOption(const QString &option, int value=0)
boost::shared_ptr< CovarianceVisual > covariance_
rviz::FloatProperty * head_radius_property_
void queueRender()
Convenience function which calls context_->queueRender().
virtual QString getName() const
Return the name of this Property as a QString.
virtual bool setQuaternion(const Ogre::Quaternion &quaternion)
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.
PoseWithCovarianceDisplaySelectionHandler(PoseWithCovarianceDisplay *display, DisplayContext *context)
void setMessage(const geometry_msgs::PoseWithCovarianceStampedConstPtr &message)
void getAABBs(const Picked &, V_AABB &aabbs) override
QuaternionProperty * orientation_property_
#define ROS_WARN_ONCE_NAMED(name,...)
An object that displays a set of X/Y/Z axes, with X=Red, Y=Green, Z=Blue.
Ogre::SceneManager * scene_manager_
A convenience variable equal to context_->getSceneManager().
rviz::FloatProperty * alpha_property_
PoseWithCovarianceDisplaySelectionHandlerPtr coll_handler_
void setPosition(const Ogre::Vector3 &position) override
Set the position of this object.
virtual void setHidden(bool hidden)
Hide or show this property in any PropertyTreeWidget viewing its parent.
rviz::ColorProperty * color_property_
Property specialized for string values.
virtual void queueRender()=0
Queues a render. Multiple calls before a render happens will only cause a single render.
VectorProperty * covariance_orientation_property_
void updateColorAndAlpha()
void onInitialize() override
Override this function to do subclass-specific initialization.
void updateAxisGeometry()
bool validateQuaternions(const visualization_msgs::InteractiveMarker &marker)
virtual float getFloat() const
Property specialized to provide getter for booleans.
rviz::FloatProperty * shaft_length_property_
QList< Property * > properties_
void onInitialize() override
An arrow consisting of a cylinder and a cone.
void set(float length, float radius)
Set the parameters on this object.
void setOrientation(const Ogre::Quaternion &orientation) override
Set the orientation.
void setColor(float r, float g, float b, float a) override
Set the color of this arrow. Sets both the head and shaft color to the same value. Values are in the range [0, 1].
bool initialized() const
Returns true if the display has been initialized.
Ogre::SceneNode * getSceneNode()
Get the scene node associated with this object.
VectorProperty * covariance_position_property_
void processMessage(const geometry_msgs::PoseWithCovarianceStamped::ConstPtr &message) override
rviz::FloatProperty * shaft_radius_property_
virtual bool getBool() const
virtual void setReadOnly(bool read_only)
Prevent or allow users to edit this property from a PropertyTreeWidget.
virtual int getOptionInt()
Return the int value of the currently-chosen option, or 0 if the current option string does not have ...
bool setStdString(const std::string &std_str)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
virtual void setStatus(StatusProperty::Level level, const QString &name, const QString &text)
Show status level and text. This is thread-safe.
void onEnable() override
Overridden from MessageFilterDisplay to get Arrow/Axes visibility correct.
friend class PoseWithCovarianceDisplaySelectionHandler
VectorProperty * position_property_
Ogre::Entity * getEntity()