Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
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.6 2007/11/11 23:57:25 ejt Exp $"; 
00081   
00082 #ifndef M_PI
00083 #define M_PI 3.14159265358979
00084 #endif
00085 
00086 // global variables
00087 
00088 extern Real fourbyfourident[];
00089 extern Real threebythreeident[];
00090 
00091 // vector operation 
00092 
00093 ReturnMatrix x_prod_matrix(const ColumnVector & x);
00094 
00095 // numerical analysis tools
00096 
00097 ReturnMatrix Integ_Trap(const ColumnVector & present, ColumnVector & past, const Real dt);
00098 
00099 void Runge_Kutta4(ReturnMatrix (*xdot)(Real time, const Matrix & xin),
00100                   const Matrix & xo, Real to, Real tf, int nsteps,
00101                   RowVector & tout, Matrix & xout);
00102 
00103 void Runge_Kutta4_Real_time(ReturnMatrix (*xdot)(Real time, const Matrix & xin),
00104                             const Matrix & xo, Real to, Real tf, int nsteps);
00105 
00106 void Runge_Kutta4_Real_time(ReturnMatrix (*xdot)(Real time, const Matrix & xin,
00107                             bool & exit, bool & init),
00108                             const Matrix & xo, Real to, Real tf, int nsteps);
00109 
00110 void odeint(ReturnMatrix (*xdot)(Real time, const Matrix & xin),
00111             Matrix & xo, Real to, Real tf, Real eps, Real h1, Real hmin,
00112             int & nok, int & nbad,
00113             RowVector & tout, Matrix & xout, Real dtsav);
00114 
00115 ReturnMatrix sign(const Matrix & x);
00116 
00117 short sign(const Real x);
00118 
00119 // translation 
00120 ReturnMatrix trans(const ColumnVector & a);
00121 
00122 // rotation matrices 
00123 ReturnMatrix rotx(const Real alpha);
00124 ReturnMatrix roty(const Real beta);
00125 ReturnMatrix rotz(const Real gamma);
00126 ReturnMatrix rotk(const Real theta, const ColumnVector & k);
00127 
00128 ReturnMatrix rpy(const ColumnVector & a);
00129 ReturnMatrix eulzxz(const ColumnVector & a);
00130 ReturnMatrix rotd(const Real theta, const ColumnVector & k1, const ColumnVector & k2);
00131 
00132 
00133 // inverse on rotation matrices 
00134 ReturnMatrix irotk(const Matrix & R);
00135 ReturnMatrix irpy(const Matrix & R);
00136 ReturnMatrix ieulzxz(const Matrix & R);
00137 
00138 #ifdef use_namespace
00139 }
00140 #endif
00141 
00142 #endif
00143 
00144 
00145 
00146 
00147 
00148 
00149 
00150 
00151 
00152 
00153 
00154 
00155 
00156 
00157 
00158 

ROBOOP v1.21a
Generated Thu Nov 22 00:51:28 2007 by Doxygen 1.5.4