00001 /** 00002 * @file CollisionPercept.h 00003 * 00004 * Declaration of class CollisionPercept 00005 * 00006 * @author <a href="mailto:goehring@informatik.hu-berlin.de">Daniel Goehring</a> 00007 */ 00008 00009 #ifndef __CollisionPercept_h_ 00010 #define __CollisionPercept_h_ 00011 00012 #include "Tools/Streams/InOut.h" 00013 #include "Representations/Motion/JointData.h" 00014 00015 00016 /** 00017 * Contains detected collisions for each joint. 00018 */ 00019 class CollisionPercept 00020 { 00021 public: 00022 /** Constructor */ 00023 CollisionPercept(); 00024 00025 /** Reset all states */ 00026 void reset(); 00027 00028 /** Destructor */ 00029 ~CollisionPercept(); 00030 00031 double state[JointData::numOfJoint]; 00032 00033 /** Did collision occur at front left leg */ 00034 bool getCollisionFrontLeft() const; 00035 00036 /** Did collision occur at front right leg */ 00037 bool getCollisionFrontRight() const; 00038 00039 /** Did collision occur at hind left leg */ 00040 bool getCollisionHindLeft() const; 00041 00042 /** Did collision occur at hind left leg */ 00043 bool getCollisionHindRight() const; 00044 00045 /** Did collision occur at head */ 00046 bool getCollisionHead() const; 00047 00048 /** Did collision occur at any body part */ 00049 bool getCollisionAggregate() const; 00050 00051 /** the last perceived frame */ 00052 unsigned long frameNumber; 00053 00054 /** sets frame number */ 00055 void setFrameNumber(unsigned long frameNumber) {this->frameNumber = frameNumber;} 00056 00057 }; 00058 /** 00059 * Streaming operator that reads a joint state from a stream. 00060 * @param stream The stream from which is read. 00061 * @param CollisionPercept The CollisionPercept. 00062 * @return The stream. 00063 */ 00064 In& operator>>(In& stream, CollisionPercept& CollisionPercept); 00065 00066 /** 00067 * Streaming operator that writes a joint state to a stream. 00068 * @param stream The stream to write on. 00069 * @param CollisionPercept The CollisionPercept object. 00070 * @return The stream. 00071 */ 00072 Out& operator<<(Out& stream, const CollisionPercept& CollisionPercept); 00073 00074 #endif //__CollisionPercept_h_ 00075 00076 /* 00077 * Change log : 00078 * 00079 * $Log: CollisionPercept.h,v $ 00080 * Revision 1.2 2004/06/23 11:02:26 goehring 00081 * Xabsl symbol collision-side added 00082 * 00083 * Revision 1.1.1.1 2004/05/22 17:25:44 cvsadm 00084 * created new repository GT2004_WM 00085 * 00086 * Revision 1.3 2004/01/19 14:53:46 dueffert 00087 * all frameNumbers (and not only some of them) are unsigned long now 00088 * 00089 * Revision 1.2 2003/11/14 19:02:25 goehring 00090 * frameNumber added 00091 * 00092 * Revision 1.1 2003/10/07 10:09:36 cvsadm 00093 * Created GT2004 (M.J.) 00094 * 00095 * Revision 1.1 2003/09/26 21:23:20 loetzsch 00096 * renamed class JointState to CollisionPercept 00097 * 00098 * Revision 1.2 2003/09/26 15:27:27 juengel 00099 * Renamed DataTypes to representations. 00100 * 00101 * Revision 1.1.1.1 2003/07/02 09:40:22 cvsadm 00102 * created new repository for the competitions in Padova from the 00103 * tamara CVS (Tuesday 2:00 pm) 00104 * 00105 * removed unused solutions 00106 * 00107 * Revision 1.4 2003/06/10 15:06:06 goehring 00108 * Xabsl symbol functions added 00109 * 00110 * Revision 1.3 2003/06/09 12:32:34 goehring 00111 * Added reset function 00112 * 00113 * Revision 1.2 2003/06/02 11:29:16 goehring 00114 * Review 00115 * 00116 * Revision 1.1 2003/04/25 19:49:28 goehring 00117 * Added CollisionPercept 00118 * 00119 */