00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 #ifndef GAZEBO_P2GRIPPER_HH
00072 #define GAZEBO_P2GRIPPER_HH
00073
00074 #include "Model.hh"
00075
00076
00077 class Body;
00078 class Geom;
00079 class RayGeom;
00080 class GeomData;
00081 class SliderJoint;
00082 class RayProximity;
00083
00084 typedef struct gz_gripper gz_gripper_t;
00085
00086 class Pioneer2Gripper : public Model
00087 {
00088
00089 public: Pioneer2Gripper( World *world );
00090 public: virtual ~Pioneer2Gripper();
00091
00092
00093 public: virtual int Load( WorldFile *file, WorldFileNode *node );
00094
00095
00096 public: virtual int Init( WorldFile *file, WorldFileNode *node );
00097
00098
00099 public: virtual int Fini();
00100
00101
00102 public: virtual void Update( double step );
00103
00104
00105 private: static void UpdateGripCallback( void *data, dGeomID o1, dGeomID o2 );
00106
00107
00108 private: int OdeLoad( WorldFile *file, WorldFileNode *node );
00109
00110
00111 private: int OdeInit( WorldFile *file, WorldFileNode *node );
00112
00113
00114 private: int OdeFini();
00115
00116
00117 private: int IfaceInit();
00118
00119
00120 private: int IfaceFini();
00121
00122
00123 private: void IfaceGetCmd();
00124
00125
00126 private: void IfacePutData();
00127
00128
00129 public: void OpenGrip();
00130 public: void CloseGrip();
00131 public: void StopGrip();
00132
00133
00134 public: void StopLift();
00135 public: void LiftUp();
00136 public: void LiftDown();
00137
00138
00139 public: void AddGrippableModel( Model *model);
00140
00141
00142 public: enum GripperMode{ GRIPPER_STOP_MODE = 0, GRIPPER_OPEN_MODE, GRIPPER_CLOSE_MODE };
00143
00144 public: enum LiftMode{ LIFT_STOP_MODE = 0, LIFT_UP_MODE, LIFT_DOWN_MODE };
00145
00146
00147 private: dReal gripMaxSpeed;
00148 private: dReal liftMaxSpeed;
00149
00150 private: dReal fixedbarLength;
00151 private: dReal fixedbarWidth;
00152 private: dReal fixedbarHeight;
00153 private: dReal fixedbarMass;
00154
00155 private: dReal basebarLength;
00156 private: dReal basebarWidth;
00157 private: dReal basebarHeight;
00158 private: dReal basebarZPos;
00159 private: dReal basebarMass;
00160
00161 private: dReal gripLength;
00162 private: dReal gripWidth;
00163 private: dReal gripHeight;
00164 private: dReal gripMass;
00165 private: dReal gripsOpenWidth;
00166 private: dReal gripsCloseWidth;
00167 private: dReal gripMinPosLimit;
00168 private: dReal gripMaxPosLimit;
00169 private: dReal gripMaxForce;
00170
00171 private: dReal liftHeight;
00172 private: dReal liftMinPosLimit;
00173 private: dReal liftMaxPosLimit;
00174 private: dReal liftMaxForce;
00175
00176 private: dReal ffTolerance;
00177 private: dReal simFrictionTolerance;
00178
00179
00180
00181
00182 private: bool lift_limit_reach;
00183 private: bool grip_limit_reach;
00184 private: bool outer_beam_obstruct;
00185 private: bool inner_beam_obstruct;
00186 private: bool left_paddle_open;
00187 private: bool right_paddle_open;
00188 private: bool paddles_opened;
00189 private: bool paddles_closed;
00190 private: bool paddles_moving;
00191 private: bool paddles_error;
00192 private: bool lift_up;
00193 private: bool lift_down;
00194 private: bool lift_moving;
00195 private: bool lift_error;
00196
00197
00198 private: unsigned char state;
00199 private: unsigned char beams;
00200
00201 private: GripperMode gripperMode;
00202 private: LiftMode liftMode;
00203
00204 private: bool isGripping;
00205
00206
00207 private: Body *body;
00208 private: Body *baseBarBody;
00209 private: Body *leftGripperBody;
00210 private: Body *rightGripperBody;
00211
00212 private: Geom *fixedBarGeom;
00213 private: Geom *baseBarGeom;
00214 private: Geom *leftGripGeom;
00215 private: Geom *rightGripGeom;
00216 private: Geom *leftPressureSensorGeom;
00217 private: Geom *rightPressureSensorGeom;
00218
00219 private: RayProximity *innerBreakbeam;
00220 private: RayProximity *outerBreakbeam;
00221
00222 private: SliderJoint *leftGripperJoint;
00223 private: SliderJoint *rightGripperJoint;
00224 private: SliderJoint *baseJoint;
00225
00226 private: dSpaceID leftGripSpaceId;
00227 private: dSpaceID rightGripSpaceId;
00228
00229
00230 private: gz_gripper_t *gripper_iface;
00231
00232 };
00233
00234 #endif