Public Member Functions | Protected Attributes

CB::CartesianPosition Class Reference

This class instantiates the abstract ControlBasisResource class for a CartesianPosition type resource. More...

#include <CartesianPosition.h>

Inheritance diagram for CB::CartesianPosition:
CB::ControlBasisResource CB::CartesianPositionHarmonicReference CB::EndEffectorCartesianPosition

Public Member Functions

double getX ()
 returns the X coordinate of the position
double getY ()
 returns the Y coordinate of the position
double getZ ()
 returns the Z coordinate of the position
 CartesianPosition ()
 Constructor.
 ~CartesianPosition ()
 Destructor.
void postData ()
 This is the function that posts the resource data to the output port.
virtual void getInputData ()
 getInputData() function.
std::string getResourceName ()
 Getter for the resource name.
std::string getDeviceName ()
 Getter for the device name.
bool isResourceRunning ()
 is the resource running?
std::string getResourceType ()
 Getter for the resource type.
yarp::sig::Vector getResourceData ()
 Getter for the resource data.
int getResourceDataSize ()
 Getter for the resource data size.
void setUpdateDelay (double t)
 Setter for updated delay.
void setLock (bool l)
 Setter for locking/unlocking the ability to set output variables.
virtual bool updateResource ()=0
 virtual update function
virtual void startResource ()=0
 virtual start function
virtual void stopResource ()=0
 virtual stop function
void initPorts ()
 Initiallization function for starting ports.
void run ()
 main run function for resource (instatiates for thread)
void onStop ()
 onStop function

Protected Attributes

std::string deviceName
 the name of the device
std::string resourceName
 the name of the resource
bool running
 running flag
std::string type
 The formal type of the resource (e.g., CartesianPosition, ConfigurationVariable, etc.
yarp::sig::Vector values
 The resource data vals.
int size
 the size of the data values
std::vector
< yarp::os::BufferedPort
< yarp::os::Bottle > * > 
outputPort
 The Yarp output ports.
std::vector
< yarp::os::BufferedPort
< yarp::os::Bottle > * > 
inputPort
 The Yarp input Ports.
int numOutputs
 num output ports
int numInputs
 num input ports
std::vector< std::string > outputPortName
 The Yarp output port names.
std::vector< std::string > inputPortName
 The YARP input port name.
std::vector< std::string > outputName
 The output names.
std::vector< std::string > inputName
 The input names.
bool lock
 Lock flag to prevent writing vals to hardware.
double updateDelay
 update delay (in seconds)

Detailed Description

This class instantiates the abstract ControlBasisResource class for a CartesianPosition type resource.

It is still abstract, in that it doesn't implement a runnable resource. This class must be extended for specific cartesian position device that implements the start, update, and stop functions.

Definition at line 15 of file CartesianPosition.h.


Member Function Documentation

std::string CB::ControlBasisResource::getDeviceName (  )  [inline, inherited]

Getter for the device name.

Returns:
the name

Definition at line 119 of file ControlBasisResource.h.

References CB::ControlBasisResource::deviceName.

{ return deviceName; }  

std::string CB::ControlBasisResource::getResourceName (  )  [inline, inherited]

Getter for the resource name.

Returns:
the name

Definition at line 113 of file ControlBasisResource.h.

References CB::ControlBasisResource::resourceName.

Referenced by CB::Controller::Controller().

{ return resourceName; }  

std::string CB::ControlBasisResource::getResourceType (  )  [inline, inherited]

Getter for the resource type.

Returns:
the type

Definition at line 131 of file ControlBasisResource.h.

References CB::ControlBasisResource::type.

Referenced by CB::Controller::Controller().

{ return type; }

bool CB::ControlBasisResource::isResourceRunning (  )  [inline, inherited]

is the resource running?

Returns:
running

Definition at line 125 of file ControlBasisResource.h.

References CB::ControlBasisResource::running.

Referenced by CB::Controller::startAction().

{ return running; }

void CB::CartesianPosition::postData (  )  [inline, virtual]

This is the function that posts the resource data to the output port.

it is type specific, so it is defined here. it is automatically called after the update() function in the main thread loop.

Implements CB::ControlBasisResource.

Definition at line 56 of file CartesianPosition.h.

References getX(), getY(), getZ(), CB::ControlBasisResource::outputPort, and CB::ControlBasisResource::resourceName.

                        {
            yarp::os::Bottle &b = outputPort[0]->prepare();
            b.clear();
            b.addString(resourceName.c_str());
            b.addDouble(getX());
            b.addDouble(getY());
            b.addDouble(getZ());      
            outputPort[0]->write();
        }

void CB::ControlBasisResource::setLock ( bool  l  )  [inline, inherited]

Setter for locking/unlocking the ability to set output variables.

Parameters:
lock 

Reimplemented in CB::ConfigurationVariables.

Definition at line 154 of file ControlBasisResource.h.

References CB::ControlBasisResource::lock.

{ lock = l; }

void CB::ControlBasisResource::setUpdateDelay ( double  t  )  [inline, inherited]

Setter for updated delay.

Parameters:
delay (in seconds)

Definition at line 147 of file ControlBasisResource.h.

References CB::ControlBasisResource::updateDelay.

{ updateDelay = t; }


Field Documentation


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Friends Defines