34 #include <boost/bind.hpp> 36 #include <OgreSceneNode.h> 37 #include <OgreSceneManager.h> 38 #include <OgreMatrix4.h> 48 "The rendering operation to use to draw the grid lines.",
this, SLOT(
updateStyle()));
53 "Only works with the 'Billboards' style.",
this, SLOT(
updateLineWidth()),
this);
65 "Allows you to offset the path from the origin of the reference frame. In meters.",
this, SLOT(
updateOffset()));
115 unsigned int num_u =
static_cast<unsigned int>(num);
116 if (num_u > axes_vect.size())
118 for (
size_t i = axes_vect.size(); i < num_u; i++)
123 axes_vect.push_back(axes);
126 else if (num_u < axes_vect.size())
128 for (
int i = axes_vect.size() - 1; num <= i; i--)
132 axes_vect.resize(num);
138 unsigned int num_u =
static_cast<unsigned int>(num);
139 if (num_u > arrow_vect.size())
141 for (
size_t i = arrow_vect.size(); i < num_u; i++)
144 arrow_vect.push_back(arrow);
147 else if (num_u < arrow_vect.size())
149 for (
int i = arrow_vect.size() - 1; num <= i; i--)
151 delete arrow_vect[i];
153 arrow_vect.resize(num);
182 if (billboard_line) billboard_line->setLineWidth(line_width);
232 for (
auto& axes : axes_vect)
247 for (
auto& arrow : arrow_vect)
249 arrow->setColor(color);
259 for (
auto& arrow : arrow_vect)
277 manual_object->clear();
279 manual_object =
NULL;
288 delete billboard_line;
289 billboard_line =
NULL;
298 axes_chain_.resize(0);
304 arrow_chain_.resize(0);
347 Ogre::ManualObject* manual_object =
NULL;
355 manual_object->clear();
360 billboard_line->
clear();
364 std::vector<rviz::Arrow*>& arrow_vect =
arrow_chain_[bufferIndex];
365 std::vector<rviz::Axes*>& axes_vect =
axes_chain_[bufferIndex];
375 Ogre::Vector3 position;
376 Ogre::Quaternion orientation;
379 ROS_DEBUG(
"Error transforming from frame '%s' to frame '%s'",
380 msg->header.frame_id.c_str(), qPrintable(
fixed_frame_));
383 Ogre::Matrix4 transform(orientation);
384 transform.setTrans(position);
393 uint32_t num_points = msg->poses.size();
397 manual_object->estimateVertexCount(num_points);
398 manual_object->begin(
"BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_STRIP);
419 for (uint32_t i = 0; i < num_points; ++i)
423 Ogre::Vector3 xpos = transform * Ogre::Vector3(pose.position.x,
426 const geometry_msgs::Quaternion& quat = pose.orientation;
427 Ogre::Quaternion xquat = orientation * Ogre::Quaternion(quat.w, quat.x, quat.y, quat.z);
432 manual_object->position(xpos.x, xpos.y, xpos.z);
433 manual_object->colour(color);
436 billboard_line->
addPoint(xpos, color);
445 axes_vect[i]->setPosition(xpos);
446 axes_vect[i]->setOrientation(xquat);
450 arrow_vect[i]->setColor(arrow_color);
455 arrow_vect[i]->setPosition(xpos);
456 arrow_vect[i]->setDirection(xquat * Ogre::Vector3(1, 0, 0));
462 manual_object->end();
rviz::EnumProperty * style_property_
rviz::VectorProperty * offset_property_
rviz::ColorProperty * color_property_
std::vector< Ogre::ManualObject * > manual_objects_
Ogre::ColourValue getOgreColor() const
geometry_msgs::Pose pose2DToPose(const geometry_msgs::Pose2D &pose2d)
void addPoint(const Ogre::Vector3 &point)
virtual void onInitialize()
rviz::ColorProperty * pose_arrow_color_property_
DisplayContext * context_
virtual int getInt() const
rviz::IntProperty * buffer_length_property_
virtual float getFloat() const
std::vector< std::vector< rviz::Axes * > > axes_chain_
void allocateAxesVector(std::vector< rviz::Axes * > &axes_vect, int num)
void updatePoseArrowGeometry()
Displays a nav_2d_msgs::Path2D message in Rviz.
void updatePoseAxisGeometry()
Ogre::SceneNode * scene_node_
rviz::FloatProperty * pose_axes_radius_property_
std::vector< std::vector< rviz::Arrow * > > arrow_chain_
void updateBufferLength()
virtual void addOption(const QString &option, int value=0)
rviz::FloatProperty * pose_axes_length_property_
rviz::FloatProperty * pose_arrow_head_diameter_property_
rviz::FloatProperty * line_width_property_
Several reusable pieces for displaying polygons.
virtual FrameManager * getFrameManager() const =0
rviz::FloatProperty * pose_arrow_shaft_length_property_
std::vector< rviz::BillboardLine * > billboard_lines_
rviz::FloatProperty * pose_arrow_head_length_property_
uint32_t messages_received_
void setNumLines(uint32_t num)
void setMaxPointsPerLine(uint32_t max)
Ogre::SceneManager * scene_manager_
rviz::FloatProperty * alpha_property_
rviz::FloatProperty * pose_arrow_shaft_diameter_property_
virtual void queueRender()=0
virtual Ogre::Vector3 getVector() const
LineStyle getLineStyle() const
rviz::EnumProperty * pose_style_property_
PoseStyle getPoseStyle() const
bool getTransform(const Header &header, Ogre::Vector3 &position, Ogre::Quaternion &orientation)
bool validateFloats(const nav_grid::NavGridInfo &info)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
void allocateArrowVector(std::vector< rviz::Arrow * > &arrow_vect, int num)
void updatePoseArrowColor()
void processMessage(const nav_2d_msgs::Path2D::ConstPtr &msg) override
virtual void setStatus(StatusProperty::Level level, const QString &name, const QString &text)
void onInitialize() override
void setLineWidth(float width)