experiments/include/musclepair.h

00001 /********************************************************************************
00002  *  FARSA Experimentes Library                                                  *
00003  *  Copyright (C) 2007-2012                                                     *
00004  *  Gianluca Massera <emmegian@yahoo.it>                                        *
00005  *  Stefano Nolfi <stefano.nolfi@istc.cnr.it>                                   *
00006  *  Tomassino Ferrauto <tomassino.ferrauto@istc.cnr.it>                         *
00007  *  Onofrio Gigliotta <onofrio.gigliotta@istc.cnr.it>                           *
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; either version 2 of the License, or           *
00012  *  (at your option) any later version.                                         *
00013  *                                                                              *
00014  *  This program is distributed in the hope that it will be useful,             *
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of              *
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               *
00017  *  GNU General Public License for more details.                                *
00018  *                                                                              *
00019  *  You should have received a copy of the GNU General Public License           *
00020  *  along with this program; if not, write to the Free Software                 *
00021  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA  *
00022  ********************************************************************************/
00023 
00024 #ifndef MUSCLEPAIR_H
00025 #define MUSCLEPAIR_H
00026 
00027 #include "experimentsconfig.h"
00028 
00029 namespace farsa {
00030 
00031 class PhyDOF;
00032 
00041 class FARSA_EXPERIMENTS_API MusclePair {
00042 public:
00052     MusclePair( PhyDOF* dof, float ksh, float tmax, float rl, float lmax );
00054     virtual ~MusclePair() { /*Nothing to do*/ };
00056     void setRestLength( float rl );
00058     float getRestLength();
00060     void setMaxTension( float tmax );
00062     float getMaxTension( );
00064     void setMaxLength( float lmax );
00066     float getMaxLength();
00070     float getMinLength();
00074     float getAsh( );
00077     void setAsh( float newash );
00081     void setKsh( float ksh, float reduceFactor = 1.0 );
00083     float getKsh( );
00085     void setViscosity( float b );
00087     float getViscosity( );
00089     void setActivation( float act1, float act2 );
00091     void getActivation( float& act1, float& act2 );
00093     void getExtension( float& l1, float& l2 );
00095     void getActiveForces( float& ta1, float& ta2 ) {
00096         ta1 = tal1;
00097         ta2 = tal2;
00098     };
00102     float apply();
00103 private:
00105     PhyDOF* dof;
00107     float ash;
00109     float ksh;
00111     float reduceKsh;
00113     float b;
00115     float tmax;
00117     float rl;
00119     float lmax;
00121     float lmin;
00123     float act1;
00125     float act2;
00127     float last_x1;
00129     float last_x2;
00131     float dx1;
00133     float dx2;
00135     float tal1, tal2;
00136 };
00137 
00138 } //end namespace farsa
00139 
00140 #endif
00141