NTRT Simulator  v1.1
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
RBStringTest.h
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 RB_STRING_TEST_H
20 #define RB_STRING_TEST_H
21 
22 #include "core/tgModel.h"
23 
24 #include "core/tgSubject.h"
25 
26 // SubModels
27 #include "core/tgBasicActuator.h"
28 #include "core/tgRod.h"
29 
30 #include <set>
31 #include <map>
32 
33 class tgWorld;
34 class CPGEquations;
35 class tgNode;
36 
37 class RBStringTest: public tgSubject<RBStringTest>, public tgModel
38 {
39 public:
40 
41  struct Config
42  {
43  public:
44  Config( int segments,
45  const tgRod::Config& rodConf,
46  const tgBasicActuator::Config& stringConf,
47  double minTotalLength = 0.1); // todo: find better default
48 
49  int m_segments;
50  tgRod::Config m_rodConfig;
51  tgBasicActuator::Config m_stringConfig;
52  double m_minTotalLength;
53  };
54 
55  RBStringTest(tgNode* start, tgNode* end, const RBStringTest::Config& config);
56 
57  virtual ~RBStringTest()
58  {}
59 
60  virtual void setup(tgWorld& world);
61 
62  // @todo: Is there a way that we can get rid of the need to override this function in subclasses of tgModel?
63  // comment_BRT: only if we can somehow make tgModel a template class,
64  // we need to know what class we're notifying
65  virtual void step(double dt);
66 
67  const int getSegments() const
68  {
69  return m_config.m_segments;
70  }
71 
72 private:
73  std::vector<tgBasicActuator*> allMuscles;
74 
75  Config m_config;
76 
77  //
78  const tgNode* m_pStartNode;
79  const tgNode* m_pEndNode;
80 };
81 
82 #endif // RB_STRING_TEST_H
Definition of tgSubject class.
Contains the definition of class tgModel.
virtual void step(double dt)
Contains the definition of class tgBasicActuator.
Definition: tgNode.h:45
virtual void setup(tgWorld &world)
Contains the definition of class tgRod.