Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Feedback Class Reference

A Feedback is a representation for force-feedback. Subclass this for specific haptic devices. More...

#include <P_Feedback.h>

Inheritance diagram for Feedback:

VRPNFeedback List of all members.

Public Methods

 Feedback ()
 Constructor: initialize variables, but do not establish any connection. More...

virtual ~Feedback ()
virtual const char * device_name () const=0
 Device name; must be unique to other Feedback subclasses. More...

virtual Feedback * clone ()=0
int start (const SensorConfig *config)
 Establish connection to remote device in the start() method, not in the constructor. More...

virtual void update ()=0
virtual void addconstraint (float k, const float *location)=0
 corresponding functions that should just add force on to whatever is already present --- since forces and jacobians add linearly, this works! Units are all NEWTONS. More...

virtual void addforcefield (const float *origin, const float *force, const float *jacobian)=0
virtual void addplaneconstraint (float k, const float *point, const float *normal)=0
virtual void zeroforce ()=0
 zeros out the constructed force (does not send a message to the haptic until sendforce is called!). More...

virtual void forceoff ()=0
 stop forces (actually sends a message). More...

virtual void sendforce (const float *initial_pos)=0
 send the force that has been constructed -- we have this so the force can be built up in several parts, using the additive functions, and no incorrect forces are ever sent. The argument is the current position of the corresponding tracker - it may be used to check that the force doesn't exceed the max. More...

void set_maxforce (float m)
 set/get maxforce The max force is given by "maxforce" - if it is less than 0, no maximum is enforced. More...

float get_maxforce () const

Protected Methods

virtual int do_start (const SensorConfig *)
 Do device-specific startup configuration. Return success. More...


Protected Attributes

float maxforce

Detailed Description

A Feedback is a representation for force-feedback. Subclass this for specific haptic devices.

Common notes for VMDTracker, Feedback, and Buttons classes, collectively referred to as devices in what follows.

Constructor: The constructor must not require any input arguments. The reason for this is that an instance of every class is created and held in an associative store so that it can be referenced by its device_name() string. This instantiation is done independently of any device configuration, such as what would be found in the .vmdsensors file. Constructors should thus do nothing but initialize member data to NULL or default values.

device_name(): This pure virtual function supplies a string by which the device can be accessed in an associative store (since classes aren't first-class objects in C++). The name must be unique to that class, among all devices of that type.

clone(): This should do nothing more that return an instance of the class.

do_start(const SensorConfig *): Here's where the action is: This method will be called from the base class start() method after general initialization is done. This method is where the subclass should, e.g., establish a connection to a remote device. If there is no class-specific initialization to do then the subclass need not override this method.

start() should be called only once in a device's life, when it is first added to a Tool.

Definition at line 65 of file P_Feedback.h.


Constructor & Destructor Documentation

Feedback::Feedback   [inline]
 

Constructor: initialize variables, but do not establish any connection.

Definition at line 68 of file P_Feedback.h.

References maxforce.

virtual Feedback::~Feedback   [inline, virtual]
 

Definition at line 69 of file P_Feedback.h.


Member Function Documentation

virtual void Feedback::addconstraint float    k,
const float *    location
[pure virtual]
 

corresponding functions that should just add force on to whatever is already present --- since forces and jacobians add linearly, this works! Units are all NEWTONS.

Implemented in VRPNFeedback.

Referenced by Tool::setconstraint.

virtual void Feedback::addforcefield const float *    origin,
const float *    force,
const float *    jacobian
[pure virtual]
 

Implemented in VRPNFeedback.

Referenced by Tool::setforcefield.

virtual void Feedback::addplaneconstraint float    k,
const float *    point,
const float *    normal
[pure virtual]
 

Implemented in VRPNFeedback.

Referenced by Tool::addplaneconstraint, and Tool::setplaneconstraint.

virtual Feedback* Feedback::clone   [pure virtual]
 

Implemented in VRPNFeedback.

virtual const char* Feedback::device_name   const [pure virtual]
 

Device name; must be unique to other Feedback subclasses.

Implemented in VRPNFeedback.

virtual int Feedback::do_start const SensorConfig   [inline, protected, virtual]
 

Do device-specific startup configuration. Return success.

Reimplemented in VRPNFeedback.

Definition at line 118 of file P_Feedback.h.

Referenced by start.

virtual void Feedback::forceoff   [pure virtual]
 

stop forces (actually sends a message).

Implemented in VRPNFeedback.

Referenced by Tool::forceoff.

float Feedback::get_maxforce   const [inline]
 

Definition at line 112 of file P_Feedback.h.

References maxforce.

virtual void Feedback::sendforce const float *    initial_pos [pure virtual]
 

send the force that has been constructed -- we have this so the force can be built up in several parts, using the additive functions, and no incorrect forces are ever sent. The argument is the current position of the corresponding tracker - it may be used to check that the force doesn't exceed the max.

Implemented in VRPNFeedback.

Referenced by Tool::sendforce.

void Feedback::set_maxforce float    m [inline]
 

set/get maxforce The max force is given by "maxforce" - if it is less than 0, no maximum is enforced.

Definition at line 111 of file P_Feedback.h.

References maxforce.

Referenced by VRPNFeedback::do_start, and start.

int Feedback::start const SensorConfig   config [inline]
 

Establish connection to remote device in the start() method, not in the constructor.

Definition at line 77 of file P_Feedback.h.

References do_start, SensorConfig::getmaxforce, and set_maxforce.

Referenced by Tool::add_feedback.

virtual void Feedback::update   [pure virtual]
 

Implemented in VRPNFeedback.

virtual void Feedback::zeroforce   [pure virtual]
 

zeros out the constructed force (does not send a message to the haptic until sendforce is called!).

Implemented in VRPNFeedback.

Referenced by Tool::setconstraint, Tool::setforcefield, and Tool::setplaneconstraint.


Member Data Documentation

float Feedback::maxforce [protected]
 

Definition at line 115 of file P_Feedback.h.

Referenced by Feedback, get_maxforce, VRPNFeedback::sendforce, and set_maxforce.


The documentation for this class was generated from the following file:
Generated on Fri Apr 19 02:46:50 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002