NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgCompressionSpringActuator Class Reference

#include <tgCompressionSpringActuator.h>

Inherits tgModel, tgControllable, and tgSubject< tgCompressionSpringActuator >.

Inherited by tgUnidirComprSprActuator.

Collaboration diagram for tgCompressionSpringActuator:

Classes

struct  Config
 

Public Member Functions

 tgCompressionSpringActuator (tgBulletCompressionSpring *compressionSpring, const tgTags &tags, tgCompressionSpringActuator::Config &config)
 
virtual ~tgCompressionSpringActuator ()
 
virtual void setup (tgWorld &world)
 
virtual void teardown ()
 
virtual void step (double dt)
 
virtual void onVisit (const tgModelVisitor &r) const
 
virtual double getActuatorSpringForce ()
 
virtual const
tgBulletCompressionSpring
getCompressionSpring () const
 
virtual void setControlInput (double input)
 
virtual void setControlInput (double input, double dt)
 
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
 
const std::vector
< abstractMarker > & 
getMarkers () const
 
void addMarker (abstractMarker a)
 
virtual std::vector
< tgSenseable * > 
getSenseableDescendants () 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
 
void attach (tgObserver< tgCompressionSpringActuator > *pObserver)
 
void notifyStep (double dt)
 
void notifySetup ()
 
void notifyTeardown ()
 

Protected Attributes

tgBulletCompressionSpringm_compressionSpring
 
Config m_config
 

Detailed Description

This class is what should be used to create a compression spring in NTRT. As of 2016-08-02, it does not actuate, though, but is named 'actuator' in the hopes that this functionality will be added eventually.

Definition at line 53 of file tgCompressionSpringActuator.h.

Constructor & Destructor Documentation

tgCompressionSpringActuator::tgCompressionSpringActuator ( tgBulletCompressionSpring compressionSpring,
const tgTags tags,
tgCompressionSpringActuator::Config config 
)

THE MAIN CONSTRUCTOR FOR THIS CLASS. Constructor using tags. Typically called in tgCompressionSpringActuatorInfo.cpp

Parameters
[in]compressionSpring,thetgBulletCompressionSpring object that this controls and logs. Set up in tgCompressionSpringActuatorInfo.cpp
[in]tagsas passed through tgStructure and tgStructureInfo
[in]configHolds member variables defined here.

The main constructor for this class.

Definition at line 98 of file tgCompressionSpringActuator.cpp.

tgCompressionSpringActuator::~tgCompressionSpringActuator ( )
virtual

Destructor deletes the tgBulletCompressionSpring

Definition at line 116 of file tgCompressionSpringActuator.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 122 of file tgModel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void tgSubject< tgCompressionSpringActuator >::attach ( tgObserver< tgCompressionSpringActuator > *  pObserver)
inherited

Attach an observer to the subject of the observer.

Parameters
[in,out]pObservera pointer to an observer for the subject; do nothing if the pointer is NULL
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 128 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 141 of file tgModel.h.

Here is the call graph for this function:

double tgCompressionSpringActuator::getActuatorSpringForce ( )
virtual

Functions for interfacing with tgBulletCompressionSpring. NOTE that some of these are not implemented at the moment. If this class was to really become an actuator, these helper functions would probably be needed. Returns the starting distance between the two anchors. Note that this has little physical meaning, since the spring may not be applying a force at that distance. Returns the current distance between the two anchors. This isn't "length", really, since the spring length really is either: restLength (if getCurrentDistance is greater than restLength) getCurrentDistance (if getCurrentDistance is less than restLength). Returns the rest length of the spring, e.g., the Config restLength parameter. Returns the current force in the spring. This is equivalent to "tension" in a sense, but since this is a compression spring, it's better termed "spring force."

Definition at line 181 of file tgCompressionSpringActuator.cpp.

Here is the call graph for this function:

virtual const tgBulletCompressionSpring* tgCompressionSpringActuator::getCompressionSpring ( ) const
inlinevirtual

Returns a pointer to this spring's tgBulletCompressionSpring. Used by tgBulletRenderer.

Definition at line 223 of file tgCompressionSpringActuator.h.

Here is the caller 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 170 of file tgModel.cpp.

Here is the call graph for this function:

std::vector< tgSenseable * > tgModel::getSenseableDescendants ( ) const
virtualinherited

From tgSenseable: need to return all the children of this class. Since tgModels are tgSenseables, just return getDescendants().

Returns
a vector of tgModels, with pointers changed into pointers for tgSenseables.

For tgSenseable: just return the results of getDescendants here. This should be OK, since a vector of tgModel* is also a vector of tgSenseable*.

Reimplemented from tgSenseable.

Definition at line 191 of file tgModel.cpp.

Here is the call graph for this function:

void tgSubject< tgCompressionSpringActuator >::notifySetup ( )
inherited

Call tgObserver<T>::onSetup() on all observers in the order in which they were attached.

Here is the caller graph for this function:

void tgSubject< tgCompressionSpringActuator >::notifyStep ( double  dt)
inherited

Call tgObserver<T>::onStep() on all observers in the order in which they were attached.

Parameters
[in]dtthe number of seconds since the previous call; do nothing if not positive

Here is the caller graph for this function:

void tgSubject< tgCompressionSpringActuator >::notifyTeardown ( )
inherited

Call tgObserver<T>::onTeardown() on all observers in the order in which they were attached.

void tgCompressionSpringActuator::onVisit ( const tgModelVisitor r) const
virtual

Double dispatch function for a tgModelVisitor. This object will pass itself back to the visitor. Used for rendering and data logging as of May 2014.

Parameters
[in]r,thevisiting tgModelVisitor

Reimplemented from tgModel.

Reimplemented in tgUnidirComprSprActuator.

Definition at line 170 of file tgCompressionSpringActuator.cpp.

Here is the call graph for this function:

void tgCompressionSpringActuator::setControlInput ( double  input)
virtual

Functions required by tgControllable. As of 2016-08-02, all of these do nothing. Does nothing as of 2016-08-02. See tgBasicActuator for an implementation that could be re-used here.

The two required methods for this class to be a tgControllable.

Implements tgControllable.

Definition at line 189 of file tgCompressionSpringActuator.cpp.

void tgCompressionSpringActuator::setControlInput ( double  input,
double  dt 
)
virtual

Does nothing as of 2016-08-02. See tgBasicActuator for an implementation that could be re-used here.

Reimplemented from tgControllable.

Definition at line 193 of file tgCompressionSpringActuator.cpp.

void tgCompressionSpringActuator::setup ( tgWorld world)
virtual

Notifies observers of setup, calls setup on children

Parameters
[in]world,thetgWorld the models are being built into

Reimplemented from tgModel.

Reimplemented in tgUnidirComprSprActuator.

Definition at line 133 of file tgCompressionSpringActuator.cpp.

Here is the call graph for this function:

void tgCompressionSpringActuator::step ( double  dt)
virtual

Step dt forward with the simulation. Notifies observers of step, applies forces to rigid bodies via tgBulletCompressionSpring, logs history if desired, steps children.

Parameters
[in]dt,mustbe >= 0.0

The step function calls on the tgBulletCompressionSpring to apply forces. Since this class does not currently do any actuation, this function is the only place that things get updated at each timestep.

Reimplemented from tgModel.

Reimplemented in tgUnidirComprSprActuator.

Definition at line 151 of file tgCompressionSpringActuator.cpp.

void tgCompressionSpringActuator::teardown ( )
virtual

Notifies observers of teardown, teardown any children

Reimplemented from tgModel.

Reimplemented in tgUnidirComprSprActuator.

Definition at line 140 of file tgCompressionSpringActuator.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 152 of file tgModel.cpp.

Here is the caller graph for this function:

Member Data Documentation

tgBulletCompressionSpring* tgCompressionSpringActuator::m_compressionSpring
protected

the tgBulletCompressionSpring that belongs to this actuator.

Definition at line 250 of file tgCompressionSpringActuator.h.

Config tgCompressionSpringActuator::m_config
protected

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

Definition at line 256 of file tgCompressionSpringActuator.h.


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