Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

angularmotor_c.cpp

Go to the documentation of this file.
00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
00002 
00003    this file is part of rcssserver3D
00004    Fri May 9 2003
00005    Copyright (C) 2002,2003 Koblenz University
00006    Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group
00007    $Id: angularmotor_c.cpp,v 1.1 2004/04/20 14:11:30 rollmark Exp $
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; version 2 of the License.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021 */
00022 #include "angularmotor.h"
00023 
00024 using namespace boost;
00025 using namespace oxygen;
00026 using namespace salt;
00027 
00028 FUNCTION(AngularMotor,setUserMode)
00029 {
00030     obj->SetMode(AngularMotor::MM_USER);
00031     return true;
00032 }
00033 
00034 FUNCTION(AngularMotor,setEulerMode)
00035 {
00036     obj->SetMode(AngularMotor::MM_EULER);
00037     return true;
00038 }
00039 
00040 FUNCTION(AngularMotor,getMode)
00041 {
00042     return static_cast<int>(obj->GetMode());
00043 }
00044 
00045 FUNCTION(AngularMotor,setNumAxes)
00046 {
00047     int inNum;
00048 
00049     if (
00050         (in.GetSize() != 1) ||
00051         (! in.GetValue(in[0], inNum))
00052          )
00053     {
00054         return false;
00055     }
00056 
00057     obj->SetNumAxes(inNum);
00058     return true;
00059 }
00060 
00061 FUNCTION(AngularMotor,getNumAxes)
00062 {
00063     return obj->GetNumAxes();
00064 }
00065 
00066 FUNCTION(AngularMotor,setMotorAxis)
00067 {
00068     int inAxisIdx;
00069     // 0 global, 1 first body, 2 second body
00070     int inAxisAnchor;
00071     Vector3f inAxis;
00072 
00073     if (
00074         (in.GetSize() < 3) ||
00075         (! in.GetValue(in[0],inAxisIdx)) ||
00076         (! in.GetValue(in[1],inAxisAnchor)) ||
00077         (! in.GetValue(in[2],inAxis))
00078         )
00079         {
00080             return false;
00081         }
00082 
00083     obj->SetMotorAxis(static_cast<Joint::EAxisIndex>(inAxisIdx),
00084                       static_cast<AngularMotor::EAxisAnchor>(inAxisAnchor),
00085                       inAxis);
00086     return true;
00087 }
00088 
00089 FUNCTION(AngularMotor,getAxisAnchor)
00090 {
00091     int inAxisIdx;
00092 
00093     if (
00094         (in.GetSize() != 1) ||
00095         (! in.GetValue(in.begin(),inAxisIdx))
00096         )
00097     {
00098         return 0;
00099     }
00100 
00101     return obj->GetAxisAnchor(static_cast<Joint::EAxisIndex>(inAxisIdx));
00102 }
00103 
00104 FUNCTION(AngularMotor,setAxisAngle)
00105 {
00106     int inAxisIdx;
00107     int inDegAngle;
00108 
00109     if (
00110         (in.GetSize() != 2) ||
00111         (! in.GetValue(in[0], inAxisIdx)) ||
00112         (! in.GetValue(in[1], inDegAngle))
00113         )
00114         {
00115             return false;
00116         }
00117 
00118     obj->SetAxisAngle(static_cast<Joint::EAxisIndex>(inAxisIdx),inDegAngle);
00119     return true;
00120 }
00121 
00122 FUNCTION(AngularMotor, getAxisAngle)
00123 {
00124     int inAxisIdx;
00125 
00126     if (
00127         (in.GetSize() != 1) ||
00128         (! in.GetValue(in.begin(), inAxisIdx))
00129         )
00130         {
00131             return 0;
00132         }
00133 
00134     return obj->GetAxisAngle(static_cast<Joint::EAxisIndex>(inAxisIdx));
00135 }
00136 
00137 FUNCTION(AngularMotor,getAxisAngleRate)
00138 {
00139     int inAxisIdx;
00140 
00141     if (
00142         (in.GetSize() != 1) ||
00143         (! in.GetValue(in.begin(), inAxisIdx))
00144         )
00145         {
00146             return 0;
00147         }
00148 
00149     return obj->GetAxisAngleRate(static_cast<Joint::EAxisIndex>(inAxisIdx));
00150 }
00151 
00152 void CLASS(AngularMotor)::DefineClass()
00153 {
00154     DEFINE_BASECLASS(oxygen/Joint);
00155     DEFINE_FUNCTION(setUserMode);
00156     DEFINE_FUNCTION(setEulerMode);
00157     DEFINE_FUNCTION(getMode);
00158     DEFINE_FUNCTION(setNumAxes);
00159     DEFINE_FUNCTION(getNumAxes);
00160     DEFINE_FUNCTION(setMotorAxis);
00161     DEFINE_FUNCTION(getAxisAnchor);
00162     DEFINE_FUNCTION(setAxisAngle);
00163     DEFINE_FUNCTION(getAxisAngle);
00164     DEFINE_FUNCTION(getAxisAngleRate);
00165 }

Generated on Thu Apr 6 15:25:37 2006 for rcssserver3d by  doxygen 1.4.4