NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgSensorInfo Class Referenceabstract

#include <tgSensorInfo.h>

Inherited by tgCompoundRigidSensorInfo, tgRodSensorInfo, and tgSpringCableActuatorSensorInfo.

Public Member Functions

 tgSensorInfo ()
virtual ~tgSensorInfo ()
virtual bool isThisMySenseable (tgSenseable *pSenseable)=0
virtual std::vector< tgSensor * > createSensorsIfAppropriate (tgSenseable *pSenseable)=0

Detailed Description

tgSensorInfo is an abstract class that contains methods for creating sensors. This is how a tgDataManager will create sensors for specific tgSenseable objects (e.g., how a tgDataLogger2 will create sensors for specific tgModels.) Note that an individual tgSensorInfo may return multiple sensors upon a single call to createSensorsIfAppropriate - this would be the case for e.g. tgCompoundRigidSensor, but in most cases (e.g. rods and spring-cables) only one sensor is returned.

Definition at line 51 of file tgSensorInfo.h.

Constructor & Destructor Documentation

tgSensorInfo::tgSensorInfo ( )

Empty constructor and destructor. Note that the destructor must be virtual also, since this is a class with virtual member functions.

Empty constructor.

Definition at line 37 of file tgSensorInfo.cpp.

tgSensorInfo::~tgSensorInfo ( )

A class with virtual member functions must have a virtual destructor.

Definition at line 42 of file tgSensorInfo.cpp.

Member Function Documentation

virtual std::vector<tgSensor*> tgSensorInfo::createSensorsIfAppropriate ( tgSenseable pSenseable)
pure virtual

Next, this class needs to be able to actually create one or more sensors.

[in]pSenseablea pointer to the tgSenseable object that is to be sensed.
a vector of pointers to any sensors that were created. This list can have zero elements, for example in the case that all possible sensors have already been created for an object. Note that it's up to the subclasses to make sure that redundant sensors are not created. One way to do this, for example, is to only create sensors for the "leaf" descendants. That would be how (for example) tgRodSensorInfo works: by only creating sensors for tgSenseables that can be cast to tgRods, we can be sure that only one sensors is made per rod, since any individual rod will only be passed in ONCE to this function. However, for more complicated situations, like tgCompoundRigidSensor, a subclass would need to keep track of e.g. which compound rigids have been assigned a sensor, so as to not create multiple for the same compound rigid. In short, return the least number of sensors possible, and if dealing directly with children of tgModel, then don't create any sensors for the tgModel itself, just its children.

Implemented in tgCompoundRigidSensorInfo, tgRodSensorInfo, and tgSpringCableActuatorSensorInfo.

virtual bool tgSensorInfo::isThisMySenseable ( tgSenseable pSenseable)
pure virtual

First, a tgSensorInfo should be able to determine if it can create at least one sensor for a specific tgSenseable object. This is the first step in creating sensors, first check then create.

[in]pSenseablea pointer to a senseable object (usually a tgModel), which either can or cannot be sensed by whatever particular sensor would be created by this tgSensorInfo.
if it's possible for this sensor info to create a sensor for the given tgSenseable object.

Implemented in tgCompoundRigidSensorInfo, tgRodSensorInfo, and tgSpringCableActuatorSensorInfo.

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