OpenSim  OpenSim 3.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
OpenSim::PrescribedController Class Reference

PrescribedController is a concrete Controller that specifies functions that prescribe the control values of its actuators as a function of time. More...

#include <PrescribedController.h>

Inheritance diagram for OpenSim::PrescribedController:
OpenSim::Controller OpenSim::ModelComponent OpenSim::Object

Public Member Functions

 OpenSim_DECLARE_PROPERTY (ControlFunctions, FunctionSet,"Functions (one per control) describing the controls for actuators""specified for this controller.")
 FunctionSet of prescribed controls associated with each actuator. More...
 
 OpenSim_DECLARE_OPTIONAL_PROPERTY (controls_file, std::string,"Controls storage (.sto) file containing controls for individual ""actuators in the model. Column labels must match actuator names.")
 (Optional) prescribed controls from a storage file More...
 
 OpenSim_DECLARE_OPTIONAL_PROPERTY (interpolation_method, int,"Interpolate the controls file data using piecewise: '0-constant', ""'1-linear', '3-cubic' or '5-quintic' functions.")
 (Optional) interpolation method for controls in storage. More...
 
 PrescribedController ()
 Default constructor. More...
 
 PrescribedController (const std::string &controlsFileName, int interpMethodType=1)
 Convenience constructor get controls from file. More...
 
virtual ~PrescribedController ()
 Destructor. More...
 
void computeControls (const SimTK::State &s, SimTK::Vector &controls) const override
 Compute the control values for all actuators under the control of this Controller. More...
 
void prescribeControlForActuator (int index, Function *prescribedFunction)
 Assign a prescribe control function for the desired actuator identified by its index. More...
 
void prescribeControlForActuator (const std::string actName, Function *prescribedFunction)
 Assign a prescribe control function for the desired actuator identified by its name. More...
 
- Public Member Functions inherited from OpenSim::Controller
 OpenSim_DECLARE_PROPERTY (isDisabled, bool,"Flag (true or false) indicating whether or not the controller is disabled.")
 
 OpenSim_DECLARE_LIST_PROPERTY (actuator_list, std::string,"The list of model actuators that this controller will control.""The keyword ALL indicates the controller will controll all the acuators in the model")
 
 Controller ()
 Default constructor. More...
 
bool isDisabled () const
 Get whether or not this controller is disabled. More...
 
void setDisabled (bool disableFlag)
 Disable this controller. More...
 
void setActuators (const Set< Actuator > &actuators)
 replace the current set of actuators with the provided set More...
 
void addActuator (const Actuator &actuator)
 add to the current set of actuators More...
 
const Set< Actuator > & getActuatorSet () const
 get a const reference to the current set of actuators More...
 
Set< Actuator > & updActuators ()
 get a writable reference to the set of actuators for this controller More...
 
int getNumControls () const
 

Protected Member Functions

void connectToModel (Model &model) override
 Model component interface. More...
 
- Protected Member Functions inherited from OpenSim::Controller
void addToSystem (SimTK::MultibodySystem &system) const override
 Model component interface that creates underlying computational components in the SimTK::MultibodySystem. More...
 
void setNumControls (int numControls)
 Only a Controller can set its number of controls based on its actuators. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from OpenSim::Object
static void registerType (const Object &defaultObject)
 Register an instance of a class; if the class is already registered it will be replaced. More...
 
static void renameType (const std::string &oldTypeName, const std::string &newTypeName)
 Support versioning by associating the current Object type with an old name. More...
 
static const ObjectgetDefaultInstanceOfType (const std::string &concreteClassName)
 Return a pointer to the default instance of the registered (concrete) Object whose class name is given, or NULL if the type is not registered. More...
 
template<class T >
static bool isObjectTypeDerivedFrom (const std::string &concreteClassName)
 Return true if the given concrete object type represents a subclass of the template object type T, and thus could be referenced with a T*. More...
 
static ObjectnewInstanceOfType (const std::string &concreteClassName)
 Create a new instance of the concrete Object type whose class name is given as concreteClassName. More...
 
static void getRegisteredTypenames (Array< std::string > &typeNames)
 Retrieve all the typenames registered so far. More...
 
template<class T >
static void getRegisteredObjectsOfGivenType (ArrayPtrs< T > &rArray)
 Return an array of pointers to the default instances of all registered (concrete) Object types that derive from a given Object-derived type that does not have to be concrete. More...
 
static void PrintPropertyInfo (std::ostream &os, const std::string &classNameDotPropertyName)
 Dump formatted property information to a given output stream, useful for creating a "help" facility for registered objects. More...
 
static void PrintPropertyInfo (std::ostream &os, const std::string &className, const std::string &propertyName)
 Same as the other signature but the class name and property name are provided as two separate strings. More...
 
static ObjectmakeObjectFromFile (const std::string &fileName)
 Create an OpenSim object whose type is based on the tag at the root node of the XML file passed in. More...
 
static const std::string & getClassName ()
 Return the name of this class as a string; i.e., "Object". More...
 
static void setSerializeAllDefaults (bool shouldSerializeDefaults)
 Static function to control whether all registered objects and their properties are written to the defaults section of output files rather than only those values for which the default was explicitly overwritten when read in from an input file or set programmatically. More...
 
static bool getSerializeAllDefaults ()
 Report the value of the "serialize all defaults" flag. More...
 
static bool isKindOf (const char *type)
 Returns true if the passed-in string is "Object"; each Object-derived class defines a method of this name for its own class name. More...
 
static void setDebugLevel (int newLevel)
 Set the debug level to get verbose output. More...
 
static int getDebugLevel ()
 Get current setting of debug level. More...
 
static ObjectSafeCopy (const Object *aObject)
 Use the clone() method to duplicate the given object unless the pointer is null in which case null is returned. More...
 
static void RegisterType (const Object &defaultObject)
 OBSOLETE alternate name for registerType(). More...
 
static void RenameType (const std::string &oldName, const std::string &newName)
 OBSOLETE alternate name for renameType(). More...
 
- Static Public Attributes inherited from OpenSim::Object
static const std::string DEFAULT_NAME
 Name used for default objects when they are serialized. More...
 
- Protected Attributes inherited from OpenSim::ModelComponent
Model_model
 The model this component belongs to. More...
 
- Friends inherited from OpenSim::Controller

Detailed Description

PrescribedController is a concrete Controller that specifies functions that prescribe the control values of its actuators as a function of time.

Author
Ajay Seth

Constructor & Destructor Documentation

OpenSim::PrescribedController::PrescribedController ( )

Default constructor.

OpenSim::PrescribedController::PrescribedController ( const std::string &  controlsFileName,
int  interpMethodType = 1 
)

Convenience constructor get controls from file.

Parameters
controlsFileNamestring containing the controls storage (.sto)
interpMethodTypeint 0-constant, 1-linear, 3-cubic, 5-quintic defaults to linear.
virtual OpenSim::PrescribedController::~PrescribedController ( )
virtual

Destructor.

Member Function Documentation

void OpenSim::PrescribedController::computeControls ( const SimTK::State &  s,
SimTK::Vector &  controls 
) const
overridevirtual

Compute the control values for all actuators under the control of this Controller.

Parameters
ssystem state
controlsmodel controls

Implements OpenSim::Controller.

void OpenSim::PrescribedController::connectToModel ( Model model)
overrideprotectedvirtual

Model component interface.

Reimplemented from OpenSim::Controller.

OpenSim::PrescribedController::OpenSim_DECLARE_OPTIONAL_PROPERTY ( controls_file  ,
std::string  ,
"Controls storage (.sto) file containing controls for individual ""actuators in the model. Column labels must match actuator names."   
)

(Optional) prescribed controls from a storage file

OpenSim::PrescribedController::OpenSim_DECLARE_OPTIONAL_PROPERTY ( interpolation_method  ,
int  ,
"Interpolate the controls file data using piecewise: '0-constant'  ,
""'1-linear'  ,
'3-cubic'or '5-quintic'functions."   
)

(Optional) interpolation method for controls in storage.

OpenSim::PrescribedController::OpenSim_DECLARE_PROPERTY ( ControlFunctions  ,
FunctionSet  ,
"Functions (one per control) describing the controls for actuators""specified for this controller."   
)

FunctionSet of prescribed controls associated with each actuator.

void OpenSim::PrescribedController::prescribeControlForActuator ( int  index,
Function prescribedFunction 
)

Assign a prescribe control function for the desired actuator identified by its index.

Controller takes ownership of the function.

Parameters
indexthe actuator's index in the controller's set
prescribedFunctionthe actuator's control function
void OpenSim::PrescribedController::prescribeControlForActuator ( const std::string  actName,
Function prescribedFunction 
)

Assign a prescribe control function for the desired actuator identified by its name.

Controller takes ownership of the function.

Parameters
actNamethe actuator's name in the controller's set
prescribedFunctionthe actuator's control function

The documentation for this class was generated from the following file: