NTRT Simulator  v1.1
 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 
47 class BaseSpineModelLearning: public tgSubject<BaseSpineModelLearning>,
48  public tgModel
49 {
50 public:
51 
52  typedef std::map<std::string, std::vector<tgSpringCableActuator*> > MuscleMap;
53 
54  virtual ~BaseSpineModelLearning();
55 
56  virtual void setup(tgWorld& world);
57 
58  virtual void teardown();
59 
60  virtual void step(double dt);
61 
62  virtual std::vector<double> getSegmentCOM(const int n) const;
63 
64  virtual const std::vector<tgSpringCableActuator*>& getMuscles(const std::string& key) const;
65 
66  virtual const std::vector<tgSpringCableActuator*>& getAllMuscles();
67 
68  virtual const std::vector<tgBaseRigid*> getAllRigids();
69 
70  virtual const int getSegments();
71 
72  virtual std::size_t getNumberofMuslces() const
73  {
74  return m_allMuscles.size();
75  }
76 
77 protected:
78 
79  BaseSpineModelLearning(int segments);
80 
81  std::vector<tgSpringCableActuator*> m_allMuscles;
82 
83  std::vector<tgModel*> m_allSegments;
84 
85  MuscleMap m_muscleMap;
86 
87  const std::size_t m_segments;
88 };
89 
90 #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)