NTRT Simulator
 All Classes Files Functions Variables Typedefs Friends Pages
tgBaseString Class Referenceabstract

#include <tgBaseString.h>

Inherits tgModel.

Inherited by tgLinearString, and tgRBString.

Collaboration diagram for tgBaseString:

Classes

struct  BaseStringHistory
 
struct  Config
 

Public Member Functions

virtual ~tgBaseString ()
 
virtual void setup (tgWorld &wdorld)
 
virtual void teardown ()
 
virtual void step (double dt)
 
virtual void moveMotors (double dt)=0
 
virtual void tensionMinLengthController (const double targetTension, float dt)=0
 
virtual void setRestLength (double newLength, float dt)
 
virtual const double getStartLength () const =0
 
virtual const double getCurrentLength () const =0
 
virtual const double getTension () const =0
 
virtual const double getRestLength () const =0
 
virtual const double getVelocity () const =0
 
virtual void onVisit (const tgModelVisitor &r) const
 
void addChild (tgModel *pChild)
 
virtual std::string toString (std::string prefix="") const
 
template<typename T >
std::vector< T * > find (const tgTagSearch &tagSearch)
 
template<typename T >
std::vector< T * > find (const std::string &tagSearch)
 
std::vector< tgModel * > getDescendants () const
 
void addTags (const std::string &space_separated_tags)
 
void addTags (const tgTags &tags)
 
bool hasTag (const std::string tag) const
 
bool hasAllTags (std::string tags)
 
bool hasAnyTags (const std::string tags)
 
bool hasNoTags ()
 
tgTagsgetTags ()
 
const tgTagsgetTags () const
 
void setTags (tgTags tags)
 
std::string getTagStr (std::string delim=" ") const
 

Protected Member Functions

 tgBaseString (const tgTags &tags, tgBaseString::Config &config, double restLength, double actualLength)
 
 tgBaseString (std::string space_separated_tags, tgBaseString::Config &config, double restLength, double actualLength)
 

Protected Attributes

Config m_config
 
BaseStringHistory *const m_pHistory
 
double m_restLength
 
double m_preferredLength
 
double m_startLength
 
double m_prevVelocity
 

Detailed Description

Sets a basic API for string models, so controllers can interface with all of them the same way

Definition at line 42 of file tgBaseString.h.

Constructor & Destructor Documentation

tgBaseString::~tgBaseString ( )
virtual

Deletes history

Definition at line 150 of file tgBaseString.cpp.

tgBaseString::tgBaseString ( const tgTags tags,
tgBaseString::Config config,
double  restLength,
double  actualLength 
)
protected

Need to pass tags down to tgModel, but these should only be called by sub classes

Definition at line 112 of file tgBaseString.cpp.

Member Function Documentation

void tgModel::addChild ( tgModel pChild)
inherited

Add a sub-model to this model. The model takes ownership of the child sub-model and is responsible for deallocating it.

Parameters
[in,out]pChilda pointer to a sub-model
Exceptions
std::invalid_argumentis pChild is NULL, this object, or already a descendant
Todo:
Make sure that every child appears no more than once in the tree.

Definition at line 126 of file tgModel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
std::vector<T*> tgModel::find ( const tgTagSearch tagSearch)
inlineinherited

Get a vector of descendants sorted by type and a tagsearch. Useful for pulling out muscle groups, or similar.

Parameters
[in]tagSearch,atagSearch that contains the desired tags
Returns
a std::vector of pointers to members that match the tag search and typename T

Definition at line 129 of file tgModel.h.

Here is the call graph for this function:

template<typename T >
std::vector<T*> tgModel::find ( const std::string &  tagSearch)
inlineinherited

Get a vector of descendants sorted by type and a tagsearch. Useful for pulling out muscle groups, or similar.

Parameters
[in]tagSearch,astd::string& that contains the desired tags
Returns
a std::vector of pointers to members that match the tag search and typename T

Definition at line 142 of file tgModel.h.

Here is the call graph for this function:

std::vector< tgModel * > tgModel::getDescendants ( ) const
inherited

Return a std::vector of const pointers to all sub-models.

Todo:
examine whether this should be public, and perhaps create a read only version
Returns
a std::vector of const pointers all sub-models.
Todo:
Unnecessary copying can be avoided by pasing the result collection in the recursive step.

Definition at line 174 of file tgModel.cpp.

Here is the call graph for this function:

virtual void tgBaseString::moveMotors ( double  dt)
pure virtual

Functions for interfacing with muscle2P, and higher level controllers

Implemented in tgLinearString, and tgRBString.

void tgModel::onVisit ( const tgModelVisitor r) const
virtualinherited

Call tgModelVisitor::render() on self and all descendants.

Parameters
[in,out]ra reference to a tgModelVisitor

Reimplemented in ConnectorTestModel, BuildTestModel, tgLinearString, and tgRod.

Definition at line 109 of file tgModel.cpp.

Here is the call graph for this function:

void tgBaseString::setup ( tgWorld world)
virtual

Setup takes a tgWorld and passes it to any children for their own setup functions. All subclasses should call this at the appropriate time (usually end of setup) within their own setup function.

Parameters
[in]world- the tgWorld the models will exist in.

Reimplemented from tgModel.

Reimplemented in tgRBString, and tgLinearString.

Definition at line 155 of file tgBaseString.cpp.

Here is the call graph for this function:

void tgBaseString::step ( double  dt)
virtual

Just calls tgModel::step(dt) - steps any children

Reimplemented from tgModel.

Reimplemented in tgLinearString, and tgRBString.

Definition at line 165 of file tgBaseString.cpp.

Here is the call graph for this function:

void tgBaseString::teardown ( )
virtual

Deletes the children (undoes setup)

Reimplemented from tgModel.

Reimplemented in tgRBString, and tgLinearString.

Definition at line 160 of file tgBaseString.cpp.

Here is the call graph for this function:

std::string tgModel::toString ( std::string  prefix = "") const
virtualinherited

Returns the tag names of this model and its children

Parameters
[in]prefixa string to append to
Returns
the original string with this model and its children's tags appended

Definition at line 156 of file tgModel.cpp.

Here is the caller graph for this function:

Member Data Documentation

Config tgBaseString::m_config
protected

A copy of the configuration POD supplied at constuction. This is not const.

Definition at line 223 of file tgBaseString.h.

BaseStringHistory* const tgBaseString::m_pHistory
protected

All history sequences.

Definition at line 226 of file tgBaseString.h.

double tgBaseString::m_prevVelocity
protected

Tracking the most recent velocity to avoid using deques.

Definition at line 245 of file tgBaseString.h.

double tgBaseString::m_restLength
protected

Motor Model Parameters

Definition at line 233 of file tgBaseString.h.

double tgBaseString::m_startLength
protected

Tracking the start length to avoid using deques.

Definition at line 240 of file tgBaseString.h.


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