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 "gazebo/math/Pose.hh"
26 
27 namespace gazebo
28 {
29  namespace physics
30  {
33 
41  class Gripper
42  {
45  public: explicit Gripper(ModelPtr _model);
46 
48  public: virtual ~Gripper();
49 
53  public: virtual void Load(sdf::ElementPtr _sdf);
54 
56  public: virtual void Init();
57 
59  private: void OnUpdate();
60 
65  private: void OnContact(const std::string &_collisionName,
66  const physics::Contact &_contact);
67 
69  private: void HandleAttach();
70 
72  private: void HandleDetach();
73 
75  private: void ResetDiffs();
76 
78  private: physics::ModelPtr model;
79 
81  private: physics::PhysicsEnginePtr physics;
82 
84  private: physics::WorldPtr world;
85 
87  private: physics::JointPtr fixedJoint;
88 
90  private: physics::LinkPtr palmLink;
91 
93  private: std::vector<event::ConnectionPtr> connections;
94 
96  private: std::map<std::string, physics::CollisionPtr> collisions;
97 
99  private: std::vector<physics::Contact> contacts;
100 
102  private: bool attached;
103 
106  private: math::Pose prevDiff;
107 
109  private: std::vector<double> diffs;
110 
112  private: int diffIndex;
113 
115  private: common::Time updateRate;
116 
118  private: common::Time prevUpdateTime;
119 
122  private: int posCount;
123 
126  private: int zeroCount;
127 
129  private: unsigned int min_contact_count;
130 
132  private: int attachSteps;
133 
135  private: int detachSteps;
136  };
138  }
139 }
140 #endif