NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgCompressionSpringActuator.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_COMPRESSION_SPRING_ACTUATOR_H
20 #define SRC_CORE_TG_COMPRESSION_SPRING_ACTUATOR_H
21 
33 // This application
34 #include "tgModel.h"
35 #include "tgControllable.h"
36 #include "tgSubject.h"
37 
38 // for history logging
39 #include <deque>
40 
41 // Forward declarations
43 class tgModelVisitor;
44 class tgWorld;
45 
52 // This class needs to be a child model of a tgModel.
54  public tgSubject<tgCompressionSpringActuator>
55 {
56 public:
57 
63  struct Config
64  {
65  public:
66 
70  Config(
71  bool iFEA = false,
72  double s = 1000.0,
73  double d = 10.0,
74  double rL = 0.0,
75  bool moveCPA = true,
76  bool moveCPB = true);
77 
91 
98  double stiffness;
99 
105  double damping;
106 
112  double restLength;
113 
136  bool moveCablePointBToEdge;
137 
138  };
139 
149  const tgTags& tags,
151 
156 
161  virtual void setup(tgWorld& world);
162 
166  virtual void teardown();
167 
174  virtual void step(double dt);
175 
182  virtual void onVisit(const tgModelVisitor& r) const;
183 
196  //virtual const double getStartDistance() const;
197 
205  //virtual const double getCurrentDistance() const;
206 
210  //virtual const double getRestLength() const;
211 
217  virtual double getActuatorSpringForce();
218 
224  {
225  return m_compressionSpring;
226  }
227 
237  virtual void setControlInput(double input);
238 
243  virtual void setControlInput(double input, double dt);
244 
245 protected:
246 
251 
257 
258 private:
259 
263  void constructorAux();
264 
266  bool invariant() const;
267 
274  double m_prevVelocity;
275 
276 };
277 
278 
279 #endif
Config(bool iFEA=false, double s=1000.0, double d=10.0, double rL=0.0, bool moveCPA=true, bool moveCPB=true)
virtual void setup(tgWorld &world)
tgBulletCompressionSpring * m_compressionSpring
Definition of tgSubject class.
tgCompressionSpringActuator(tgBulletCompressionSpring *compressionSpring, const tgTags &tags, tgCompressionSpringActuator::Config &config)
Contains the definition of class tgModel.
Definition of the tgControllable abstract base class.
virtual void onVisit(const tgModelVisitor &r) const
virtual void setControlInput(double input)
virtual const tgBulletCompressionSpring * getCompressionSpring() const
Definition: tgTags.h:44