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

#include <tgBulletSpringCable.h>

Inheritance diagram for tgBulletSpringCable:
Collaboration diagram for tgBulletSpringCable:

Public Member Functions

 tgBulletSpringCable (const std::vector< tgBulletSpringCableAnchor * > &anchors, double coefK, double dampingCoefficient, double pretension=0.0)
 
virtual ~tgBulletSpringCable ()
 
virtual void step (double dt)
 
virtual const double getActualLength () const
 
virtual const double getTension () const
 
virtual const std::vector
< const tgSpringCableAnchor * > 
getAnchors () const
 
virtual const double getRestLength () const
 
virtual void setRestLength (const double newRestLength)
 
virtual const double getCoefK () const
 
virtual const double getCoefD () const
 
virtual const double getVelocity () const
 
virtual const double getDamping () const
 

Protected Attributes

std::vector
< tgBulletSpringCableAnchor * > 
m_anchors
 
tgBulletSpringCableAnchor *const anchor1
 
tgBulletSpringCableAnchor *const anchor2
 
double m_damping
 
double m_velocity
 
const double m_coefK
 
const double m_dampingCoefficient
 
double m_restLength
 
double m_prevLength
 

Detailed Description

This class defines the passive dynamics of a spring-cable system in the Bullet physics engine Formerly known as Muscle2P

Definition at line 47 of file tgBulletSpringCable.h.

Constructor & Destructor Documentation

tgBulletSpringCable::tgBulletSpringCable ( const std::vector< tgBulletSpringCableAnchor * > &  anchors,
double  coefK,
double  dampingCoefficient,
double  pretension = 0.0 
)

The only constructor. Takes a list of anchors, a coefficient of stiffness, a coefficent of damping, and optionally the amount of pretension in the cable

Parameters
[in]anchors- a list of this spring cable's attachements
[in]coefK- the stiffness of the spring. Must be positive
[in]dampingCoefficient- the damping in the spring. Must be non-negative
[in]pretension- must be small enough to keep the rest length positive

Definition at line 35 of file tgBulletSpringCable.cpp.

tgBulletSpringCable::~tgBulletSpringCable ( )
virtual

The virtual destructor. Deletes all of the anchors including anchor1 and anchor2

Definition at line 51 of file tgBulletSpringCable.cpp.

Member Function Documentation

const double tgBulletSpringCable::getActualLength ( ) const
virtual

Finds the distance between anchor1 and anchor2, and returns the length between them

Implements tgSpringCable.

Reimplemented in tgBulletContactSpringCable.

Definition at line 143 of file tgBulletSpringCable.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

const std::vector< const tgSpringCableAnchor * > tgBulletSpringCable::getAnchors ( ) const
virtual

Returns a const vector of const anchors. Currently casts from tgBulletSpringCableAnchors, which makes it impossible to return a reference

Todo:
figure out how to cast and pass by reference

Implements tgSpringCable.

Definition at line 157 of file tgBulletSpringCable.cpp.

virtual const double tgSpringCable::getCoefD ( ) const
inlinevirtualinherited

Get the coefficent of damping

Definition at line 103 of file tgSpringCable.h.

virtual const double tgSpringCable::getCoefK ( ) const
inlinevirtualinherited

Get the coefficent of stiffness

Definition at line 95 of file tgSpringCable.h.

Here is the caller graph for this function:

virtual const double tgSpringCable::getDamping ( ) const
inlinevirtualinherited

Get the last value of the damping force

Definition at line 119 of file tgSpringCable.h.

const double tgSpringCable::getRestLength ( ) const
virtualinherited

Returns m_restLength

Definition at line 66 of file tgSpringCable.cpp.

const double tgBulletSpringCable::getTension ( ) const
virtual

Returns the tension currently in the string by multiplying the difference between the actual length and the rest length by the stiffness coefficient

Implements tgSpringCable.

Definition at line 150 of file tgBulletSpringCable.cpp.

Here is the call graph for this function:

virtual const double tgSpringCable::getVelocity ( ) const
inlinevirtualinherited

Get the last change in length / time

Definition at line 111 of file tgSpringCable.h.

Here is the caller graph for this function:

void tgSpringCable::setRestLength ( const double  newRestLength)
virtualinherited

Sets m_restLength to newRestLength.

Parameters
[in]newRestLength,mustbe non-negative

Definition at line 71 of file tgSpringCable.cpp.

Here is the caller graph for this function:

void tgBulletSpringCable::step ( double  dt)
virtual

Updates this object. Calls calculateAndApplyForce(dt)

Parameters
[in]dt,mustbe positive

Implements tgSpringCable.

Reimplemented in tgBulletContactSpringCable.

Definition at line 79 of file tgBulletSpringCable.cpp.

Member Data Documentation

tgBulletSpringCableAnchor* const tgBulletSpringCable::anchor1
protected

The first attachement point for this spring cable. Storing it seperately makes a number of functions easier

Definition at line 111 of file tgBulletSpringCable.h.

tgBulletSpringCableAnchor* const tgBulletSpringCable::anchor2
protected

The other permanent attachment for this spring cable.

Definition at line 116 of file tgBulletSpringCable.h.

std::vector<tgBulletSpringCableAnchor*> tgBulletSpringCable::m_anchors
protected

The list of contact points. tgBulletSpringCable typically has two whereas tgBulletContactSpringCable will have more. Needs to be stored here for consistent rendering. Vector has the convienence of tgCast functions, and we used to need a random iterator to sort

Definition at line 105 of file tgBulletSpringCable.h.

const double tgSpringCable::m_coefK
protectedinherited

The stiffness coefficient Units of mass / sec ^2 Must be positive

Definition at line 149 of file tgSpringCable.h.

double tgSpringCable::m_damping
protectedinherited

The previous value of the damping force. Stored so we can get it without passing a dt

Definition at line 136 of file tgSpringCable.h.

const double tgSpringCable::m_dampingCoefficient
protectedinherited

The damping coefficient. Units of mass / sec. Must be non-negative

Definition at line 156 of file tgSpringCable.h.

double tgSpringCable::m_prevLength
protectedinherited

The previous actual length of the string. Used when calculating force and velocity

Definition at line 168 of file tgSpringCable.h.

double tgSpringCable::m_restLength
protectedinherited

The rest length of the string. Must be non negative

Definition at line 162 of file tgSpringCable.h.

double tgSpringCable::m_velocity
protectedinherited

The velocity of the string at the last update step. Stored so we can get it without passing a dt

Definition at line 142 of file tgSpringCable.h.


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