musclepair.h
1 /********************************************************************************
2  * FARSA Experimentes Library *
3  * Copyright (C) 2007-2012 *
4  * Gianluca Massera <emmegian@yahoo.it> *
5  * Stefano Nolfi <stefano.nolfi@istc.cnr.it> *
6  * Tomassino Ferrauto <tomassino.ferrauto@istc.cnr.it> *
7  * Onofrio Gigliotta <onofrio.gigliotta@istc.cnr.it> *
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  * This program is distributed in the hope that it will be useful, *
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17  * GNU General Public License for more details. *
18  * *
19  * You should have received a copy of the GNU General Public License *
20  * along with this program; if not, write to the Free Software *
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
22  ********************************************************************************/
23 
24 #ifndef MUSCLEPAIR_H
25 #define MUSCLEPAIR_H
26 
27 #include "experimentsconfig.h"
28 
29 namespace farsa {
30 
31 class PhyDOF;
32 
41 class FARSA_EXPERIMENTS_API MusclePair {
42 public:
52  MusclePair( PhyDOF* dof, float ksh, float tmax, float rl, float lmax );
54  virtual ~MusclePair() { /*Nothing to do*/ };
56  void setRestLength( float rl );
58  float getRestLength();
60  void setMaxTension( float tmax );
62  float getMaxTension( );
64  void setMaxLength( float lmax );
66  float getMaxLength();
70  float getMinLength();
74  float getAsh( );
77  void setAsh( float newash );
81  void setKsh( float ksh, float reduceFactor = 1.0 );
83  float getKsh( );
85  void setViscosity( float b );
87  float getViscosity( );
89  void setActivation( float act1, float act2 );
91  void getActivation( float& act1, float& act2 );
93  void getExtension( float& l1, float& l2 );
95  void getActiveForces( float& ta1, float& ta2 ) {
96  ta1 = tal1;
97  ta2 = tal2;
98  };
102  float apply();
103 private:
105  PhyDOF* dof;
107  float ash;
109  float ksh;
111  float reduceKsh;
113  float b;
115  float tmax;
117  float rl;
119  float lmax;
121  float lmin;
123  float act1;
125  float act2;
127  float last_x1;
129  float last_x2;
131  float dx1;
133  float dx2;
135  float tal1, tal2;
136 };
137 
138 } //end namespace farsa
139 
140 #endif
141