NTRT Simulator  Version: Master
 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  void updateTensionSetpoint(double newTension);
49 
50  void updateControlLength(double newControlLength);
51 
52  const double getCommandedTension() const
53  {
54  return m_commandedTension;
55  }
56 
57 private:
62  double m_controlTime;
63  double m_totalTime;
68  const double m_controlStep;
69 
70  double m_commandedTension;
71 
75  const double cpgAmplitude;
76  const double cpgFrequency;
77  const double phaseOffset;
78  const double offsetSpeed;
79 
80 
86  double cycle;
87  double target;
88 
92  double m_controlLength;
93 
94  tgPIDController::Config m_tempConfig;
95 
96  tgPIDController* m_PIDController;
97 
98  tgImpedanceController* m_pMotorControl;
99 };
100 
101 
102 #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.