This class implements a Squared Error quadratic potential function for a Heading resources, s.t., = (1/2)*gamma^T*gamma. More...
#include <HeadingSquaredError.h>
Public Member Functions | |
| HeadingSquaredError () | |
| Empty Constructor, needs to set configuration info. | |
| ~HeadingSquaredError () | |
| Destructor. | |
| virtual bool | updatePotentialFunction () |
| inherited update function | |
| virtual void | startPotentialFunction () |
| inherited start function | |
| virtual void | stopPotentialFunction () |
| inherited stop function | |
| virtual bool | connectToInputs () |
| inherited connect function | |
| std::string | getPotentialName () |
| Getter for the potential function name. | |
| double | getPotential () |
| Getter for the potential. | |
| yarp::sig::Vector | getPotentialGradient () |
| Getter for the potential gradient. | |
| bool | isPotentialRunning () |
| is the potential function running? | |
| int | getInputSize () |
| Getter for the potential size. | |
| void | setUpdateDelay (double t) |
| Setter for updated delay. | |
| void | postData () |
| virtual post data function to be filled in by abstract interface | |
| void | run () |
| main run function for pf (instatiates for thread) | |
| void | onStop () |
| onStop function | |
| void | setInputs (std::vector< std::string > inNames) |
| Function to set input names. | |
| bool | needsReference () |
| returns whether the PF needs a reference input | |
| std::string | getSpace () |
| gets the space of the potential function | |
| std::string | getType () |
| gets the type of the potential function (the name representing the type of function. | |
Protected Attributes | |
| std::string | pfName |
| the name of the potential function | |
| std::string | pfType |
| the name of the type of function | |
| std::string | pfSpace |
| the space of function | |
| bool | hasReference |
| whether the PF needs a reference | |
| bool | running |
| running flag | |
|
yarp::os::BufferedPort < yarp::os::Bottle > | outputPort |
| The Yarp output port. | |
| std::string | outputPortName |
| The Yarp output port name. | |
| double | updateDelay |
| update delay (in seconds) | |
| double | potential |
| the potential value | |
| yarp::sig::Vector | gradient |
| the gradient of the potential wrt the input space | |
| std::vector< yarp::sig::Vector * > | inputs |
| the input vector | |
| std::vector< std::string > | inputNames |
| the name of the input resources | |
|
std::vector < yarp::os::BufferedPort < yarp::os::Bottle > * > | inputPorts |
| the input ports | |
| int | size |
| the size of the input space | |
| bool | connectedToInputs |
| connected to inputs flag | |
| bool | inputsSet |
| set inputs flag | |
This class implements a Squared Error quadratic potential function for a Heading resources, s.t., = (1/2)*gamma^T*gamma.
Implemented as gamma_reference - gamma_current.
Definition at line 14 of file HeadingSquaredError.h.
| int CB::ControlBasisPotentialFunction::getInputSize | ( | ) | [inline, inherited] |
Getter for the potential size.
Definition at line 139 of file ControlBasisPotentialFunction.h.
References CB::ControlBasisPotentialFunction::size.
{ return size; }
| double CB::ControlBasisPotentialFunction::getPotential | ( | ) | [inline, inherited] |
Getter for the potential.
Definition at line 121 of file ControlBasisPotentialFunction.h.
References CB::ControlBasisPotentialFunction::potential.
Referenced by CB::Controller::updateAction().
{ return potential; }
| yarp::sig::Vector CB::ControlBasisPotentialFunction::getPotentialGradient | ( | ) | [inline, inherited] |
Getter for the potential gradient.
Definition at line 127 of file ControlBasisPotentialFunction.h.
References CB::ControlBasisPotentialFunction::gradient.
Referenced by CB::Controller::updateAction().
{ return gradient; }
| std::string CB::ControlBasisPotentialFunction::getPotentialName | ( | ) | [inline, inherited] |
Getter for the potential function name.
Definition at line 115 of file ControlBasisPotentialFunction.h.
References CB::ControlBasisPotentialFunction::pfName.
Referenced by CB::Controller::Controller().
{ return pfName; }
| std::string CB::ControlBasisPotentialFunction::getType | ( | ) | [inline, inherited] |
gets the type of the potential function (the name representing the type of function.
e.g., squared_error_pf)
Definition at line 321 of file ControlBasisPotentialFunction.h.
References CB::ControlBasisPotentialFunction::pfType.
{ return pfType; }
| bool CB::ControlBasisPotentialFunction::isPotentialRunning | ( | ) | [inline, inherited] |
is the potential function running?
Definition at line 133 of file ControlBasisPotentialFunction.h.
References CB::ControlBasisPotentialFunction::running.
Referenced by CB::Controller::startAction().
{ return running; }
| void CB::ControlBasisPotentialFunction::setInputs | ( | std::vector< std::string > | inNames | ) | [inline, inherited] |
Function to set input names.
| inNames | vector of input names |
Definition at line 236 of file ControlBasisPotentialFunction.h.
References CB::ControlBasisPotentialFunction::inputNames, CB::ControlBasisPotentialFunction::inputPorts, CB::ControlBasisPotentialFunction::inputs, CB::ControlBasisPotentialFunction::inputsSet, CB::ControlBasisPotentialFunction::outputPort, CB::ControlBasisPotentialFunction::outputPortName, CB::ControlBasisPotentialFunction::pfName, CB::ControlBasisPotentialFunction::pfSpace, and CB::ControlBasisPotentialFunction::pfType.
{
// clear our residual names
if(inputsSet) {
inputNames.clear();
}
inputNames = inNames;
// set up pf name: /cb/<space>/<pf_type>/<inputName[1]>/.../<inputName[N]>
pfName = "/cb/" + pfSpace + "/" + pfType;
std::string prefixStr = "/cb/" + pfSpace;
std::string tmp;
int s;
for(int i=0; i<inputNames.size(); i++) {
tmp = inputNames[i];
s = prefixStr.size();
tmp.erase(0,s);
pfName += tmp;
}
std::cout << "ControlBasisPotentialFunction::setInputs() name=" << pfName.c_str() << std::endl;
// clear out any old input vectors or ports
for(int i=0; i<inputPorts.size(); i++)
delete inputPorts[i];
inputPorts.clear();
for(int i=0; i<inputs.size(); i++)
delete inputs[i];
inputs.clear();
// create new input pointers
for(int i=0; i<inputNames.size(); i++) {
inputs.push_back(new yarp::sig::Vector(1));
inputPorts.push_back(new yarp::os::BufferedPort<yarp::os::Bottle>());
}
// set flag
inputsSet = true;
// set outputs
outputPortName = pfName + "data:o";
outputPort.close();
outputPort.open(outputPortName.c_str());
}
| void CB::ControlBasisPotentialFunction::setUpdateDelay | ( | double | t | ) | [inline, inherited] |
Setter for updated delay.
| delay | (in seconds) |
Definition at line 145 of file ControlBasisPotentialFunction.h.
References CB::ControlBasisPotentialFunction::updateDelay.
{ updateDelay = t; }
1.7.1