1 #ifndef OPENSIM_CONTROLLER_SET_H_ 2 #define OPENSIM_CONTROLLER_SET_H_ 3 /* -------------------------------------------------------------------------- * 4 * OpenSim: ControllerSet.h * 5 * -------------------------------------------------------------------------- * 6 * The OpenSim API is a toolkit for musculoskeletal modeling and simulation. * 7 * See http://opensim.stanford.edu and the NOTICE file for more information. * 8 * OpenSim is developed at Stanford University and supported by the US * 9 * National Institutes of Health (U54 GM072970, R24 HD065690) and by DARPA * 10 * through the Warrior Web program. * 11 * * 12 * Copyright (c) 2005-2018 Stanford University and the Authors * 13 * Author(s): Frank C. Anderson, Peter Loan, Jack Middleton, Ajay Seth * 14 * * 15 * Licensed under the Apache License, Version 2.0 (the "License"); you may * 16 * not use this file except in compliance with the License. You may obtain a * 17 * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. * 18 * * 19 * Unless required by applicable law or agreed to in writing, software * 20 * distributed under the License is distributed on an "AS IS" BASIS, * 21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 22 * See the License for the specific language governing permissions and * 23 * limitations under the License. * 24 * -------------------------------------------------------------------------- */ 25 26 // INCLUDES 27 #include "OpenSim/Common/TimeSeriesTable.h" 28 #include <OpenSim/Simulation/Control/Controller.h> 29 #include <OpenSim/Simulation/Model/ModelComponentSet.h> 30 31 namespace OpenSim { 32 33 class Storage; 34 35 //============================================================================= 36 //============================================================================= 37 /** 38 * A class for holding and managing a set of controllers for a model. 39 * 40 * @authors Jack Middleton, Ajay Seth 41 * @version 2.0 42 */ 43 44 //============================================================================= 45 class OSIMSIMULATION_API ControllerSet : public ModelComponentSet<Controller> { 46 OpenSim_DECLARE_CONCRETE_OBJECT(ControllerSet, ModelComponentSet<Controller>); 47 48 //============================================================================= 49 // METHODS 50 //============================================================================= 51 public: 52 //-------------------------------------------------------------------------- 53 // CONSTRUCTION 54 //-------------------------------------------------------------------------- 55 /** Use Super's constructors. @see ModelComponentSet */ 56 using Super::Super; 57 58 void constructStorage(); 59 void storeControls( const SimTK::State& s, int step ); 60 void printControlStorage( const std::string& fileName) const; 61 TimeSeriesTable getControlTable() const; 62 void setActuators(Set<Actuator>& actuators); 63 64 void setDesiredStates( Storage* yStore); 65 66 // Controller interface 67 virtual void computeControls(const SimTK::State& s, SimTK::Vector &controls) const; 68 69 virtual void printInfo() const; 70 71 private: 72 73 SimTK::ClonePtr<Storage> _controlStore; 74 75 // Set of actuators controlled by the set of controllers. 76 SimTK::ReferencePtr<Set<Actuator> > _actuatorSet; 77 //============================================================================= 78 }; // END of class ControllerSet 79 //============================================================================= 80 //============================================================================= 81 82 } // end of namespace OpenSim 83 84 85 #endif // OPENSIM_CONTROLLER_SET_H_ 86 87 88