#include <Controller.h>
Public Member Functions | |
Controller () | |
Default constructor. | |
Controller (Model &aModel) | |
A convenience constructor. | |
Controller (const std::string &aFileName, bool aUpdateFromXMLNode=true) | |
Constructor from an XML Document. | |
Controller (const Controller &aController) | |
Copy constructor. | |
virtual | ~Controller () |
Default destructor. | |
virtual int | getNumStateVariables () const |
Public model component interface to obtain the number of state variables introduced by the controller. | |
Controller & | operator= (const Controller &aController) |
Assignment operator. | |
virtual bool | isDisabled () const |
Get whether or not this controller is disabled. | |
virtual void | setDisabled (bool aTrueFalse) |
Disable this controller. | |
virtual void | computeControls (const SimTK::State &s, SimTK::Vector &controls) const =0 |
Compute the control for actuator This method defines the behavior for any concrete controller and therefore must be implemented by concrete subclasses. | |
virtual void | setActuators (Set< Actuator > &actuators) |
replace the current set of actuators with the provided set | |
void | addActuator (Actuator *actuator) |
add to the current set of actuators | |
virtual const Set< Actuator > & | getActuatorSet () const |
get a const reference to the current set of actuators | |
virtual Set< Actuator > & | updActuators () |
get a writable reference to the set of actuators for this controller | |
virtual const Array < std::string > & | getActuatorNames () const |
get the names of the actuators being controlled | |
virtual double | getFirstTime () const |
return the min an max times that a controller knows how to supply controlls for | |
virtual double | getLastTime () const |
Protected Member Functions | |
void | copyData (const Controller &aController) |
Copy the member variables of the specified controller. | |
virtual void | setup (Model &model) |
Model component interface that permits the controller to be "wired" up to its actuators. | |
virtual void | createSystem (SimTK::MultibodySystem &system) const |
Model component interface that creates underlying computational components in the SimTK::MultibodySystem. | |
virtual void | initState (SimTK::State &s) const |
Model component interface to initialize states introduced by the controller. | |
virtual void | setDefaultsFromState (const SimTK::State &state) |
Model component interface to initialize defualt values of the controller from/based on the given state. | |
Protected Attributes | |
PropertyBool | _isDisabledProp |
Flag indicating whether the Controller is disabled or not. | |
int | _numControls |
number of controls this controller computes | |
PropertyStrArray | _actuatorNameListProp |
list of actuator names to be controlled | |
Array< std::string > & | _actuatorNameList |
Set< Actuator > | _actuatorSet |
set of actuators that the controller controls | |
Friends | |
class | ControllerSet |
Controller::Controller | ( | ) |
Default constructor.
Controller::Controller | ( | Model & | aModel | ) |
A convenience 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 XML file in which this a controller is defined. | |
aUpdateFromXMLNode | A flag indicating whether or not to call updateFromXMLNode() from this constructor. This method is only necessary if changes to the XML format (i.e. tag names) are made and future versions must convert old syntax to the latest. |
Controller::Controller | ( | const Controller & | aController | ) |
Copy constructor.
aController | The controller to be copied. |
Controller::~Controller | ( | ) | [virtual] |
Default destructor.
Destructor.
void Controller::addActuator | ( | Actuator * | actuator | ) |
add to the current set of actuators
virtual void OpenSim::Controller::computeControls | ( | const SimTK::State & | s, | |
SimTK::Vector & | controls | |||
) | const [pure virtual] |
Compute the control for actuator This method defines the behavior for any concrete controller and therefore must be implemented by concrete subclasses.
s | system state | |
controls | writable model controls |
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 | ) | const [protected, virtual] |
Model component interface that creates underlying computational components in the SimTK::MultibodySystem.
Create a Controller in the SimTK::System.
This includes adding states, creating measures, etc... required by the controller.
Reimplemented from OpenSim::ModelComponent.
Reimplemented in OpenSim::ConstantController, OpenSim::ControlSetController, OpenSim::CMC, and OpenSim::CorrectionController.
virtual const Array<std::string>& OpenSim::Controller::getActuatorNames | ( | ) | const [inline, virtual] |
get the names of the actuators being controlled
get a const reference to the current set of actuators
double Controller::getFirstTime | ( | ) | const [virtual] |
return the min an max times that a controller knows how to supply controlls for
Reimplemented in OpenSim::ControlSetController.
double Controller::getLastTime | ( | ) | const [virtual] |
Reimplemented in OpenSim::ControlSetController.
virtual int OpenSim::Controller::getNumStateVariables | ( | ) | const [inline, virtual] |
Public model component interface to obtain the number of state variables introduced by the controller.
Implements OpenSim::ModelComponent.
virtual void OpenSim::Controller::initState | ( | SimTK::State & | s | ) | const [inline, protected, virtual] |
Model component interface to initialize states introduced by the controller.
Reimplemented from OpenSim::ModelComponent.
Reimplemented in OpenSim::ConstantController, OpenSim::ControlSetController, and OpenSim::CorrectionController.
bool Controller::isDisabled | ( | ) | const [virtual] |
Get whether or not this controller is disabled.
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::ModelComponent.
Reimplemented in OpenSim::ConstantController, OpenSim::ControlSetController, OpenSim::PrescribedController, OpenSim::TrackingController, OpenSim::CMC, and OpenSim::CorrectionController.
replace the current set of actuators with the provided set
Reimplemented in OpenSim::ConstantController, and OpenSim::CMC.
virtual void OpenSim::Controller::setDefaultsFromState | ( | const SimTK::State & | state | ) | [inline, protected, virtual] |
Model component interface to initialize defualt values of the controller from/based on the given state.
Reimplemented from OpenSim::ModelComponent.
void Controller::setDisabled | ( | bool | aTrueFalse | ) | [virtual] |
Disable this controller.
Turn this controller on or off.
aTrueFalse | Disable if true. |
void Controller::setup | ( | Model & | model | ) | [protected, virtual] |
Model component interface that permits the controller to be "wired" up to its actuators.
Subclasses can override to perform additional setup.
Reimplemented from OpenSim::ModelComponent.
Reimplemented in OpenSim::ConstantController, OpenSim::ControlSetController, OpenSim::CMC, and OpenSim::CorrectionController.
get a writable reference to the set of actuators for this controller
friend class ControllerSet [friend] |
Reimplemented in OpenSim::TrackingController.
Array<std::string>& OpenSim::Controller::_actuatorNameList [protected] |
list of actuator names to be controlled
Set<Actuator> OpenSim::Controller::_actuatorSet [protected] |
set of actuators that the controller controls
PropertyBool OpenSim::Controller::_isDisabledProp [protected] |
Flag indicating whether the Controller is disabled or not.
Disabled means that the controller is not present in subsequent dynamics realizations.
int OpenSim::Controller::_numControls [protected] |
number of controls this controller computes