Homepage Demos Overview Downloads Tutorials Reference
Credits

utils.h

Go to the documentation of this file.
00001 /*
00002 ROBOOP -- A robotics object oriented package in C++
00003 Copyright (C) 1996-2004  Richard Gourdeau
00004 
00005 This library is free software; you can redistribute it and/or modify
00006 it under the terms of the GNU Lesser General Public License as
00007 published by the Free Software Foundation; either version 2.1 of the
00008 License, or (at your option) any later version.
00009 
00010 This library is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU Lesser General Public License for more details.
00014 
00015 You should have received a copy of the GNU Lesser General Public
00016 License along with this library; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 
00020 Report problems and direct all questions to:
00021 
00022 Richard Gourdeau
00023 Professeur Agrege
00024 Departement de genie electrique
00025 Ecole Polytechnique de Montreal
00026 C.P. 6079, Succ. Centre-Ville
00027 Montreal, Quebec, H3C 3A7
00028 
00029 email: richard.gourdeau@polymtl.ca
00030 
00031 -------------------------------------------------------------------------------
00032 Revision_history:
00033 
00034 2004/07/01: Etienne Lachance
00035    -Added doxygen documentation.
00036 
00037 2004/07/01: Ethan Tira-Thompson
00038     -Added support for newmat's use_namespace #define, using ROBOOP namespace
00039 -------------------------------------------------------------------------------
00040 */
00041 
00042 #ifndef __cplusplus
00043 #error Must use C++ for the type Robot
00044 #endif
00045 #ifndef UTILS_H
00046 #define UTILS_H
00047 
00048 /*!
00049   @file utils.h
00050   @brief Utility header file.
00051 */
00052 
00053 #ifndef __UNUSED__
00054 //!used to mark rcs strings as expected-to-be-unused so the compiler won't issue a warning
00055 #define __UNUSED__ __attribute__((unused))
00056 #endif
00057 
00058 #ifdef _MSC_VER                         // Microsoft
00059 #pragma warning (disable:4786)  /* Disable decorated name truncation warnings */
00060 #endif
00061 #include <stdio.h>
00062 #include <vector>
00063 #include <stdexcept>
00064 #define WANT_STRING                  /* include.h will get string fns */
00065 #define WANT_STREAM                  /* include.h will get stream fns */
00066 #define WANT_FSTREAM                 /* include.h will get fstream fns */
00067 #define WANT_MATH                    /* include.h will get math fns */
00068                                      /* newmatap.h will get include.h */
00069 
00070 #include "newmatap.h"                /* need matrix applications */
00071 
00072 #include "newmatio.h"                /* need matrix output routines */
00073 #include "config.h"
00074 
00075 #ifdef use_namespace
00076 namespace ROBOOP {
00077   using namespace NEWMAT;
00078 #endif
00079   //! @brief RCS/CVS version.
00080   static const char header_utils_rcsid[] __UNUSED__ = "$Id: utils.h,v 1.5 2005/07/26 03:22:09 ejt Exp $"; 
00081   
00082 #ifndef __WATCOMC__
00083 using namespace std;
00084 #endif
00085 
00086 #ifndef M_PI
00087 #define M_PI 3.14159265358979
00088 #endif
00089 
00090 // global variables
00091 
00092 extern Real fourbyfourident[];
00093 extern Real threebythreeident[];
00094 
00095 // vector operation 
00096 
00097 ReturnMatrix x_prod_matrix(const ColumnVector & x);
00098 
00099 // numerical analysis tools
00100 
00101 ReturnMatrix Integ_Trap(const ColumnVector & present, ColumnVector & past, const Real dt);
00102 
00103 void Runge_Kutta4(ReturnMatrix (*xdot)(Real time, const Matrix & xin),
00104                   const Matrix & xo, Real to, Real tf, int nsteps,
00105                   RowVector & tout, Matrix & xout);
00106 
00107 void Runge_Kutta4_Real_time(ReturnMatrix (*xdot)(Real time, const Matrix & xin),
00108                             const Matrix & xo, Real to, Real tf, int nsteps);
00109 
00110 void Runge_Kutta4_Real_time(ReturnMatrix (*xdot)(Real time, const Matrix & xin,
00111                             bool & exit, bool & init),
00112                             const Matrix & xo, Real to, Real tf, int nsteps);
00113 
00114 void odeint(ReturnMatrix (*xdot)(Real time, const Matrix & xin),
00115             Matrix & xo, Real to, Real tf, Real eps, Real h1, Real hmin,
00116             int & nok, int & nbad,
00117             RowVector & tout, Matrix & xout, Real dtsav);
00118 
00119 ReturnMatrix sign(const Matrix & x);
00120 
00121 short sign(const Real x);
00122 
00123 // translation 
00124 ReturnMatrix trans(const ColumnVector & a);
00125 
00126 // rotation matrices 
00127 ReturnMatrix rotx(const Real alpha);
00128 ReturnMatrix roty(const Real beta);
00129 ReturnMatrix rotz(const Real gamma);
00130 ReturnMatrix rotk(const Real theta, const ColumnVector & k);
00131 
00132 ReturnMatrix rpy(const ColumnVector & a);
00133 ReturnMatrix eulzxz(const ColumnVector & a);
00134 ReturnMatrix rotd(const Real theta, const ColumnVector & k1, const ColumnVector & k2);
00135 
00136 
00137 // inverse on rotation matrices 
00138 ReturnMatrix irotk(const Matrix & R);
00139 ReturnMatrix irpy(const Matrix & R);
00140 ReturnMatrix ieulzxz(const Matrix & R);
00141 
00142 #ifdef use_namespace
00143 }
00144 #endif
00145 
00146 #endif
00147 
00148 
00149 
00150 
00151 
00152 
00153 
00154 
00155 
00156 
00157 
00158 
00159 
00160 
00161 
00162 

ROBOOP v1.21a
Generated Tue Aug 16 16:32:15 2005 by Doxygen 1.4.4