NTRT Simulator
 All Classes Files Functions Variables Typedefs Friends Pages
tgRod.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 TG_ROD_H
20 #define TG_ROD_H
21 
28 // This application
29 #include "tgModel.h" // @todo: forward declare and move to tgRod.cpp (to be created)
30 // The Bullet Physics library
31 #include "LinearMath/btVector3.h"
32 // The C++ Standard Library
33 #include <vector>
34 
35 // Forward declarations
36 class btRigidBody;
37 
42 class tgRod : public tgModel
43 {
44 public:
45 
51  struct Config
52  {
58  Config(double r = 0.5,
59  double d = 1.0,
60  double f = 0.5,
61  double rf = 0.0,
62  double res = 0.0);
63 
65  const double radius;
66 
68  const double density;
69 
72  const double friction;
73 
76  const double rollFriction;
77 
80  const double restitution;
81  };
82 
83  tgRod(btRigidBody* pRigidBody,
84  const tgTags& tags,
85  const double length);
86 
88  virtual ~tgRod();
89 
90  virtual void teardown();
91 
92  virtual void onVisit(const tgModelVisitor& v) const;
93 
98  double mass() const { return m_mass; }
99 
104  double length() const { return m_length; }
105 
110  btVector3 centerOfMass() const;
111 
112 private:
113 
115  bool invariant() const;
116 
117 private:
118 
122  btRigidBody* m_pRigidBody;
123 
125  const double m_mass;
126 
128  const double m_length;
129 };
130 
131 #endif
Config(double r=0.5, double d=1.0, double f=0.5, double rf=0.0, double res=0.0)
Definition: tgRod.cpp:35
const double rollFriction
Definition: tgRod.h:76
const double density
Definition: tgRod.h:68
const double radius
Definition: tgRod.h:65
Contains the definition of class tgModel. $Id$.
double mass() const
Definition: tgRod.h:98
btVector3 centerOfMass() const
Definition: tgRod.cpp:97
double length() const
Definition: tgRod.h:104
virtual void teardown()
Definition: tgRod.cpp:87
const double friction
Definition: tgRod.h:72
const double restitution
Definition: tgRod.h:80
virtual ~tgRod()
Definition: tgRod.cpp:79
Definition: tgRod.h:42
Definition: tgTags.h:43
virtual void onVisit(const tgModelVisitor &v) const
Definition: tgRod.cpp:81