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

#include <tgUnidirComprSprActuator.h>

Inheritance diagram for tgUnidirComprSprActuator:
Collaboration diagram for tgUnidirComprSprActuator:

Classes

struct  Config
 

Public Member Functions

 tgUnidirComprSprActuator (tgBulletUnidirComprSpr *compressionSpring, const tgTags &tags, tgUnidirComprSprActuator::Config &config)
 
virtual ~tgUnidirComprSprActuator ()
 
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

tgUnidirComprSprActuator::Config m_config
 
tgBulletCompressionSpringm_compressionSpring
 

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. Since it uses a tgBulletUnidirComprSpr, the force applied is only along one direction, not the full 3D vector of distance between nodes. E.g., if direction is (0, 1, 0), then the applied force is always in the vertical direction, and is proportional to only the vertical distance between nodes.

Definition at line 64 of file tgUnidirComprSprActuator.h.

Constructor & Destructor Documentation

tgUnidirComprSprActuator::tgUnidirComprSprActuator ( tgBulletUnidirComprSpr compressionSpring,
const tgTags tags,
tgUnidirComprSprActuator::Config config 
)

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

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

The main constructor for this class. Note that since direction is part of config, there is no private variable for it that needs to be assigned in this constructor. -DO: confirm the polymorphism of tgCompressionSpringActuator taking a tgBulletUnidirComprSpr, since that's a subclass of tgBulletCompressionSpring...

Definition at line 107 of file tgUnidirComprSprActuator.cpp.

tgUnidirComprSprActuator::~tgUnidirComprSprActuator ( )
virtual

Destructor does nothing.

Definition at line 124 of file tgUnidirComprSprActuator.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 ( )
virtualinherited

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
inlinevirtualinherited

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 tgUnidirComprSprActuator::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 tgCompressionSpringActuator.

Definition at line 174 of file tgUnidirComprSprActuator.cpp.

Here is the call graph for this function:

void tgCompressionSpringActuator::setControlInput ( double  input)
virtualinherited

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 
)
virtualinherited

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 tgUnidirComprSprActuator::setup ( tgWorld world)
virtual

Notifies observers of setup, calls setup on children

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

Reimplemented from tgCompressionSpringActuator.

Definition at line 134 of file tgUnidirComprSprActuator.cpp.

Here is the call graph for this function:

void tgUnidirComprSprActuator::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 tgBulletUnidirComprSpr 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 tgCompressionSpringActuator.

Definition at line 152 of file tgUnidirComprSprActuator.cpp.

void tgUnidirComprSprActuator::teardown ( )
virtual

Notifies observers of teardown, teardown any children

Reimplemented from tgCompressionSpringActuator.

Definition at line 141 of file tgUnidirComprSprActuator.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
protectedinherited

the tgBulletCompressionSpring that belongs to this actuator.

Definition at line 250 of file tgCompressionSpringActuator.h.

tgUnidirComprSprActuator::Config tgUnidirComprSprActuator::m_config
protected

Functions for interfacing with tgBulletUnidirComprSpr Like with tgCompressionSpringActuator, if this class was to ever really become an actuator, the following helper methods would probably be useful. 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." Used in places like ForcePlateModel to pass through information about the underlying tgBulletUnidirComprSpr. A copy of the configuration struct supplied at constuction. This is not const. Override the base config to get the extra parameters.

Definition at line 204 of file tgUnidirComprSprActuator.h.


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