NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
SpineKinematicsTestController.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 SPINE_KINEMATICS_TEST_CONTROLLER_H
20 #define SPINE_KINEMATICS_TEST_CONTROLLER_H
21 
29 // The NTRT core library
30 #include "core/tgObserver.h"
31 #include "core/tgSubject.h"
32 #include "core/tgTags.h"
33 
34 // The C++ standard library
35 #include <string>
36 #include <vector>
37 #include <map>
38 
39 // Forward declarations
40 class TensegrityModel;
41 class tgBasicActuator;
42 
47 class SpineKinematicsTestController : public tgObserver<TensegrityModel>, public tgSubject<SpineKinematicsTestController>
48 {
49 public:
50 
65  SpineKinematicsTestController(double startTime, double minLength, double rate,
66  std::vector<std::string> tagsToControl);
67 
72 
79  virtual void onSetup(TensegrityModel& subject);
80 
87  virtual void onStep(TensegrityModel& subject, double dt);
88 
89 protected:
90 
97  void initializeActuators(TensegrityModel& subject, std::string tag);
98 
99 private:
100 
104  double m_startTime;
105  double m_minLength;
106  double m_rate;
107  std::vector<std::string> m_tagsToControl;
108 
112  double m_timePassed;
113 
119  typedef std::map<tgTags, double> InitialRestLengths;
120  InitialRestLengths initialRL;
121 
126  std::vector<tgBasicActuator*> cablesWithTags;
127 
128 };
129 
130 #endif // SPINE_KINEMATICS_TEST_CONTROLLER_H
void initializeActuators(TensegrityModel &subject, std::string tag)
Definition of tgObserver class.
Definition of tgSubject class.
SpineKinematicsTestController(double startTime, double minLength, double rate, std::vector< std::string > tagsToControl)
Contains the definition of class tgTags.
virtual void onSetup(TensegrityModel &subject)
virtual void onStep(TensegrityModel &subject, double dt)