NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgCPGMGActuatorControl.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 TG_CPG_MG_ACTUATOR_CONTRL_H
20 #define TG_CPG_MG_ACTUATOR_CONTRL_H
21 
31 #include "util/tgBaseCPGNode.h"
33 // The Boost library
34 #include "boost/multi_array.hpp"
35 
36 typedef boost::multi_array<double, 2> array_2D;
37 typedef boost::multi_array<double, 3> array_3D;
38 
39 // Forward declarations
40 class btRigidBody;
41 class CPGEquations;
42 class CPGEquationsFB;
44 
45 class tgCPGMGActuatorControl : public tgObserver<tgSpringCableActuator>,
46  public tgBaseCPGNode
47 {
48 public:
49 
50  tgCPGMGActuatorControl(const double controlStep = 1.0/10000.0);
51 
52  virtual ~tgCPGMGActuatorControl();
53 
54  virtual void onAttach(tgSpringCableActuator& subject);
55 
56  virtual void onStep(tgSpringCableActuator& subject, double dt);
57 
63  void assignNodeNumber (CPGEquations& CPGSys, array_2D nodeParams);
64 
69  void setConnectivity(const std::vector<tgCPGMGActuatorControl*>& allStrings,
70  array_3D edgeParams);
71 
72  const int getNodeNumber() const
73  {
74  return m_nodeNumber;
75  }
76 
80  const CPGEquations* getCPGSys() const
81  {
82  return m_pCPGSystem;
83  }
84 
85  const double getCommandedTension() const
86  {
87  return m_commandedTension;
88  }
89 
90  virtual void setupControl(tgImpedanceController& ipc);
91 
92  void setupControl(tgImpedanceController& ipc,
93  double controlLength);
94 
95  const btRigidBody* getFromBody() const
96  {
97  return m_pFromBody;
98  }
99 
100  const btRigidBody* getToBody() const
101  {
102  return m_pToBody;
103  }
104 
105 protected:
115  const double m_controlStep;
116 
117  double m_totalTime;
118 
119  double m_commandedTension;
120 
121  btRigidBody* m_pFromBody;
122 
123  btRigidBody* m_pToBody;
124 };
125 
126 
127 #endif
128 
void assignNodeNumber(CPGEquations &CPGSys, array_2D nodeParams)
void setConnectivity(const std::vector< tgCPGMGActuatorControl * > &allStrings, array_3D edgeParams)
Definition of the tgCPGStringControl observer class.
virtual void onStep(tgSpringCableActuator &subject, double dt)
Contains the definition of abstract base class tgSpringCableActuator. Assumes that the string is line...
const CPGEquations * getCPGSys() const
virtual void onAttach(tgSpringCableActuator &subject)
Definition of class tgBaseCPGNode.