📄 gripperrobot.h
字号:
/* YAKS, a Khepera simulator including a separate GA and ANN (Genetic Algoritm, Artificial Neural Net). Copyright (C) 2000 Johan Carlsson (johanc@ida.his.se) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#ifndef GRIPPERROBOT_H#define GRIPPERROBOT_H#include "sobst.h"#include "obst.h"#include "robot.h"#include "geom.h"/** Describes different event that can occur for the gripper */enum GripperEvent{ /** Object present */ GE_OBJ_PRESENT, /** Gripper crash */ GE_OBJ_CRASH, /** Object picked up */ GE_OBJ_PICKED_UP, /** Robot carries object */ GE_OBJ_CARRY, /** Gripper releases object */ GE_OBJ_RELEASE, /** No operation */ GE_NOP};/** * @class GripperRobot gripperrobot.h * @brief Implements a robot with a mounted gripper arm. * */class GripperRobot : public Robot{ public: GripperRobot(); ~GripperRobot(); int checkCrash(float x1, float y1, float x2, float y2); int checkCrash(Obst *obj); int setGripperPosition(double val); void setArmPosition(double val); int isaGripperRobot(); void resetRobot(); double getObjectSensed() const; int holdingSomething() const; double readPosition(int device) const; /* where 0 = gripper, 1 = arm */ void updateGripperCords(); int armDown() const; void clrGripperSensor(); void armCrashed(); void clearCrashed(); int getCrashed()const; int handsClosed() const; void getSane(); void updateThingInHandsCoord(); void setThingInHands(Sobst *thing, int index); void releaseThingInHands(); void recallState(); GripperEvent inHands(class Sobst *); /* Gripper cordinates and values, shame on me... they are all PUBLIC !!! */ /** arm position */ float p_arm; /** gripper position */ float p_gripper; /** the object that is gripped */ int ob_taken; /** an object is between the gripper hands */ float ob_sensed; // double ldist,rdist,fdist; /* dist of the object in the hand */ /** Coordinates of the left and right hand. */ float lgripper[4],rgripper[4]; float flx,fly; float frx,fry; /** Arm position [0.0 .. 1.0] */ double arm_pos; /** Gripper center */ double gx,gy; double ldirection; double rdirection; // double ob_fitness; float fdeltax,fdeltay; float headx,heady; private: /** Arm chrashed */ int crashed; /** Thing that robot is holding */ Sobst *thingInHands;};#endif /* GRIPPERROBOT_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -