NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
SpineOnlineControl.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_ONLINE_CONTROL_H
20 #define SPINE_ONLINE_CONTROL_H
21 
32 
33 
37 
38 #include "LinearMath/btVector3.h"
39 
41 class BaseSpineModelGoal;
42 
52 {
53 public:
54 
56  {
57  public:
61  Config( int ss,
62  int tm,
63  int om,
64  int param,
65  int segnum = 6,
66  double ct = 0.1,
67  double la = 0,
68  double ha = 30,
69  double lp = -1 * M_PI,
70  double hp = M_PI,
71  double kt = 0.0,
72  double kp = 1000.0,
73  double kv = 100.0,
74  bool def = true,
75  double cl = 10.0,
76  double lf = 0.0,
77  double hf = 30.0,
78  double ffMin = 0.0,
79  double ffMax = 0.0,
80  double afMin = 0.0,
81  double afMax = 0.0,
82  double pfMin = 0.0,
83  double pfMax = 0.0,
84  double tf = 0.0,
85  double feedTime = 1.0
86  );
87 
88  const double feedbackTime;
89 
90  };
91 
93  std::string args,
94  std::string resourcePath = "",
95  std::string ec = "edgeConfig.ini",
96  std::string nc = "nodeConfig.ini",
97  std::string fc = "feedbackConfig.ini",
98  std::string gc = "goalConfig.ini");
99 
100  virtual ~SpineOnlineControl() {}
101 
102  virtual void onSetup(BaseSpineModelLearning& subject);
103 
104  virtual void onStep(BaseSpineModelLearning& subject, double dt);
105 
106  virtual void onTeardown(BaseSpineModelLearning& subject);
107 
108 protected:
109 
110  double getGoalDist(const BaseSpineModelGoal* subject) const;
111 
113 
114  double m_feedbackControlTime;
115 
116  double m_lastGoalDist;
117  double m_controllerStartDist;
118 
119 };
120 
121 #endif // SPINE_FEEDBACK_CONTROL_H
Config(int ss, int tm, int om, int param, int segnum=6, double ct=0.1, double la=0, double ha=30, double lp=-1 *M_PI, double hp=M_PI, double kt=0.0, double kp=1000.0, double kv=100.0, bool def=true, double cl=10.0, double lf=0.0, double hf=30.0, double ffMin=0.0, double ffMax=0.0, double afMin=0.0, double afMax=0.0, double pfMin=0.0, double pfMax=0.0, double tf=0.0, double feedTime=1.0)
virtual void onSetup(BaseSpineModelLearning &subject)
virtual void onStep(BaseSpineModelLearning &subject, double dt)
A class to read a learning configuration from a .ini file.
Defines a class NeuroAdapter to pass parameters from NeuroEvolution to a controller.
A controller for the template class BaseSpineModelLearning.
A controller for the template class BaseSpineModelLearning.
Top level class for NeuroEvolution.
virtual void onTeardown(BaseSpineModelLearning &subject)
SpineOnlineControl(SpineOnlineControl::Config config, std::string args, std::string resourcePath="", std::string ec="edgeConfig.ini", std::string nc="nodeConfig.ini", std::string fc="feedbackConfig.ini", std::string gc="goalConfig.ini")