NTRT Simulator  v1.1
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgSpringCableActuator.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012, United States Government, as represented by the
3  * Administrator of the National Aeronautics and Space Administration.
4  * All rights reserved.
5  *
6  * The NASA Tensegrity Robotics Toolkit (NTRT) v1 platform is licensed
7  * under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * http://www.apache.org/licenses/LICENSE-2.0.
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15  * either express or implied. See the License for the specific language
16  * governing permissions and limitations under the License.
17 */
18 
19 #ifndef SRC_CORE_TG_SPRING_CABLE_ACTUATOR_H
20 #define SRC_CORE_TG_SPRING_CABLE_ACTUATOR_H
21 
30 // This application
31 #include "tgModel.h"
32 #include "tgControllable.h"
33 #include "tgSubject.h"
34 
35 #include <deque> // For history
36 // Forward declarations
37 class tgWorld;
38 class tgSpringCable;
39 
45 // Should always be a child Model of a tgModel
47  public tgSubject<tgSpringCableActuator>
48 {
49 public:
50 
51  struct Config
52  {
53  public:
59  Config( double s = 1000.0,
60  double d = 10.0,
61  double p = 0.0,
62  bool h = false,
63  double mf = 1000.0,
64  double tVel = 100.0,
65  double mnAL = 0.1,
66  double mnRL = 0.1,
67  double rot = 0);
68 
74  void scale (double sf);
75 
76  // Muscle2P Parameters
84  double stiffness;
90  double damping;
91 
98  double pretension;
99 
100  // History Parameters
105  bool hist;
106 
107  // Motor model parameters
121  double maxTens;
122 
129 
136 
143 
144  // Construction Parameters
151  double rotation;
152  };
153 
156  {
158  std::deque<double> lastLengths;
159 
161  std::deque<double> restLengths;
162 
164  std::deque<double> dampingHistory;
165 
167  std::deque<double> lastVelocities;
168 
170  std::deque<double> tensionHistory;
171  };
172 
174  virtual ~tgSpringCableActuator();
175 
177  virtual void setup(tgWorld& world);
178 
180  virtual void teardown();
181 
183  virtual void step(double dt);
184 
193  virtual const double getStartLength() const;
194 
198  virtual const double getCurrentLength() const;
199 
204  virtual const double getTension() const;
205 
209  virtual const double getRestLength() const;
210 
216  virtual const double getVelocity() const;
217 
222 
228  {
229  return m_springCable;
230  }
231 
236  const Config& getConfig() const
237  {
238  return m_config;
239  }
240 
241 protected:
242 
248  const tgTags& tags,
250 
251 protected:
254 
260 
263 
264 
274  double m_restLength;
275 
276 
282 
288 private:
289 
293  void constructorAux();
294 
296  bool invariant() const;
297 
298 
299 };
300 
301 
302 #endif // SRC_CORE_TG_SPRING_CABLE_ACTUATOR_H
virtual const double getTension() const
virtual void setup(tgWorld &world)
virtual const double getStartLength() const
Definition of tgSubject class.
Contains the definition of class tgModel.
Definition of the tgControllable abstract base class.
virtual const tgSpringCableActuator::SpringCableActuatorHistory & getHistory() const
tgSpringCableActuator(tgSpringCable *springCable, const tgTags &tags, tgSpringCableActuator::Config &config)
virtual const double getVelocity() const
const Config & getConfig() const
virtual void step(double dt)
virtual const double getRestLength() const
Config(double s=1000.0, double d=10.0, double p=0.0, bool h=false, double mf=1000.0, double tVel=100.0, double mnAL=0.1, double mnRL=0.1, double rot=0)
virtual const double getCurrentLength() const
SpringCableActuatorHistory *const m_pHistory
Definition: tgTags.h:44
const tgSpringCable * getSpringCable() const