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

#include <tgCompoundRigidSensor.h>

Inheritance diagram for tgCompoundRigidSensor:
Collaboration diagram for tgCompoundRigidSensor:

Public Member Functions

 tgCompoundRigidSensor (tgModel *pModel)
 
 tgCompoundRigidSensor (tgModel *pModel, std::string tag)
 
virtual ~tgCompoundRigidSensor ()
 
virtual std::vector< std::string > getSensorDataHeadings ()
 
virtual std::vector< std::string > getSensorData ()
 

Protected Attributes

tgSenseablem_pSens
 

Detailed Description

This class extends tgSensor to sense a compound rigid body. It takes in a tgModel as a pointer. Note that unlike tgRodSensor etc., a tgCompoundRigidSensor requires that a tag of the compound to sense is passed in. In order for this sensor framework to function "nicely", one tgCompoundRigidSensor should only output data from one compound rigid. That requires specifying WHICH compound rigid to sense, since many tgModels have more than one compound rigid inside them.

Definition at line 50 of file tgCompoundRigidSensor.h.

Constructor & Destructor Documentation

tgCompoundRigidSensor::tgCompoundRigidSensor ( tgModel pModel)

The first constructor for tgCompoundRigidSensor. This one takes only a pointer to a tgModel. In the future, it should sense ALL possible compound rigids in the model, but for now, have it just fail if not provided a tag.

Parameters
[in]pModela pointer to a tgModel that this sensor will attach itself to.
Exceptions
invalid_argumentsince this constructor should never be called, it's always an invalid argument.

This class is a sensor for tgCompoundRigids. The constructor with only a pointer will always fail, since it's required that a compound tag be passed in too, otherwise either (a) the sensor doesn't know which compound to sense, or (b) if the sensor will sense ALL the compounds, that could create duplicate sensors for the same compound and also breaks the 1-sensor-per -object rule.

Definition at line 60 of file tgCompoundRigidSensor.cpp.

tgCompoundRigidSensor::tgCompoundRigidSensor ( tgModel pModel,
std::string  tag 
)

The second constructor for tgCompoundRigidSensor. This one takes a pointer to a tgModel, as well as a single tag that's the compound tag for the compound that should be sensed.

Parameters
[in]pModela pointer to a tgModel that this sensor will attach itself to.
[in]taga string that's the compound tag.
Exceptions
invalidargument, if the tag doesn't exist in the model.

The actual constructor. This calls the parent, then populates the list of

Definition at line 69 of file tgCompoundRigidSensor.cpp.

Here is the call graph for this function:

tgCompoundRigidSensor::~tgCompoundRigidSensor ( )
virtual

A class with virtual member functions must have a virtual destructor. Note that management of the pointer to the tgModel (tgSenseable) is managed by the destructor for tgSensor.

Definition at line 106 of file tgCompoundRigidSensor.cpp.

Member Function Documentation

std::vector< std::string > tgCompoundRigidSensor::getSensorData ( )
virtual

The method that collects the actual data from this compound rigid body.

Implements tgSensor.

Definition at line 228 of file tgCompoundRigidSensor.cpp.

std::vector< std::string > tgCompoundRigidSensor::getSensorDataHeadings ( )
virtual

Similarly, this class will implement the two data colleciton methods. Note that for getSensorDataHeadings, the only tag included here is the compound rigid body tag. TO-DO: maybe take the union of all tags of the consistutent rigid bodies?

The two methods from tgSensor. A compound rigid body has a position (center of mass of all bodies) as wel as an orientation (which we'll define in a certain way below). Also, the previous tgDataObserver recorded the mass of the rigid bodies too, so do that here for consistency. (even though mass doesn't change with time.)

Headings should have the following form: The type of sensor, then an open parenthesis "(" and the tags of the specific tgSenseable object, then a ")." and a label for the specific field that will be output in that row. For example, if sensor will be sensing a rod with tags "t4 t5", its label for the X position might be "rod(t4 t5).X"

Implements tgSensor.

Definition at line 187 of file tgCompoundRigidSensor.cpp.

Member Data Documentation

tgSenseable* tgSensor::m_pSens
protectedinherited

This class stores a pointer to its tgSenseable object. Note that it is protected so that subclasses can access it, but children will still need to cast it against their specific type of tgSenseable (e.g., rod, cable, etc.)

Definition at line 102 of file tgSensor.h.


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