NTRT Simulator  v1.1
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgPrismatic.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_PRISMATIC_H
20 #define TG_PRISMATIC_H
21 
30 #include "core/tgModel.h"
31 #include "core/tgSubject.h"
32 
33 class tgWorld;
34 class btSliderConstraint;
35 
36 class tgPrismatic: public tgSubject<tgPrismatic>, public tgModel
37 {
38 public:
39 
40  struct Config
41  {
42  public:
43  // To make the complier happy. Probably should never be called
44  Config();
45 
46  Config(
47  double maxLength = 5, //todo: find better default
48  double minLength = 0.1, // todo: find better default
49  double maxMotorForce = 20,
50  double maxVelocity = 0.5 //m/s
51  );
52 
53  double m_maxLength;
54  double m_minLength;
55  double m_maxMotorForce;
56  double m_maxVelocity;
57  };
58 
60  btSliderConstraint* constraint,
61  const tgTags& tags,
62  tgPrismatic::Config& config);
63 
65  btSliderConstraint* constraint,
66  std::string space_separated_tags,
67  tgPrismatic::Config& config);
68 
69  virtual ~tgPrismatic();
70 
71  virtual void init();
72 
73  virtual void setup(tgWorld& world);
74 
75  virtual void teardown();
76 
77  virtual void step(double dt);
78 
79  virtual void moveMotors(double dt);
80 
81 private:
82  Config m_config;
83  btSliderConstraint* m_slider;
84 };
85 
86 #endif // TG_PRISMATIC_H
virtual void setup(tgWorld &world)
Definition: tgPrismatic.cpp:94
virtual void step(double dt)
virtual void teardown()
Definition of tgSubject class.
Contains the definition of class tgModel.
Definition: tgTags.h:44