Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

gadget::SimRelativePosition Class Reference

Simulated a position device by making. More...

#include <SimRelativePosition.h>

Inheritance diagram for gadget::SimRelativePosition:

Inheritance graph
[legend]
Collaboration diagram for gadget::SimRelativePosition:

Collaboration graph
[legend]
List of all members.

Public Methods

 SimRelativePosition ()
virtual ~SimRelativePosition ()
virtual bool config (jccl::ConfigElementPtr element)
 Config method. More...

bool startSampling ()
 These functions don't do anything. More...

bool stopSampling ()
 StopSampling. More...

bool sample ()
 Sample the device. More...

virtual void updateData ()
 Updates the data. More...

void operator delete (void *p)
 Invokes the global scope delete operator. More...


Static Public Methods

std::string getElementType ()
 Returns the string rep of the element type used to config this device. More...


Protected Methods

virtual void destroy ()
 Deletes this object. More...


Detailed Description

Simulated a position device by making.

An existing device behave relative to another one.

One device is the base coordinate system frame of reference. The other device has it's position information transformed to be relative to that frame. ie. There is a matrix multiply.

This class should not be used directly by the user.

Definition at line 58 of file SimRelativePosition.h.


Constructor & Destructor Documentation

gadget::SimRelativePosition::SimRelativePosition   [inline]
 

Definition at line 61 of file SimRelativePosition.h.

00061 {;}

virtual gadget::SimRelativePosition::~SimRelativePosition   [inline, virtual]
 

Definition at line 62 of file SimRelativePosition.h.

00062 {;}


Member Function Documentation

bool gadget::SimRelativePosition::config jccl::ConfigElementPtr    element [virtual]
 

Config method.

This baselevel config will fill the base datamembers when found in the jccl::ConfigElementPtr such as instance name.

Reimplemented from gadget::Input.

Definition at line 47 of file SimRelativePosition.cpp.

00048 {
00049    if(! (Input::config(element) && Position::config(element)))
00050    {
00051       return false;
00052    }
00053 
00054    // Initialize the positional devices
00055    std::string base_frame_proxy = element->getProperty<std::string>("base_frame_proxy");
00056    std::string relative_pos_proxy = element->getProperty<std::string>("relative_proxy");
00057 
00058    mBaseFrame.init(base_frame_proxy);
00059    mRelativePos.init(relative_pos_proxy);
00060    return true;
00061 }

bool gadget::SimRelativePosition::startSampling   [inline, virtual]
 

These functions don't do anything.

Implements gadget::Input.

Definition at line 67 of file SimRelativePosition.h.

00067 { return 1; }

bool gadget::SimRelativePosition::stopSampling   [inline, virtual]
 

StopSampling.

Reverse the effects of StartSampling().

Implements gadget::Input.

Definition at line 68 of file SimRelativePosition.h.

00068 { return 1; }

bool gadget::SimRelativePosition::sample   [inline, virtual]
 

Sample the device.

Read the next set of input. This method is normally used internally by threaded drivers to repetively sample data in a separate thread. (This new data is not accessable until UpdateData is called)

Implements gadget::Input.

Definition at line 69 of file SimRelativePosition.h.

00069 { return 1; }

void gadget::SimRelativePosition::updateData   [virtual]
 

Updates the data.

Implements gadget::Input.

Definition at line 64 of file SimRelativePosition.cpp.

References gadget::Position::addPositionSample, and gadget::Position::swapPositionBuffers.

00065 {
00066    gmtl::mult( mPos.mPosData, mBaseFrame->getData(gadget::PositionUnitConversion::ConvertToMeters), 
00067                               mRelativePos->getData(gadget::PositionUnitConversion::ConvertToMeters) );
00068 
00069    // NOTE: This is a little bit of an overkill, but it works and it allows for the
00070    //       buffering that could be needed in multi-threaded cases
00071    mPos.setTime();   // Set the time
00072    addPositionSample(std::vector< gadget::PositionData>(1, mPos) );   
00073 
00074    swapPositionBuffers(); // Swap the buffers
00075 }

std::string gadget::SimRelativePosition::getElementType   [static]
 

Returns the string rep of the element type used to config this device.

This string is used by the device factory to look up device drivers based up the type of element it is trying to load.

Reimplemented from gadget::Input.

Definition at line 42 of file SimRelativePosition.cpp.

00043 {
00044    return "simulated_relative_position";
00045 }

void gadget::SimRelativePosition::operator delete void *    p [inline]
 

Invokes the global scope delete operator.

This is required for proper releasing of memory in DLLs on Win32.

Definition at line 80 of file SimRelativePosition.h.

00081    {
00082       ::operator delete(p);
00083    }

virtual void gadget::SimRelativePosition::destroy   [inline, protected, virtual]
 

Deletes this object.

This is an implementation of the pure virtual gadget::Input::destroy() method.

Implements gadget::Input.

Definition at line 90 of file SimRelativePosition.h.

00091    {
00092       delete this;
00093    }


The documentation for this class was generated from the following files:
Generated on Sun May 2 14:26:51 2004 for Gadgeteer by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002