NTRT Simulator  v1.1
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgSCASineControl.h
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_SCA_SINE_CONTROL_H
20 #define TG_SCA_SINE_CONTROL_H
21 
24 
25 // Forward declarations
26 class btRigidBody;
28 
29 class tgSCASineControl : public tgObserver<tgSpringCableActuator>
30 {
31 public:
32 
33  tgSCASineControl(const double controlStep,
34  tgImpedanceController* p_ipc,
35  tgPIDController::Config pidConfig,
36  const double amplitude,
37  const double frequency,
38  const double phase,
39  const double offset,
40  const double length);
41 
42  virtual ~tgSCASineControl();
43 
44  virtual void onAttach(tgSpringCableActuator& subject);
45 
46  virtual void onStep(tgSpringCableActuator& subject, double dt);
47 
48 
49 
50  const double getCommandedTension() const
51  {
52  return m_commandedTension;
53  }
54 
55 private:
60  double m_controlTime;
61  double m_totalTime;
66  const double m_controlStep;
67 
68  double m_commandedTension;
69 
73  const double cpgAmplitude;
74  const double cpgFrequency;
75  const double phaseOffset;
76  const double offsetSpeed;
77 
78 
84  double cycle;
85  double target;
86 
90  const double m_controlLength;
91 
92  tgPIDController::Config m_tempConfig;
93 
94  tgPIDController* m_PIDController;
95 
96  tgImpedanceController* m_pMotorControl;
97 };
98 
99 
100 #endif
tgSCASineControl(const double controlStep, tgImpedanceController *p_ipc, tgPIDController::Config pidConfig, const double amplitude, const double frequency, const double phase, const double offset, const double length)
Contains the definition of abstract base class tgSpringCableActuator. Assumes that the string is line...
virtual void onStep(tgSpringCableActuator &subject, double dt)
virtual void onAttach(tgSpringCableActuator &subject)
Definition of the tgPIDController class.