All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ContactVisual.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2012 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 /* Desc: Camera Visualization Class
18  * Author: Nate Koenig
19  */
20 
21 #ifndef _CONTACTVISUAL_HH_
22 #define _CONTACTVISUAL_HH_
23 
24 #include <string>
25 #include <vector>
26 
28 #include "gazebo/msgs/msgs.hh"
30 
31 namespace Ogre
32 {
33  class Entity;
34  class SceneNode;
35 }
36 
37 namespace gazebo
38 {
39  namespace rendering
40  {
43 
44  class DynamicLines;
45 
51  class ContactVisual : public Visual
52  {
58  public: ContactVisual(const std::string &_name, VisualPtr _vis,
59  const std::string &_topicName);
60 
62  public: virtual ~ContactVisual();
63 
66  public: void SetEnabled(bool _enabled);
67 
69  private: void Update();
70 
73  private: void OnContact(ConstContactsPtr &_msg);
74 
76  private: void CreateNewPoint();
77 
79  private: transport::NodePtr node;
80 
82  private: transport::SubscriberPtr contactsSub;
83 
85  private: boost::shared_ptr<msgs::Contacts const> contactsMsg;
86 
88  private: std::vector<event::ConnectionPtr> connections;
89 
91  private: class ContactPoint
92  {
94  public: Ogre::SceneNode *sceneNode;
96  public: DynamicLines *normal, *depth;
97  };
98 
100  private: std::vector<ContactVisual::ContactPoint*> points;
101 
103  private: boost::mutex mutex;
104 
106  private: bool receivedMsg;
107 
109  private: bool enabled;
110 
112  private: std::string topicName;
113  };
115  }
116 }
117 #endif