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 : Streamable(other)
    00067 {
    00068   *this = other;
    00069 }
    00070
    00071 JointData::JointID JointData::getIDFromName(const char* jointName)
    00072 {
    00073   if(strcmp(jointName, "headTilt210") == 0 || strcmp(jointName, "neckTilt") == 0)
    00074     return neckTilt;
    00075   else if(strcmp(jointName, "headRoll210") == 0 || strcmp(jointName, "headTilt") == 0)
    00076     return headTilt;
    00077   else
    00078   {
    00079     for (int i=0;i<JointData::numOfJoint;i++)
    00080       if (strcmp(jointName,getJointName((JointID)i))==0)
    00081         return (JointID)i;
    00082     return numOfJoint;
    00083   }
    00084 }
    00085 /*
    00086 In& operator>>(In& stream,JointData& jointData)
    00087 {
    00088   stream.read(jointData.data,sizeof(jointData.data));
    00089   return stream;
    00090 }
    00091
    00092 Out& operator<<(Out& stream, const JointData& jointData)
    00093 {
    00094   stream.write(jointData.data,sizeof(jointData.data));
    00095   return stream;
    00096 }
    00097 */