NTRT Simulator
Version: Master
|
#include <tgCompressionSpringActuator.h>
Inherits tgModel, tgControllable, and tgSubject< tgCompressionSpringActuator >.
Inherited by tgUnidirComprSprActuator.
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 () |
tgTags & | getTags () |
const tgTags & | getTags () 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 | |
tgBulletCompressionSpring * | m_compressionSpring |
Config | m_config |
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.
tgCompressionSpringActuator::tgCompressionSpringActuator | ( | tgBulletCompressionSpring * | compressionSpring, |
const tgTags & | tags, | ||
tgCompressionSpringActuator::Config & | config | ||
) |
THE MAIN CONSTRUCTOR FOR THIS CLASS. Constructor using tags. Typically called in tgCompressionSpringActuatorInfo.cpp
[in] | compressionSpring,the | tgBulletCompressionSpring object that this controls and logs. Set up in tgCompressionSpringActuatorInfo.cpp |
[in] | tags | as passed through tgStructure and tgStructureInfo |
[in] | config | Holds member variables defined here. |
The main constructor for this class.
Definition at line 98 of file tgCompressionSpringActuator.cpp.
|
virtual |
Destructor deletes the tgBulletCompressionSpring
Definition at line 116 of file tgCompressionSpringActuator.cpp.
|
inherited |
Add a sub-model to this model. The model takes ownership of the child sub-model and is responsible for deallocating it.
[in,out] | pChild | a pointer to a sub-model |
std::invalid_argument | is pChild is NULL, this object, or already a descendant |
Definition at line 122 of file tgModel.cpp.
|
inherited |
Attach an observer to the subject of the observer.
[in,out] | pObserver | a pointer to an observer for the subject; do nothing if the pointer is NULL |
|
inlineinherited |
Get a vector of descendants sorted by type and a tagsearch. Useful for pulling out muscle groups, or similar.
[in] | tagSearch,a | tagSearch that contains the desired tags |
Definition at line 128 of file tgModel.h.
|
inlineinherited |
Get a vector of descendants sorted by type and a tagsearch. Useful for pulling out muscle groups, or similar.
[in] | tagSearch,a | std::string& that contains the desired tags |
Definition at line 141 of file tgModel.h.
|
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.
|
inlinevirtual |
Returns a pointer to this spring's tgBulletCompressionSpring. Used by tgBulletRenderer.
Definition at line 223 of file tgCompressionSpringActuator.h.
|
inherited |
Return a std::vector of const pointers to all sub-models.
Definition at line 170 of file tgModel.cpp.
|
virtualinherited |
From tgSenseable: need to return all the children of this class. Since tgModels are tgSenseables, just return getDescendants().
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.
|
inherited |
Call tgObserver<T>::onSetup() on all observers in the order in which they were attached.
|
inherited |
Call tgObserver<T>::onStep() on all observers in the order in which they were attached.
[in] | dt | the number of seconds since the previous call; do nothing if not positive |
|
inherited |
Call tgObserver<T>::onTeardown() on all observers in the order in which they were attached.
|
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.
[in] | r,the | visiting tgModelVisitor |
Reimplemented from tgModel.
Reimplemented in tgUnidirComprSprActuator.
Definition at line 170 of file tgCompressionSpringActuator.cpp.
|
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.
|
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.
|
virtual |
Notifies observers of setup, calls setup on children
[in] | world,the | tgWorld the models are being built into |
Reimplemented from tgModel.
Reimplemented in tgUnidirComprSprActuator.
Definition at line 133 of file tgCompressionSpringActuator.cpp.
|
virtual |
Step dt forward with the simulation. Notifies observers of step, applies forces to rigid bodies via tgBulletCompressionSpring, logs history if desired, steps children.
[in] | dt,must | be >= 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.
|
virtual |
Notifies observers of teardown, teardown any children
Reimplemented from tgModel.
Reimplemented in tgUnidirComprSprActuator.
Definition at line 140 of file tgCompressionSpringActuator.cpp.
|
virtualinherited |
Returns the tag names of this model and its children
[in] | prefix | a string to append to |
Definition at line 152 of file tgModel.cpp.
|
protected |
the tgBulletCompressionSpring that belongs to this actuator.
Definition at line 250 of file tgCompressionSpringActuator.h.
|
protected |
A copy of the configuration POD supplied at constuction. This is not const.
Definition at line 256 of file tgCompressionSpringActuator.h.