NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
BaseSpineModelLearning.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 BASE_SPINE_MODEL_LEARNING_H
20 #define BASE_SPINE_MODEL_LEARNING_H
21 
30 #include "core/tgModel.h"
31 #include "core/tgSubject.h"
32 
33 #include <map>
34 #include <set>
35 #include <string>
36 #include <vector>
37 
38 class tgWorld;
39 class tgStructureInfo;
41 class tgBaseRigid;
42 class btVector3;
43 
48 class BaseSpineModelLearning: public tgSubject<BaseSpineModelLearning>,
49  public tgModel
50 {
51 public:
52 
53  typedef std::map<std::string, std::vector<tgSpringCableActuator*> > MuscleMap;
54 
55  virtual ~BaseSpineModelLearning();
56 
57  virtual void setup(tgWorld& world);
58 
59  virtual void teardown();
60 
61  virtual void step(double dt);
62 
63  virtual std::vector<double> getSegmentCOM(const int n) const;
64 
65  virtual btVector3 getSegmentCOMVector(const int n) const;
66 
67  virtual const std::vector<tgSpringCableActuator*>& getMuscles(const std::string& key) const;
68 
69  virtual const std::vector<tgSpringCableActuator*>& getAllMuscles() const;
70 
71  virtual const std::vector<tgBaseRigid*> getAllRigids() const;
72 
73  virtual const int getSegments() const;
74 
75  virtual std::size_t getNumberofMuslces() const
76  {
77  return m_allMuscles.size();
78  }
79 
80  double getSpineLength() const;
81 
82 protected:
83 
84  BaseSpineModelLearning(int segments);
85 
86  std::vector<tgSpringCableActuator*> m_allMuscles;
87 
88  std::vector<tgModel*> m_allSegments;
89 
90  MuscleMap m_muscleMap;
91 
92  const std::size_t m_segments;
93 };
94 
95 #endif // BASE_SPINE_MODEL_H
Definition of tgSubject class.
virtual void setup(tgWorld &world)
Contains the definition of class tgModel.
virtual void step(double dt)