NTRT Simulator  Version: Master
 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  bool moveCPA = true,
69  bool moveCPB = true);
70 
76  void scale (double sf);
77 
78  // Muscle2P Parameters
86  double stiffness;
92  double damping;
93 
100  double pretension;
101 
102  // History Parameters
107  bool hist;
108 
109  // Motor model parameters
123  double maxTens;
124 
131 
138 
145 
146  // Construction Parameters
153  double rotation;
154 
177  bool moveCablePointBToEdge;
178 
179  };
180 
183  {
185  std::deque<double> lastLengths;
186 
188  std::deque<double> restLengths;
189 
191  std::deque<double> dampingHistory;
192 
194  std::deque<double> lastVelocities;
195 
197  std::deque<double> tensionHistory;
198  };
199 
201  virtual ~tgSpringCableActuator();
202 
204  virtual void setup(tgWorld& world);
205 
207  virtual void teardown();
208 
210  virtual void step(double dt);
211 
220  virtual const double getStartLength() const;
221 
225  virtual const double getCurrentLength() const;
226 
231  virtual const double getTension() const;
232 
236  virtual const double getRestLength() const;
237 
243  virtual const double getVelocity() const;
244 
249 
255  {
256  return m_springCable;
257  }
258 
263  const Config& getConfig() const
264  {
265  return m_config;
266  }
267 
268 protected:
269 
275  const tgTags& tags,
277 
278 protected:
281 
287 
290 
291 
301  double m_restLength;
302 
303 
309 
315 private:
316 
320  void constructorAux();
321 
323  bool invariant() const;
324 
325 
326 };
327 
328 
329 #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.
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, bool moveCPA=true, bool moveCPB=true)
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
virtual const double getCurrentLength() const
SpringCableActuatorHistory *const m_pHistory
Definition: tgTags.h:44
const tgSpringCable * getSpringCable() const