All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Gripper.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 #ifndef _GRIPPER_HH_
18 #define _GRIPPER_HH_
19 
20 #include <map>
21 #include <vector>
22 #include <string>
23 
24 #include "physics/PhysicsTypes.hh"
25 
26 namespace gazebo
27 {
28  namespace physics
29  {
32 
40  class Gripper
41  {
44  public: explicit Gripper(ModelPtr _model);
45 
47  public: virtual ~Gripper();
48 
52  public: virtual void Load(sdf::ElementPtr _sdf);
53 
55  public: virtual void Init();
56 
58  private: void OnUpdate();
59 
64  private: void OnContact(const std::string &_collisionName,
65  const physics::Contact &_contact);
66 
68  private: void HandleAttach();
69 
71  private: void HandleDetach();
72 
74  private: void ResetDiffs();
75 
77  private: physics::ModelPtr model;
78 
80  private: physics::PhysicsEnginePtr physics;
81 
83  private: physics::WorldPtr world;
84 
86  private: physics::JointPtr fixedJoint;
87 
89  private: physics::LinkPtr palmLink;
90 
92  private: std::vector<event::ConnectionPtr> connections;
93 
95  private: std::map<std::string, physics::CollisionPtr> collisions;
96 
98  private: std::vector<physics::Contact> contacts;
99 
101  private: bool attached;
102 
105  private: math::Pose prevDiff;
106 
108  private: std::vector<double> diffs;
109 
111  private: int diffIndex;
112 
114  private: common::Time updateRate;
115 
117  private: common::Time prevUpdateTime;
118 
121  private: int posCount;
122 
125  private: int zeroCount;
126 
128  private: unsigned int min_contact_count;
129 
131  private: int attachSteps;
132 
134  private: int detachSteps;
135  };
137  }
138 }
139 #endif