NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgBulletUnidirComprSpr.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_BULLET_UNIDIR_COMPR_SPR_H_
20 #define SRC_CORE_TG_BULLET_UNIDIR_COMPR_SPR_H_
21 
32 // The Bullet Physics library
33 #include "LinearMath/btVector3.h"
34 // The C++ Standard Library
35 #include <vector>
36 
37 // This class inherits from tgBulletCompressionSpring
39 
40 // Forward references
41 // Note that even though this object is not a tgSpringCable,
42 // we're still using tgSpringCableAnchor as a convenience.
43 // This works because there actually don't seem to be any references
44 // to tgSpringCable in tgSpringCableAnchor or tgBulletSpringCableAnchor.
45 class btRigidBody;
48 
61 {
62 public:
89  const std::vector<tgBulletSpringCableAnchor*>& anchors,
90  bool isFreeEndAttached,
91  double coefK,
92  double coefD,
93  double restLength,
94  btVector3 * direction);
95 
100  virtual ~tgBulletUnidirComprSpr();
101 
106  virtual void step(double dt);
107 
113  virtual const double getCurrentAnchorDistanceAlongDirection() const;
114 
119  virtual const double getCurrentSpringLength() const;
120 
126  virtual const btVector3 getSpringEndpoint() const;
127 
133  virtual const double getSpringForce() const;
134 
138  virtual const btVector3 * getDirection() const
139  {
140  return m_direction;
141  }
142 
143 protected:
144 
149  btVector3 * m_direction;
150 
157  virtual void calculateAndApplyForce(double dt);
158 
159 private:
161  bool invariant(void) const;
162 };
163 
164 #endif // SRC_CORE_TG_BULLET_UNIDIR_COMPR_SPR_H_
virtual const btVector3 getSpringEndpoint() const
virtual void calculateAndApplyForce(double dt)
virtual const bool isFreeEndAttached() const
virtual const double getCurrentAnchorDistanceAlongDirection() const
tgBulletUnidirComprSpr(const std::vector< tgBulletSpringCableAnchor * > &anchors, bool isFreeEndAttached, double coefK, double coefD, double restLength, btVector3 *direction)
virtual const double getCurrentSpringLength() const
virtual const double getSpringForce() const
Definitions of class tgBulletCompressionSpring.
virtual void step(double dt)
virtual const btVector3 * getDirection() const