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 Nate Koenig
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::JointPtr fixedJoint;
84 
86  private: physics::LinkPtr palmLink;
87 
89  private: std::vector<event::ConnectionPtr> connections;
90 
92  private: std::map<std::string, physics::CollisionPtr> collisions;
93 
95  private: std::vector<physics::Contact> contacts;
96 
98  private: bool attached;
99 
102  private: math::Pose prevDiff;
103 
105  private: std::vector<double> diffs;
106 
108  private: int diffIndex;
109 
111  private: common::Time updateRate;
112 
114  private: common::Time prevUpdateTime;
115 
118  private: int posCount;
119 
122  private: int zeroCount;
123 
125  private: unsigned int min_contact_count;
126 
128  private: int attach_steps;
129 
131  private: int detach_steps;
132  };
134  }
135 }
136 #endif