NTRT Simulator  v1.1
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
SerializedSineWaves.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 NESTED_STRUCTURE_SERIALIZED_SINE_WAVES_H
20 #define NESTED_STRUCTURE_SERIALIZED_SINE_WAVES_H
21 
30 // NTRTSim
31 #include "core/tgObserver.h"
32 
33 // The C++ Standard Library
34 #include <vector>
35 #include <string>
36 
37 // Forward Declarations
41 
46 class SerializedSineWaves : public tgObserver<BaseSpineModelLearning>
47 {
48 public:
49 
50 struct Config
51 {
52  Config(std::string fileName);
53 
54  ~Config();
55 
60  tgImpedanceController* out_controller;
61 
66  double insideLength;
67  double outsideLength;
68 
72  double offsetSpeed;
73  double cpgAmplitude;
74  double cpgFrequency;
75  double bodyWaves;
76 
80  double insideMod;
81 
86  std::vector<double> phaseOffsets;
87 
92 
93 };
94 
95 public:
96 
102  SerializedSineWaves(std::string fileName);
103 
108 
117  void applyImpedanceControlInside(const std::vector<tgSpringCableActuator*> stringList,
118  double dt,
119  std::size_t phase);
129  void applyImpedanceControlOutside(const std::vector<tgSpringCableActuator*> stringList,
130  double dt,
131  std::size_t phase);
132 
140  virtual void onStep(BaseSpineModelLearning& subject, double dt);
141 
142 private:
143 
144  const Config m_config;
145 
146  std::size_t segments;
147 
153  double simTime;
154  double updateTime;
155  double cycle;
156  double target;
157 };
158 
159 #endif // MY_MODEL_CONTROLLER_H
SerializedSineWaves(std::string fileName)
Definition of tgObserver class.
virtual void onStep(BaseSpineModelLearning &subject, double dt)
void applyImpedanceControlOutside(const std::vector< tgSpringCableActuator * > stringList, double dt, std::size_t phase)
std::vector< double > phaseOffsets
void applyImpedanceControlInside(const std::vector< tgSpringCableActuator * > stringList, double dt, std::size_t phase)
tgImpedanceController * in_controller