30 #include <OGRE/OgreVector3.h> 31 #include <OGRE/OgreSceneNode.h> 32 #include <OGRE/OgreSceneManager.h> 35 #include <tuw_multi_robot_msgs/Vertex.h> 68 static double timeOld_;
69 if (timeOld_ == msg->header.stamp.toSec())
73 timeOld_ = msg->header.stamp.toSec();
75 pathLine.resize(msg->vertices.size() * 4);
76 for (
size_t i = 0; i < msg->vertices.size(); ++i)
78 tuw_multi_robot_msgs::Vertex seg = msg->vertices[i];
79 geometry_msgs::Point p1 = seg.path.front();
80 geometry_msgs::Point p2 = seg.path.back();
84 (float)((p1.x + 0.5) * msg->resolution + msg->origin.position.x),
85 (
float)((p1.y + 0.5) * msg->resolution + msg->origin.position.y),
86 (
float)((p2.x + 0.5) * msg->resolution + msg->origin.position.x),
87 (
float)((p2.y + 0.5) * msg->resolution + msg->origin.position.y)};
88 float z1 = p1.z * msg->resolution + msg->origin.position.z;
89 float z2 = p2.z * msg->resolution + msg->origin.position.z;
96 pathLine[i * 4]->setPoints(Ogre::Vector3(l1.
x0, l1.
y0, z1), Ogre::Vector3(l1.
x1, l1.
y1, z2));
101 pathLine[i * 4 + 1]->setPoints(Ogre::Vector3(l2.
x0, l2.
y0, z1), Ogre::Vector3(l2.
x1, l2.
y1, z2));
106 pathLine[i * 4 + 2]->setPoints(Ogre::Vector3(l1.
x0, l1.
y0, z1), Ogre::Vector3(l2.
x0, l2.
y0, z2));
111 pathLine[i * 4 + 3]->setPoints(Ogre::Vector3(l2.
x1, l2.
y1, z1), Ogre::Vector3(l1.
x1, l1.
y1, z2));
119 float dx = _l.
x0 - _l.
x1;
120 float dy = _l.
y0 - _l.
y1;
121 float l = std::sqrt(dx * dx + dy * dy);
123 ret.
x0 = _l.
x0 + d * (-dy) / l;
124 ret.
x1 = _l.
x1 + d * (-dy) / l;
125 ret.
y0 = _l.
y0 + d * dx / l;
126 ret.
y1 = _l.
y1 + d * dx / l;
std::vector< boost::shared_ptr< rviz::Line > > pathLine
Ogre::SceneManager * scene_manager_
Line offsetLine(Line _l, float d)
Ogre::SceneNode * frame_node_
void setPathScale(float scale)
void setMessage(const tuw_multi_robot_msgs::Graph::ConstPtr &msg)
void setFrameOrientation(const Ogre::Quaternion &orientation)
void setFramePosition(const Ogre::Vector3 &position)
VoronoiSegmentVisual(Ogre::SceneManager *scene_manager, Ogre::SceneNode *parent_node)
Ogre::ColourValue colorPath_
void setPathColor(Ogre::ColourValue color)
virtual ~VoronoiSegmentVisual()