NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgStairs.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014, 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_STAIRS
20 #define TG_STAIRS
21 
31 // This library
32 #include "core/tgModel.h"
33 // The Bullet Physics Library
34 #include "LinearMath/btVector3.h"
35 // The C++ Standard Library
36 #include <vector>
37 
38 // Forward declarations
39 class tgModelVisitor;
40 class tgStructure;
41 class tgWorld;
42 
47 class tgStairs : public tgModel
48 {
49 public:
50 
51  struct Config
52  {
53  public:
54  Config(btVector3 origin = btVector3(0.0, 0.0, 0.0),
55  btScalar friction = 0.5,
56  btScalar restitution = 0.0,
57  size_t nStairs = 10,
58  double stairWidth = 20.0,
59  double stepWidth = 5.0,
60  double stepHeight = 1.0,
61  double angle = 0.0);
62 
64  btVector3 m_origin;
65 
67  btScalar m_friction;
68 
70  btScalar m_restitution;
71 
73  size_t m_nBlocks;
74 
76  double m_length;
77 
79  double m_width;
80 
82  double m_height;
83 
85  double m_angle;
86  };
87 
91  tgStairs();
92 
97  tgStairs(tgStairs::Config& config);
98 
103  virtual ~tgStairs();
104 
109  virtual void setup(tgWorld& world);
110 
115  virtual void step(double dt);
116 
124  virtual void onVisit(tgModelVisitor& r);
125 
130  void teardown();
131 
132 private:
133 
140  void addNodes(tgStructure& s);
141 
142  tgStairs::Config m_config;
143 
144 };
145 
146 #endif // TETRA_COLLISIONS_WALL
btScalar m_restitution
Definition: tgStairs.h:70
tgStairs()
Definition: tgStairs.cpp:66
virtual ~tgStairs()
Definition: tgStairs.cpp:78
double m_width
Definition: tgStairs.h:79
btVector3 m_origin
Definition: tgStairs.h:64
void teardown()
Definition: tgStairs.cpp:116
double m_angle
Definition: tgStairs.h:85
Contains the definition of class tgModel.
virtual void onVisit(tgModelVisitor &r)
Definition: tgStairs.cpp:112
size_t m_nBlocks
Definition: tgStairs.h:73
double m_length
Definition: tgStairs.h:76
double m_height
Definition: tgStairs.h:82
btScalar m_friction
Definition: tgStairs.h:67
virtual void step(double dt)
Definition: tgStairs.cpp:102
virtual void setup(tgWorld &world)
Definition: tgStairs.cpp:80