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

#include <TensegrityModel.h>

Inheritance diagram for TensegrityModel:
Collaboration diagram for TensegrityModel:

Public Member Functions

 TensegrityModel (const std::string &structurePath)
 
 TensegrityModel (const std::string &structurePath, bool debugging)
 
virtual ~TensegrityModel ()
 
virtual void setup (tgWorld &world)
 
virtual void teardown ()
 
virtual void step (double timeStep)
 
virtual void onVisit (tgModelVisitor &visitor)
 
const std::vector
< tgSpringCableActuator * > & 
getAllActuators () const
 
void attach (tgObserver< TensegrityModel > *pObserver)
 
void notifyStep (double dt)
 
void notifySetup ()
 
void notifyTeardown ()
 
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
 
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
 

Public Attributes

std::string topLvlStructurePath
 
bool debugging_on = false
 

Static Public Attributes

static const double rodRadius = 0.5
 
static const double rodDensity = 1.0
 
static const double rodFriction = 1.0
 
static const double rodRollFriction = 0.0
 
static const double rodRestitution = 0.2
 
static const double boxWidth = 1.0
 
static const double boxHeight = 1.0
 
static const double boxDensity = 1.0
 
static const double boxFriction = 1.0
 
static const double boxRollFriction = 0.0
 
static const double boxRestitution = 0.2
 
static const double sphereRadius = 0.5
 
static const double sphereDensity = 1.0
 
static const double sphereFriction = 1.0
 
static const double sphereRollFriction = 0.0
 
static const double sphereRestitution = 0.2
 
static const double stringStiffness = 1000.0
 
static const double stringDamping = 10.0
 
static const double stringPretension = 0.0
 
static const double stringRadius = 1.0
 
static const double stringMotorFriction = 0.0
 
static const double stringMotorInertia = 1.0
 
static const double stringBackDrivable = 0
 
static const double stringHistory = 0
 
static const double stringMaxTension = 1000.0
 
static const double stringTargetVelocity = 100.0
 
static const double stringMinActualLength = 0.1
 
static const double stringMinRestLength = 0.1
 
static const double stringRotation = 0
 
static const bool stringMoveCablePointAToEdge = true
 
static const bool stringMoveCablePointBToEdge = true
 

Detailed Description

A class that constructs a model based on a tensegrity structure encoded in YAML.

Definition at line 55 of file TensegrityModel.h.

Constructor & Destructor Documentation

TensegrityModel::TensegrityModel ( const std::string &  structurePath)

The simplest constructor. This constructor sets debugging_on = false.

Parameters
[in]structurePaththe path of the YAML-encoded structure

Constructor that only takes the path to the YAML file.

Definition at line 48 of file TensegrityModel.cpp.

TensegrityModel::TensegrityModel ( const std::string &  structurePath,
bool  debugging 
)

Constructor that takes 'debugging' as a parameter.

Parameters
[in]structurePaththe path of the YAML-encoded structure
[in]debuggingthe flag that controls debugging output on/off.

Constructor that includes the debugging flag.

Definition at line 55 of file TensegrityModel.cpp.

TensegrityModel::~TensegrityModel ( )
virtual

Destructor. Deletes controllers, if any were added during setup. Teardown handles everything else.

Definition at line 63 of file TensegrityModel.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< TensegrityModel >::attach ( tgObserver< TensegrityModel > *  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:

const std::vector< tgSpringCableActuator * > & TensegrityModel::getAllActuators ( ) const

Returns a vector of all muscles for the controllers to work with.

Returns
A vector of all of the muscles

Definition at line 921 of file TensegrityModel.cpp.

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< TensegrityModel >::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< TensegrityModel >::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< TensegrityModel >::notifyTeardown ( )
inherited

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

Here is the caller graph for this function:

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 tgCompressionSpringActuator, tgUnidirComprSprActuator, ConnectorTestModel, BuildTestModel, tgKinematicActuator, tgSphere, tgBox, tgRod, ContactCableDemo, tgBasicActuator, hillyMuscleNP, simpleMuscleNP, tgBoxMoreAnchors, tgBaseRigid, and tgGhostModel.

Definition at line 107 of file tgModel.cpp.

Here is the call graph for this function:

void TensegrityModel::onVisit ( tgModelVisitor visitor)
virtual

Receives a tgModelVisitor and dispatches itself into the visitor's 'render' function. This model will go to the default tgModel function, which does nothing.

Parameters
[in]visitora tgModelVisitor which will pass this model back to itself

Definition at line 917 of file TensegrityModel.cpp.

Here is the call graph for this function:

void TensegrityModel::setup ( tgWorld world)
virtual

Create the model. Places the rods and strings into the world that is passed into the simulation. This is triggered automatically when the model is added to the simulation, when tgModel::setup(world) is called (if this model is a child), and when reset is called. Also notifies controllers of setup.

Parameters
[in]worldthe world we're building into

The setup function is what's called from outside this class. It is responsible for creating all the parts of this tgModel and calling the tgStructureInfo to build the structure into the world.

Reimplemented from tgModel.

Definition at line 85 of file TensegrityModel.cpp.

void TensegrityModel::step ( double  timeStep)
virtual

Step the model, its children. Notifies controllers of step.

Parameters
[in]timeStepthe timestep, must be positive.

Reimplemented from tgModel.

Definition at line 907 of file TensegrityModel.cpp.

Here is the call graph for this function:

void TensegrityModel::teardown ( )
virtual

Undoes setup. Deletes child models. Called automatically on reset and end of simulation. Notifies controllers of teardown

Reimplemented from tgModel.

Definition at line 925 of file TensegrityModel.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

bool TensegrityModel::debugging_on = false

Boolean flag that enables or disables debugging. All places this flag works in TensegrityModel.cpp can be found by searching through that file for the string "DEBUGGING".

Definition at line 199 of file TensegrityModel.h.

const double TensegrityModel::rodRadius = 0.5
static

List of all the default config parameters for all the types of objects that wil be supported.

Definition at line 69 of file TensegrityModel.h.


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