CHAI3D - V-REP MODULE  1.0.0
Object Class Reference

Data structure that contains an object of type ObjectType used to generate haptic feedback.

Public Member Functions

 Object (float pos[3], float rot[3], vector< float >vertices, vector< int > indices, float stiffness)
 SHAPE constructor. More...
 
 Object (ObjectType constraintType, int device, float pos[3], float dir[3], float Kp, float Kv, float Fmax)
 Constraints constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void SetTarget (float pos[3], float rot[3], float stiffness)
 Set new SHAPE target state. More...
 
void SetTarget (float pos[3], float dir[3], float Kp, float Kv, float Fmax)
 Set new constraint target state. More...
 
void Update (double t)
 Interpolate all object parameters to a given timestamp. More...
 
void ComputeForce ()
 Compute additional force contribution for a given Device position and velocity. More...
 

Public Attributes

ObjectType Type
 Object type. More...
 
int Device
 Internal handle to a Device assigned to this object. More...
 
cMesh * Mesh
 Object mesh that this object renders haptically in the scene. More...
 
State S
 Current object state. More...
 

Private Member Functions

void SetTarget ()
 Set new target state. This method is shared by SetTarget(float pos[3], float rot[3], float stiffness) and SetTarget(float pos[3], float dir[3], float Kp, float Kv, float Fmax). More...
 

Private Attributes

double t0
 Initial object timestamp. More...
 
State S0
 Initial object state. More...
 
double tT
 Target state timestamp. More...
 
State ST
 Target object state. More...
 

Constructor & Destructor Documentation

Object::Object ( float  pos[3],
float  rot[3],
vector< float >  vertices,
vector< int >  indices,
float  stiffness 
)
inline

This member creates a new SHAPE and adds it to the scene.

Parameters
posSHAPE position in the scene, expressed in m.
rotSHAPE orientation in the scene, expressed as ZYX extrinsic Euler angles.
verticeslist of vertices that define the Mesh member.
indiceslist of vertex indices that define the Mesh triangles.
stiffnessobject stiffness, expressed in N/m.
Object::Object ( ObjectType  constraintType,
int  device,
float  pos[3],
float  dir[3],
float  Kp,
float  Kv,
float  Fmax 
)
inline

This member creates a new constraint and adds it to the scene.

Parameters
constraintTypetype of constraint to create.
devicedevice handle (returned by hapticConnect()) to assign this constraint to.
posconstraint position in the scene, expressed in m.
dirconstraint direction, as defined in ObjectType.
Kpconstraint stiffness, expressed in N/m.
Kvconstraint viscosity, expressed in N/(m/s).
Fmaxconstraint max force for Kp, expressed in N.
virtual Object::~Object ( )
inlinevirtual

Member Function Documentation

void Object::SetTarget ( )
inlineprivate
void Object::SetTarget ( float  pos[3],
float  rot[3],
float  stiffness 
)
inline
Parameters
posnew target SHAPE target position, expressed in m.
rotnew target SHAPE orientation in the scene, expressed as ZYX extrinsic Euler angles.
stiffnessnew target object stiffness, expressed in N/m.
void Object::SetTarget ( float  pos[3],
float  dir[3],
float  Kp,
float  Kv,
float  Fmax 
)
inline
Parameters
posnew constraint position in the scene, expressed in m.
dirnew constraint direction, as defined in ObjectType.
Kpnew constraint stiffness, expressed in N/m.
Kvnew constraint viscosity, expressed in N/(m/s).
Fmaxnew constraint max force for Kp, expressed in N.
void Object::Update ( double  t)
inline

The state at the timestamp is linearly interpolated between the initial state (Object::S0) and the current target state (Object::ST), and is available after computation in Object::S.

Parameters
ttimestamp, expressed in s.
void Object::ComputeForce ( )
inline

This additional force provides the constraint defined by the relevant ObjectType. The force is computed using the Device handle and is added to the Device::Force member.

Member Data Documentation

double Object::t0
private
State Object::S0
private
double Object::tT
private
State Object::ST
private
ObjectType Object::Type
int Object::Device
Note
This member can be negative if the object is not assigned to any particular device (e.g. SHAPE). All constraint objects are assigned to a device.
cMesh* Object::Mesh
State Object::S

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

CHAI3D - V-REP MODULE 1.0.0 documentation
Please address any questions to support@chai3d.org
(C) 2003-2015 - CHAI3D
All Rights Reserved.