Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Representations/Motion/JointData.cpp

Go to the documentation of this file.
00001 /**
00002 * @file JointData.cpp
00003 *
00004 * Implementation of class JointData
00005 * 
00006 * @author Martin Lötzsch
00007 * @author Max Risler
00008 */
00009 
00010 #include "JointData.h"
00011 #include <string.h>
00012 
00013 JointData::JointData(
00014     long neckTiltValue,
00015     long headPanValue,
00016     long headTiltValue,
00017     long mouthValue,
00018     long earLValue, 
00019     long earRValue,
00020     long legFR1Value,
00021     long legFR2Value,
00022     long legFR3Value,
00023     long legFL1Value,
00024     long legFL2Value,
00025     long legFL3Value,
00026     long legHR1Value,
00027     long legHR2Value,
00028     long legHR3Value,
00029     long legHL1Value,
00030     long legHL2Value,
00031     long legHL3Value,
00032     long tailPanValue,
00033     long tailTiltValue
00034   )
00035 {
00036   data[neckTilt] = neckTiltValue;
00037   data[headPan] = headPanValue;
00038   data[headTilt] = headTiltValue;
00039   data[mouth] = mouthValue;
00040   data[earL] = earLValue; 
00041   data[earR] = earRValue;
00042   data[legFR1] = legFR1Value;
00043   data[legFR2] = legFR2Value;
00044   data[legFR3] = legFR3Value;
00045   data[legFL1] = legFL1Value;
00046   data[legFL2] = legFL2Value;
00047   data[legFL3] = legFL3Value;
00048   data[legHR1] = legHR1Value;
00049   data[legHR2] = legHR2Value;
00050   data[legHR3] = legHR3Value;
00051   data[legHL1] = legHL1Value;
00052   data[legHL2] = legHL2Value;
00053   data[legHL3] = legHL3Value;
00054   data[tailPan] = tailPanValue;
00055   data[tailTilt] = tailTiltValue;
00056 }
00057 
00058 JointData& JointData::operator=(const JointData& other)
00059 {
00060   for (int i = 0; i < numOfJoint; i++)
00061     data[i] = other.data[i];
00062   return *this;
00063 }
00064 
00065 JointData::JointData(const JointData& other)
00066 {
00067   *this = other;
00068 }
00069 
00070 JointData::JointID JointData::getIDFromName(const char* jointName)
00071 {
00072   if(strcmp(jointName, "headTilt210") == 0 || strcmp(jointName, "neckTilt") == 0)
00073     return neckTilt;
00074   else if(strcmp(jointName, "headRoll210") == 0 || strcmp(jointName, "headTilt") == 0)
00075     return headTilt;
00076   else
00077   {
00078     for (int i=0;i<JointData::numOfJoint;i++)
00079       if (strcmp(jointName,getJointName((JointID)i))==0)
00080         return (JointID)i;
00081     return numOfJoint;
00082   }
00083 }
00084 
00085 In& operator>>(In& stream,JointData& jointData)
00086 {
00087   stream.read(jointData.data,sizeof(jointData.data));
00088   return stream;
00089 }
00090  
00091 Out& operator<<(Out& stream, const JointData& jointData)
00092 {
00093   stream.write(jointData.data,sizeof(jointData.data));
00094   return stream;
00095 }
00096 
00097 /*
00098  * Change log :
00099  * 
00100  * $Log: JointData.cpp,v $
00101  * Revision 1.2  2004/05/27 17:13:37  jhoffman
00102  * - renaming: tilt1 -> neckTilt,  pan -> headPan,  tilt2 -> headTilt
00103  * - clipping included for setJoints
00104  * - removed some microrad/rad-bugs
00105  * - bodyPosture constructor and "=" operator fixed
00106  *
00107  * Revision 1.1.1.1  2004/05/22 17:25:17  cvsadm
00108  * created new repository GT2004_WM
00109  *
00110  * Revision 1.4  2004/02/02 13:01:08  dueffert
00111  * GreenHills compatibility restored
00112  *
00113  * Revision 1.3  2003/12/31 16:58:44  roefer
00114  * Joints and LEDs for ERS-7
00115  *
00116  * Revision 1.2  2003/12/16 18:52:55  loetzsch
00117  * added a function for retrieving the id for as string.
00118  *
00119  * Revision 1.1  2003/10/07 10:07:01  cvsadm
00120  * Created GT2004 (M.J.)
00121  *
00122  * Revision 1.1.1.1  2003/07/02 09:40:22  cvsadm
00123  * created new repository for the competitions in Padova from the 
00124  * tamara CVS (Tuesday 2:00 pm)
00125  *
00126  * removed unused solutions
00127  *
00128  * Revision 1.1  2002/09/10 15:26:40  cvsadm
00129  * Created new project GT2003 (M.L.)
00130  * - Cleaned up the /Src/DataTypes directory
00131  * - Removed Challenge Code
00132  * - Removed processing of incoming audio data
00133  * - Renamed AcousticMessage to SoundRequest
00134  *
00135  * Revision 1.1.1.1  2002/05/10 12:40:13  cvsadm
00136  * Moved GT2002 Project from ute to tamara.
00137  *
00138  * Revision 1.4  2002/02/21 18:02:13  risler
00139  * now thats a constructor
00140  *
00141  * Revision 1.3  2001/12/10 17:47:05  risler
00142  * change log added
00143  *
00144  */

Generated on Thu Sep 23 19:57:35 2004 for GT2004 by doxygen 1.3.6