1 #ifndef OPENSIM_TRACKING_CONTROLLER_H_ 2 #define OPENSIM_TRACKING_CONTROLLER_H_ 3 4 /* -------------------------------------------------------------------------- * 5 * OpenSim: TrackingController.h * 6 * -------------------------------------------------------------------------- * 7 * The OpenSim API is a toolkit for musculoskeletal modeling and simulation. * 8 * See http://opensim.stanford.edu and the NOTICE file for more information. * 9 * OpenSim is developed at Stanford University and supported by the US * 10 * National Institutes of Health (U54 GM072970, R24 HD065690) and by DARPA * 11 * through the Warrior Web program. * 12 * * 13 * Copyright (c) 2005-2017 Stanford University and the Authors * 14 * Author(s): Ajay Seth * 15 * * 16 * Licensed under the Apache License, Version 2.0 (the "License"); you may * 17 * not use this file except in compliance with the License. You may obtain a * 18 * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. * 19 * * 20 * Unless required by applicable law or agreed to in writing, software * 21 * distributed under the License is distributed on an "AS IS" BASIS, * 22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 23 * See the License for the specific language governing permissions and * 24 * limitations under the License. * 25 * -------------------------------------------------------------------------- */ 26 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 27 28 29 30 //============================================================================ 31 // INCLUDE 32 //============================================================================ 33 #include "Controller.h" 34 35 //============================================================================= 36 //============================================================================= 37 38 namespace OpenSim { 39 40 class TrackingTask; 41 class Storage; 42 43 /** 44 * TrackingController is an abstract class from which all tracking type of 45 * controllers should be derived. This class implements convenience methods 46 * to construct desired trajectories of desired model state values, like joint 47 * angles, from Storage (file) or user-supplied functions and provides methods 48 * for obtaining the error between model and desired state values. 49 * 50 * Derive classes need only to implement the tracking control law based on 51 * the error signals computed by this base class. 52 * 53 * @author Ajay Seth 54 * @version 1.0 55 */ 56 class OSIMSIMULATION_API TrackingController : public Controller 57 { 58 59 //============================================================================= 60 // METHODS 61 //============================================================================= 62 //-------------------------------------------------------------------------- 63 // CONSTRUCTION AND DESTRUCTION 64 //-------------------------------------------------------------------------- 65 public: 66 /** 67 * Default constructor. 68 */ 69 TrackingController(); 70 71 /** 72 * Destructor. 73 */ 74 virtual ~TrackingController(); 75 76 //-------------------------------------------------------------------------- 77 // GET AND SET 78 //-------------------------------------------------------------------------- 79 /** 80 * %Set this class's pointer to the storage object containing 81 * desired model states to point to the storage object passed into 82 * this method. This method is currently implemented only by the 83 * CorrectionController class, which is a subclass of Controller. 84 * 85 * @param aYDesStore Pointer to a Storage object containing the 86 * desired states of the model for the controller to achieve during 87 * simulation. 88 */ 89 virtual void setDesiredStatesStorage(const Storage* aYDesStore); 90 virtual const Storage& getDesiredStatesStorage() const; 91 92 // ON/OFF 93 94 //-------------------------------------------------------------------------- 95 // CONTROL 96 //-------------------------------------------------------------------------- 97 98 /** 99 * Controller interface 100 */ 101 //void computeControls(const SimTK::State& s, SimTK::Vector& controls) const =0; 102 103 private: 104 // A "private" method is one that can be called only by this class, 105 // and not even by subclasses of this class. 106 107 /** 108 * This method sets all member variables to default (e.g., NULL) values. 109 */ 110 void setNull(); 111 112 113 114 115 //============================================================================= 116 // DATA 117 //============================================================================= 118 119 private: 120 /** 121 * storage object containing the desired trajectory 122 */ 123 mutable SimTK::ReferencePtr<const Storage> _desiredStatesStorage; 124 125 126 friend class ControllerSet; 127 128 //============================================================================= 129 }; // END of class Controller 130 131 }; //namespace 132 //============================================================================= 133 //============================================================================= 134 135 #endif // OPENSIM_TRACKING_CONTROLLER_H_ 136 137 138