35 #include <OgreSceneNode.h>
36 #include <OgreSceneManager.h>
37 #include <OgreMatrix4.h>
47 "The rendering operation to use to draw the grid lines.",
this, SLOT(
updateStyle()));
52 "Only works with the 'Billboards' style.",
this, SLOT(
updateLineWidth()),
this);
64 "Allows you to offset the path from the origin of the reference frame. In meters.",
this, SLOT(
updateOffset()));
114 unsigned int num_u =
static_cast<unsigned int>(num);
115 if (num_u > axes_vect.size())
117 for (
size_t i = axes_vect.size(); i < num_u; i++)
122 axes_vect.push_back(axes);
125 else if (num_u < axes_vect.size())
127 for (
int i = axes_vect.size() - 1; num <= i; i--)
131 axes_vect.resize(num);
137 unsigned int num_u =
static_cast<unsigned int>(num);
138 if (num_u > arrow_vect.size())
140 for (
size_t i = arrow_vect.size(); i < num_u; i++)
143 arrow_vect.push_back(arrow);
146 else if (num_u < arrow_vect.size())
148 for (
int i = arrow_vect.size() - 1; num <= i; i--)
150 delete arrow_vect[i];
152 arrow_vect.resize(num);
181 if (billboard_line) billboard_line->setLineWidth(line_width);
231 for (
auto& axes : axes_vect)
246 for (
auto& arrow : arrow_vect)
248 arrow->setColor(color);
258 for (
auto& arrow : arrow_vect)
276 manual_object->clear();
278 manual_object =
NULL;
287 delete billboard_line;
288 billboard_line =
NULL;
346 Ogre::ManualObject* manual_object =
NULL;
354 manual_object->clear();
359 billboard_line->
clear();
363 std::vector<rviz::Arrow*>& arrow_vect =
arrow_chain_[bufferIndex];
364 std::vector<rviz::Axes*>& axes_vect =
axes_chain_[bufferIndex];
374 Ogre::Vector3 position;
375 Ogre::Quaternion orientation;
378 ROS_DEBUG(
"Error transforming from frame '%s' to frame '%s'",
379 msg->header.frame_id.c_str(), qPrintable(
fixed_frame_));
382 Ogre::Matrix4 transform(orientation);
383 transform.setTrans(position);
392 uint32_t num_points = msg->poses.size();
396 manual_object->estimateVertexCount(num_points);
397 manual_object->begin(
"BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_STRIP);
418 for (uint32_t i = 0; i < num_points; ++i)
422 Ogre::Vector3 xpos = transform * Ogre::Vector3(pose.position.x,
425 const geometry_msgs::Quaternion& quat = pose.orientation;
426 Ogre::Quaternion xquat = orientation * Ogre::Quaternion(quat.w, quat.x, quat.y, quat.z);
431 manual_object->position(xpos.x, xpos.y, xpos.z);
432 manual_object->colour(color);
435 billboard_line->
addPoint(xpos, color);
444 axes_vect[i]->setPosition(xpos);
445 axes_vect[i]->setOrientation(xquat);
449 arrow_vect[i]->setColor(arrow_color);
454 arrow_vect[i]->setPosition(xpos);
455 arrow_vect[i]->setDirection(xquat * Ogre::Vector3(1, 0, 0));
461 manual_object->end();