Go to the documentation of this file.00001 #ifndef GAZEBO_GAZEBOGRASPFIX_H
00002 #define GAZEBO_GAZEBOGRASPFIX_H
00003
00004 #include <boost/bind.hpp>
00005 #include <gazebo/gazebo.hh>
00006 #include <gazebo/physics/physics.hh>
00007 #include <gazebo/common/common.hh>
00008 #include <gazebo/transport/TransportTypes.hh>
00009 #include <stdio.h>
00010 #include <gazebo_grasp_plugin/GazeboGraspGripper.h>
00011
00012 namespace gazebo
00013 {
00014
00092 class GazeboGraspFix : public ModelPlugin
00093 {
00094 public:
00095 GazeboGraspFix();
00096 GazeboGraspFix(physics::ModelPtr _model);
00097 virtual ~GazeboGraspFix();
00098
00102 virtual void OnAttach(const std::string &objectName,
00103 const std::string &armName) {}
00107 virtual void OnDetach(const std::string &objectName,
00108 const std::string &armName) {}
00109
00110 private:
00111 virtual void Init();
00112 virtual void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf);
00135 void OnUpdate();
00136
00137 void InitValues();
00138
00139
00152 void OnContact(const ConstContactsPtr &ptr);
00153
00154
00155
00156
00157 bool IsGripperLink(const std::string &linkName, std::string &gripperName) const;
00158
00162 std::map<std::string, std::string> GetAttachedObjects() const;
00163
00168 class ObjectContactInfo;
00169
00173 bool ObjectAttachedToGripper(const ObjectContactInfo &objContInfo,
00174 std::string &attachedToGripper) const;
00175
00179 bool ObjectAttachedToGripper(const std::string &gripperName,
00180 std::string &attachedToGripper) const;
00181
00182
00183
00184
00185 physics::WorldPtr world;
00186
00187
00188 std::map<std::string, GazeboGraspGripper> grippers;
00189
00190 event::ConnectionPtr update_connection;
00191 transport::NodePtr node;
00192 transport::SubscriberPtr contactSub;
00193
00194
00195
00196 float forcesAngleTolerance;
00197
00198
00199
00200 bool disableCollisionsOnAttach;
00201
00202
00203
00204
00205
00206 std::map<std::string, std::string> collisions;
00207
00208
00212 class CollidingPoint;
00213
00214
00215
00216 std::map<std::string, std::map<std::string, CollidingPoint> > contacts;
00217 boost::mutex mutexContacts;
00218
00219
00220
00221
00222
00223
00224
00225 std::map<std::string, std::map<std::string, CollidingPoint> >
00226 attachGripContacts;
00227
00228
00229
00230
00231
00232
00233 std::map<std::string, int> gripCounts;
00234
00235
00236 int maxGripCount;
00237
00238
00239
00240 int gripCountThreshold;
00241
00242
00243
00244
00245 float releaseTolerance;
00246
00247
00248 common::Time updateRate;
00249
00250
00251 common::Time prevUpdateTime;
00252 };
00253
00254 }
00255
00256 #endif // GAZEBO_GAZEBOGRASPFIX_H