#include <Controller.h>
Public Member Functions | |
Controller () | |
Default constructor. | |
Controller (Model &aModel) | |
Another constructor. | |
Controller (const std::string &aFileName, bool aUpdateFromXMLNode=true) | |
Constructor from an XML Document. | |
Controller (const Controller &aController) | |
Copy constructor. | |
virtual | ~Controller () |
Destructor. | |
Controller & | operator= (const Controller &aController) |
Assignment operator. | |
bool | getIsEnabled () const |
Get whether or not this controller is on. | |
void | setIsEnabled (bool aTrueFalse) |
Turn this controller on or off. | |
virtual double | computeControl (const SimTK::State &s, int index) const =0 |
Note that this method is "pure virtual", which means that the Controller class does not implement it, and that subclasses must implement it. | |
virtual void | setActuators (Set< Actuator > &actuators) |
virtual void | setupSystem (SimTK::MultibodySystem &system) |
virtual void | setup (Model &model) |
virtual void | createSystem (SimTK::MultibodySystem &system) |
virtual void | initState (SimTK::State &s) |
virtual double | getFirstTime () const |
return the min an max times that a controller knows how to supply controlls for | |
virtual double | getLastTime () const |
virtual Set< Actuator > & | updActuators () |
virtual const Set< Actuator > & | getActuatorSet () const |
virtual const Array < std::string > & | getActuatorList () const |
Protected Member Functions | |
virtual void | setupProperties () |
Connect properties to local pointers. | |
void | copyData (const Controller &aController) |
Copy the member variables of the specified controller. | |
Protected Attributes | |
OpenSim::PropertyBool | _isControllerEnabledProp |
bool | _isControllerEnabled |
int | _numControls |
number of controls this controller has | |
PropertyStrArray | _actuatorNameListProp |
list of actuator names | |
Array< std::string > & | _actuatorNameList |
Set< Actuator > | _actuatorSet |
set of actuators that the controller controls | |
Friends | |
class | ControlSet |
class | ControllerSet |
Controller::Controller | ( | ) |
Default constructor.
Controller::Controller | ( | Model & | aModel | ) |
Another constructor.
Constructor.
aModel | The model that is to be controlled by this Controller. |
Controller::Controller | ( | const std::string & | aFileName, | |
bool | aUpdateFromXMLNode = true | |||
) |
Constructor from an XML Document.
aFileName | The name of the XML file in which this Controller is defined. | |
aUpdateFromXMLNode | A flag indicating whether or not to call updateFromXMLNode() from this constructor. If true, the method will be called from this class. Typically, the flag should be true for this class, but in the member initializer list for this constructor, this class's parent class's constructor with the same parameters will be called, but with aUpdateFromXMLNode set to false. |
Controller::Controller | ( | const Controller & | aController | ) |
Copy constructor.
This constructor is called by any code that contains a command of the form "Controller newController(oldController);".
aController | The controller to be copied. |
Controller::~Controller | ( | ) | [virtual] |
Destructor.
This method should be a member of any subclass of the Controller class. It will be called automatically whenever an instance of the subclass is deleted from memory.
virtual double OpenSim::Controller::computeControl | ( | const SimTK::State & | s, | |
int | index | |||
) | const [pure virtual] |
Note that this method is "pure virtual", which means that the Controller class does not implement it, and that subclasses must implement it.
s | system state | |
rControlSet | Control set used for the simulation. This method alters the control set in order to control the simulation. |
Implemented in OpenSim::ConstantController, OpenSim::ControlSetController, OpenSim::PrescribedController, OpenSim::TrackingController, OpenSim::CMC, and OpenSim::CorrectionController.
void Controller::copyData | ( | const Controller & | aController | ) | [protected] |
Copy the member variables of the specified controller.
This method is called by the copy constructor of the Controller class.
aController | The controller whose data is to be copied. |
Reimplemented in OpenSim::ConstantController, OpenSim::ControlSetController, OpenSim::PrescribedController, OpenSim::TrackingController, OpenSim::CMC, and OpenSim::CorrectionController.
void Controller::createSystem | ( | SimTK::MultibodySystem & | system | ) | [virtual] |
Reimplemented in OpenSim::ConstantController, and OpenSim::ControlSetController.
virtual const Array<std::string>& OpenSim::Controller::getActuatorList | ( | ) | const [inline, virtual] |
double Controller::getFirstTime | ( | ) | const [virtual] |
return the min an max times that a controller knows how to supply controlls for
Reimplemented in OpenSim::ControlSetController.
bool Controller::getIsEnabled | ( | ) | const |
Get whether or not this controller is on.
double Controller::getLastTime | ( | ) | const [virtual] |
Reimplemented in OpenSim::ControlSetController.
void Controller::initState | ( | SimTK::State & | s | ) | [virtual] |
Reimplemented in OpenSim::ConstantController, OpenSim::ControlSetController, OpenSim::CMC, and OpenSim::CorrectionController.
Controller & Controller::operator= | ( | const Controller & | aController | ) |
Assignment operator.
This method is called automatically whenever a command of the form "controller1 = controller2;" is made, where both controller1 and controller2 are both of type Controller. Although Controller cannot be instantiated directly, a subclass of Controller could implement its own operator= method that calls Controller's operator= method. If the subclass does not implement its own operator= method, then when a command of the form "controller1 = controller2" is made, where both controller1 and controller2 are instants of the subclass, the Controller class's operator= method will be called automatically.
aController | The controller to be copied. |
Reimplemented from OpenSim::Object.
Reimplemented in OpenSim::ConstantController, OpenSim::ControlSetController, OpenSim::PrescribedController, OpenSim::TrackingController, OpenSim::CMC, and OpenSim::CorrectionController.
Reimplemented in OpenSim::ConstantController, OpenSim::ControlSetController, OpenSim::CMC, and OpenSim::CorrectionController.
void Controller::setIsEnabled | ( | bool | aTrueFalse | ) |
Turn this controller on or off.
aTrueFalse | Turns controller on if "true" and off if "false". |
void Controller::setup | ( | Model & | model | ) | [virtual] |
Reimplemented in OpenSim::ConstantController, OpenSim::ControlSetController, OpenSim::CMC, and OpenSim::CorrectionController.
void Controller::setupProperties | ( | void | ) | [protected, virtual] |
Connect properties to local pointers.
Currently, the Controller class has no properties, so this method does nothing. However, a subclass of Controller (e.g., ControlSetController) can contain member variables that are properties, which should be defined in the setupProperties() method of the subclass.
Reimplemented from OpenSim::Object.
Reimplemented in OpenSim::ConstantController, OpenSim::ControlSetController, OpenSim::PrescribedController, OpenSim::TrackingController, OpenSim::CMC, and OpenSim::CorrectionController.
void Controller::setupSystem | ( | SimTK::MultibodySystem & | system | ) | [virtual] |
Reimplemented in OpenSim::CMC, and OpenSim::CorrectionController.
friend class ControllerSet [friend] |
Reimplemented in OpenSim::TrackingController.
friend class ControlSet [friend] |
Array<std::string>& OpenSim::Controller::_actuatorNameList [protected] |
list of actuator names
Set<Actuator> OpenSim::Controller::_actuatorSet [protected] |
set of actuators that the controller controls
bool OpenSim::Controller::_isControllerEnabled [protected] |
int OpenSim::Controller::_numControls [protected] |
number of controls this controller has