All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Road2d.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef _ROAD2D_HH_
18 #define _ROAD2D_HH_
19 
20 #include <string>
21 #include <vector>
22 #include <list>
23 
24 #include "gazebo/msgs/msgs.hh"
25 #include "gazebo/common/Events.hh"
27 
29 #include "gazebo/math/Vector3.hh"
30 #include "gazebo/math/Spline.hh"
32 #include "gazebo/util/system.hh"
33 
34 namespace gazebo
35 {
36  namespace rendering
37  {
40 
44  {
46  public: Road2d();
47 
49  public: virtual ~Road2d();
50 
53  public: void Load(VisualPtr _parent);
54 
56  private: void PreRender();
57 
59  private: void OnRoadMsg(ConstRoadPtr &_msg);
60 
62  private: class Segment : public Ogre::SimpleRenderable
63  {
66  public: void Load(msgs::Road _msg);
67 
68 
71  public: virtual Ogre::Real getBoundingRadius() const;
72 
75  public: virtual Ogre::Real getSquaredViewDepth(
76  const Ogre::Camera* cam) const;
77 
79  public: std::string name;
80 
82  public: std::vector<math::Vector3> points;
83 
85  public: double width;
86  };
87 
88 
91  typedef std::list<boost::shared_ptr<msgs::Road const> > RoadMsgs_L;
92 
94  private: RoadMsgs_L msgs;
95 
97  private: std::vector<Road2d::Segment*> segments;
98 
100  private: VisualPtr parent;
101 
103  private: transport::NodePtr node;
104 
106  private: transport::SubscriberPtr sub;
107 
109  private: std::vector<event::ConnectionPtr> connections;
110  };
112  }
113 }
114 #endif