Go to the documentation of this file.00001 #ifndef finger_h___
00002 #define finger_h___
00003
00004 #include "utilities.h"
00005 #include "target_object.h"
00006 #include <iostream>
00007 #include <string>
00008
00009 using std::string;
00010
00011 namespace ICR
00012 {
00013
00014
00043 struct InclusionRule
00044 {
00045 double rule_parameter_;
00046 RuleType rule_type_;
00047 bool filter_inside_points_;
00048
00049 InclusionRule();
00056 InclusionRule(double rule_parameter_in,
00057 RuleType rule_type_t_in = Sphere,
00058 bool filter_in = false);
00059
00060 friend std::ostream& operator<<(std::ostream &stream,InclusionRule const& inclusion_rule);
00066 bool inclusionTest(ContactPoint const* center_point, ContactPoint const* test_point)const;
00067 };
00068
00069
00081 struct Node
00082 {
00083 ContactPoint* contact_point_;
00084 bool inside_patch_;
00085
00086 Node();
00087 Node(ContactPoint* contact_point);
00088 friend std::ostream& operator<<(std::ostream &stream, Node const& node);
00089 };
00090
00091
00095 struct Patch
00096 {
00097 IndexList patch_ids_;
00098
00099 Patch();
00106 Patch(uint centerpoint_id);
00120 Patch(uint centerpoint_id, TargetObject const& obj, InclusionRule const& rule);
00121 friend std::ostream& operator<<(std::ostream &stream,Patch const& patch);
00122 };
00123
00124
00131 class FingerParameters
00132 {
00133 private:
00134
00135 string name_;
00136 double force_magnitude_;
00137 uint disc_;
00138 double mu_0_;
00139 double mu_T_;
00140 ContactType contact_type_;
00141 ModelType model_type_;
00142 InclusionRule inclusion_rule_;
00143
00144 public:
00148 FingerParameters();
00149 FingerParameters(FingerParameters const& src);
00157 FingerParameters(string name,
00158 double force_magnitude_in,
00159 uint disc_in,
00160 double mu_0_in,
00161 double mu_T_in,
00162 ContactType contact_type_in,
00163 ModelType model_type_in,
00164 double radius_in);
00165 friend std::ostream& operator<<(std::ostream &stream,FingerParameters const& param);
00166 FingerParameters& operator=(FingerParameters const& src);
00167 ~FingerParameters();
00168 void setName(string &name_in) {name_ = name_in;}
00169
00170 void setForce(double f_in) {assert(f_in > 0); force_magnitude_ = f_in;}
00171 void setFriction(double mu_in) {assert(mu_in > 0); mu_0_ = mu_in;}
00172 void setFrictionTorsional(double mu_in) {assert(mu_in > 0); mu_T_ = mu_in;}
00173
00174 void setDiscretization(uint d_in) {assert(d_in > 0); disc_ = d_in;}
00175
00176 void setFrictionlessContact(double force_magnitude);
00177 void setFrictionalContact(double force_magnitude,uint disc,double mu_0);
00178 void setSoftFingerContact(double force_magnitude,uint disc,double mu_0, double mu_T);
00179 void setContactType(ContactType contact_type);
00180 void setContactType(string &contact_type);
00181 void setContactModelType(ModelType model_type);
00182 void setContactModelType(string &model_type);
00183 void setInclusionRule(InclusionRule const& inclusion_rule);
00184 void setInclusionRuleType(RuleType rule_type);
00185 void setInclusionRuleType(string &rule_type);
00186 void setInclusionRuleParameter(double rule_parameter);
00187 void setInclusionRuleFilterPatch(bool filter_inside_points);
00188
00189 double getForceMagnitude()const;
00190 string getName()const;
00191 uint getDisc()const;
00192 double getMu0()const;
00193 double getMuT()const;
00194 ContactType getContactType()const;
00195 ModelType getModelType()const;
00196 InclusionRule const* getInclusionRule()const;
00197 RuleType getInclusionRuleType()const;
00198 uint getInclusionRuleParameter()const;
00199 bool getInclusionRuleFilterPatch()const;
00200
00201 };
00202
00203
00204
00205
00210 class Finger
00211 {
00212 private:
00213
00214 PointContactModel* c_model_;
00215 OWSPtr ows_;
00216 PatchListPtr patches_;
00217 uint centerpoint_id_;
00218 bool initialized_;
00219 string name_;
00220
00221 public:
00222
00223 Finger();
00224 Finger(FingerParameters const& param);
00225 Finger(Finger const& src);
00226 Finger& operator=(Finger const& src);
00227 friend std::ostream& operator<<(std::ostream& stream,Finger const& finger);
00228 ~Finger();
00229
00230 void init(uint centerpoint_id, const PatchListPtr patches, const OWSPtr ows);
00231 void setCenterPointId(uint centerpoint_id);
00232 Patch const* getCenterPointPatch() const;
00233 Patch const* getPatch(uint id)const;
00234 const OWSPtr getOWS()const;
00235 const PatchListPtr getPatches()const;
00236 PointContactModel const* getContactModel()const;
00237 PointContactModel* getContactModel();
00238 uint getCenterPointId()const;
00239 bool isInitialized()const;
00240 string getName()const;
00241 void setName(string const & name);
00242
00243 };
00244
00245
00246 }
00247 #endif