SOFA plugin: SofaHAPI  master
Open source framework for multi-physics simuation
sofa::component::SofaHAPIHapticsDevice Class Reference

#include <SofaHAPIHapticsDevice.h>

Inheritance diagram for sofa::component::SofaHAPIHapticsDevice:

Detailed Description

HAPI Haptics Device

Public Attributes

Data< double > scale
 Default scale applied to the Phantom Coordinates. More...
 
Data< double > forceScale
 Default scaling factor applied to the force feedback. More...
 
Data< Vec3d > positionBase
 Position of the interface base in the scene world coordinates. More...
 
Data< QuatorientationBase
 Orientation of the interface base in the scene world coordinates. More...
 
Data< Vec3d > positionTool
 Position of the tool in the device end effector frame. More...
 
Data< QuatorientationTool
 Orientation of the tool in the device end effector frame. More...
 
Data< bool > permanent
 Apply the force feedback permanently. More...
 
Data< bool > toolSelector
 Switch tools with 2nd button. More...
 
Data< int > toolCount
 Number of tools to switch between. More...
 
Data< int > toolIndex
 Current tool index. More...
 
Data< double > toolTransitionSpringStiffness
 Stiffness of haptic springs when switching instruments (0 to disable) More...
 
Data< std::string > driverName
 Name of the HAPI device driver. More...
 
Data< bool > drawDevice
 Visualize the position of the interface in the virtual scene. More...
 
Data< float > drawHandleSize
 Visualize the handle direction of the interface in the virtual scene. More...
 
Data< float > drawForceScale
 Visualize the haptics force in the virtual scene. More...
 
ForceFeedbackTransform data
 
- Public Attributes inherited from sofa::core::objectmodel::BaseObject
Data< bool > f_listening
 
- Public Attributes inherited from sofa::core::objectmodel::Base
std::vector< lifecycle::DeprecatedData * > m_oldAttributes
 
Data< int > d_messageLogCount
 
Data< std::string > name
 
Data< bool > f_printLog
 
Data< sofa::core::objectmodel::TagSetf_tags
 
Data< sofa::type::BoundingBoxf_bbox
 
Data< sofa::core::objectmodel::ComponentStated_componentState
 
std::string m_definitionSourceFileName
 
int m_definitionSourceFilePos
 
std::string m_instanciationSourceFileName
 
int m_instanciationSourceFilePos
 

Protected Attributes

std::auto_ptr< HAPI::HAPIHapticsDevice > device
 
MultiLink< SofaHAPIHapticsDevice, SofaHAPIForceFeedbackEffect, BaseLink::FLAG_STRONGLINK > feedbackEffects
 
H3DUtil::AutoRef< HAPI::HapticSpring > transitionEffect
 
sofa::core::behavior::MechanicalState< sofa::defaulttype::Rigid3dTypes > * mState
 Controlled MechanicalState. More...
 
bool isToolControlled
 
int fakeButtonState
 
int lastButtonState
 
Transform lastToolPosition
 
- Protected Attributes inherited from sofa::component::controller::Controller
Data< bool > d_handleEventTriggersUpdate
 
- Protected Attributes inherited from sofa::core::objectmodel::BaseObject
SingleLink< BaseObject, BaseContext, BaseLink::FLAG_DOUBLELINK > l_context
 
LinkSlaves l_slaves
 
SingleLink< BaseObject, BaseObject, BaseLink::FLAG_DOUBLELINK > l_master
 
- Protected Attributes inherited from sofa::core::objectmodel::Base
std::map< std::string, sofa::core::DataTrackerCallbackm_internalEngine
 
VecData m_vecData
 
MapData m_aliasData
 
VecLink m_vecLink
 
MapLink m_aliasLink
 

Public Member Functions

 SOFA_CLASS (SofaHAPIHapticsDevice, Controller)
 
 SofaHAPIHapticsDevice ()
 
virtual ~SofaHAPIHapticsDevice ()
 
virtual void init ()
 
virtual void bwdInit ()
 
virtual void reset ()
 
void reinit ()
 
bool initDevice ()
 
void releaseDevice ()
 
void cleanup ()
 
virtual void draw (const sofa::core::visual::VisualParams *vparams)
 
void setForceFeedbacks (vector< ForceFeedback * > ffs)
 
void onKeyPressedEvent (KeypressedEvent *)
 
void onKeyReleasedEvent (KeyreleasedEvent *)
 
void onBeginAnimationStep (const double)
 
void onEndAnimationStep (const double)
 
void setDataValue ()
 
- Public Member Functions inherited from sofa::component::controller::Controller
 SOFA_CLASS (Controller, core::behavior::BaseController)
 
virtual void onMouseEvent (core::objectmodel::MouseEvent *)
 
virtual void onHapticDeviceEvent (core::objectmodel::HapticDeviceEvent *)
 
virtual void onJoystickEvent (core::objectmodel::JoystickEvent *)
 
virtual void onGUIEvent (core::objectmodel::GUIEvent *)
 
void handleEvent (core::objectmodel::Event *) override
 
- Public Member Functions inherited from sofa::core::behavior::BaseController
 SOFA_ABSTRACT_CLASS (BaseController, core::objectmodel::BaseObject)
 
- Public Member Functions inherited from sofa::core::objectmodel::BaseObject
 SOFA_CLASS (BaseObject, Base)
 
virtual void computeBBox (const core::ExecParams *, bool=false)
 
void setSrc (const std::string &v, std::vector< std::string > *attributeList=nullptr)
 
void setSrc (const std::string &v, const BaseObject *loader, std::vector< std::string > *attributeList=nullptr)
 
BasefindLinkDestClass (const BaseClass *destType, const std::string &path, const BaseLink *link) override
 
virtual std::string getPathName () const override
 
virtual bool insertInNode (BaseNode *)
 
virtual bool removeInNode (BaseNode *)
 
SReal getTime () const
 
const BaseContextgetContext () const
 
BaseContextgetContext ()
 
const BaseObjectgetMaster () const
 
BaseObjectgetMaster ()
 
const VecSlavesgetSlaves () const
 
BaseObjectgetSlave (const std::string &name) const
 
virtual void addSlave (BaseObject::SPtr s)
 
virtual void removeSlave (BaseObject::SPtr s)
 
virtual void handleTopologyChange ()
 
virtual void handleTopologyChange (core::topology::Topology *t)
 
void parse (BaseObjectDescription *arg) override
 
void updateInternal ()
 
virtual void storeResetState ()
 
SReal getTime () const
 
- Public Member Functions inherited from sofa::core::objectmodel::Base
virtual const BaseClassgetClass () const
 
void addDeprecatedAttribute (lifecycle::DeprecatedData *attribute)
 
void addUpdateCallback (const std::string &name, std::initializer_list< BaseData * > inputs, std::function< sofa::core::objectmodel::ComponentState(const DataTracker &)> function, std::initializer_list< BaseData * > outputs)
 
void addOutputsToCallback (const std::string &name, std::initializer_list< BaseData * > outputs)
 
const std::string & getName () const
 
void setName (const std::string &n)
 
void setName (const std::string &n, int counter)
 
std::string getTypeName () const
 
virtual std::string getClassName () const
 
virtual std::string getTemplateName () const final
 
std::string getNameSpaceName () const
 
void setDefinitionSourceFileName (const std::string &sourceFileName)
 
const std::string & getDefinitionSourceFileName () const
 
void setDefinitionSourceFilePos (const int)
 
int getDefinitionSourceFilePos () const
 
void setInstanciationSourceFileName (const std::string &sourceFileName)
 
const std::string & getInstanciationSourceFileName () const
 
void setInstanciationSourceFilePos (const int)
 
int getInstanciationSourceFilePos () const
 
void addMessage (const sofa::helper::logging::Message &m) const
 
size_t countLoggedMessages (sofa::helper::logging::Message::TypeSet t=sofa::helper::logging::Message::AnyTypes) const
 
const std::deque< sofa::helper::logging::Message > & getLoggedMessages () const
 
const std::string getLoggedMessagesAsString (sofa::helper::logging::Message::TypeSet t=sofa::helper::logging::Message::AnyTypes) const
 
void clearLoggedMessages () const
 
bool notMuted () const
 
const sofa::core::objectmodel::TagSetgetTags () const
 
bool hasTag (Tag t) const
 
void addTag (Tag t)
 
void removeTag (Tag t)
 
ComponentState getComponentState () const
 
bool isComponentStateValid () const
 
bool isComponentStateInvalid () const
 
 SOFA_ATTRIBUTE_DEPRECATED__TOBASECONSTRAINT () virtual const behavior
 
virtual bool parseField (const std::string &attribute, const std::string &value)
 
virtual bool hasField (const std::string &attribute) const
 
void parseFields (const std::list< std::string > &str)
 
virtual void parseFields (const std::map< std::string, std::string * > &str)
 
void writeDatas (std::map< std::string, std::string * > &str)=delete
 
void writeDatas (std::ostream &out, const std::string &separator=" ")
 
BaseDatafindData (const std::string &name) const
 
std::vector< BaseData * > findGlobalField (const std::string &name) const
 
BaseLinkfindLink (const std::string &name) const
 
std::vector< BaseLink * > findLinks (const std::string &name) const
 
virtual void updateLinks (bool logErrors=true)
 
BaseData::BaseInitData initData (::sofa::core::objectmodel::Data< T > *field, const char *name, const char *help, ::sofa::core::objectmodel::BaseData::DataFlags dataflags)
 
BaseData::BaseInitData initData (Data< T > *field, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 
Data< T >::InitData initData (Data< T > *field, const T &value, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 
void addData (BaseData *f, const std::string &name)
 
void addData (BaseData *f)
 
void removeData (BaseData *f)
 
void addAlias (BaseData *field, const char *alias)
 
void addLink (BaseLink *l)
 
void addAlias (BaseLink *link, const char *alias)
 
const VecDatagetDataFields () const
 
const MapDatagetDataAliases () const
 
const VecLinkgetLinks () const
 
const MapLinkgetLinkAliases () const
 
virtual bool findDataLinkDest (BaseData *&ptr, const std::string &path, const BaseLink *link)
 
bool findLinkDest (T *&ptr, const std::string &path, const BaseLink *link)
 
const sofa::core::objectmodel::TagSetgetTags () const
 
bool hasTag (Tag t) const
 
void addTag (Tag t)
 
void removeTag (Tag t)
 
ComponentState getComponentState () const
 
bool isComponentStateValid () const
 
bool isComponentStateInvalid () const
 
 SOFA_ATTRIBUTE_DEPRECATED__TOBASECONSTRAINT () virtual const behavior
 

Protected Member Functions

void setToolFeedback (int indice, bool enable=true, bool transfer=true)
 
void sendHapticDeviceEvent ()
 
- Protected Member Functions inherited from sofa::component::controller::Controller
 Controller ()
 
 ~Controller () override
 
- Protected Member Functions inherited from sofa::core::objectmodel::BaseObject
 BaseObject ()
 
 ~BaseObject () override
 
virtual void doUpdateInternal ()
 
void changeContextLink (BaseContext *before, BaseContext *&after)
 
void changeSlavesLink (BaseObject::SPtr ptr, std::size_t, bool add)
 
void trackInternalData (const BaseData &data)
 
void cleanTracker ()
 
bool hasDataChanged (const BaseData &data)
 
- Protected Member Functions inherited from sofa::core::objectmodel::Base
 Base ()
 
virtual ~Base ()
 
void initData0 (BaseData *field, BaseData::BaseInitData &res, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 
void initData0 (BaseData *field, BaseData::BaseInitData &res, const char *name, const char *help, BaseData::DataFlags dataFlags)
 
void initData0 (Data< T > *field, typename Data< T >::InitData &res, const T &value, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 
- Protected Member Functions inherited from sofa::core::IntrusiveObject
virtual ~IntrusiveObject ()=default
 

Additional Inherited Members

- Static Public Member Functions inherited from sofa::core::objectmodel::BaseObject
static bool canCreate (T *, BaseContext *, BaseObjectDescription *)
 
static T::SPtr create (T *, BaseContext *context, BaseObjectDescription *arg)
 
- Static Public Member Functions inherited from sofa::core::objectmodel::Base
static const BaseClassGetClass ()
 
static std::string shortName (const T *ptr=nullptr, BaseObjectDescription *=nullptr)
 

Attribute details

◆ data

ForceFeedbackTransform sofa::component::SofaHAPIHapticsDevice::data

◆ device

std::auto_ptr<HAPI::HAPIHapticsDevice> sofa::component::SofaHAPIHapticsDevice::device
protected

◆ drawDevice

Data<bool> sofa::component::SofaHAPIHapticsDevice::drawDevice

Visualize the position of the interface in the virtual scene.

◆ drawForceScale

Data<float> sofa::component::SofaHAPIHapticsDevice::drawForceScale

Visualize the haptics force in the virtual scene.

◆ drawHandleSize

Data<float> sofa::component::SofaHAPIHapticsDevice::drawHandleSize

Visualize the handle direction of the interface in the virtual scene.

◆ driverName

Data<std::string> sofa::component::SofaHAPIHapticsDevice::driverName

Name of the HAPI device driver.

◆ fakeButtonState

int sofa::component::SofaHAPIHapticsDevice::fakeButtonState
protected

◆ feedbackEffects

MultiLink<SofaHAPIHapticsDevice, SofaHAPIForceFeedbackEffect, BaseLink::FLAG_STRONGLINK> sofa::component::SofaHAPIHapticsDevice::feedbackEffects
protected

◆ forceScale

Data<double> sofa::component::SofaHAPIHapticsDevice::forceScale

Default scaling factor applied to the force feedback.

◆ isToolControlled

bool sofa::component::SofaHAPIHapticsDevice::isToolControlled
protected

◆ lastButtonState

int sofa::component::SofaHAPIHapticsDevice::lastButtonState
protected

◆ lastToolPosition

Transform sofa::component::SofaHAPIHapticsDevice::lastToolPosition
protected

◆ mState

sofa::core::behavior::MechanicalState<sofa::defaulttype::Rigid3dTypes>* sofa::component::SofaHAPIHapticsDevice::mState
protected

Controlled MechanicalState.

◆ orientationBase

Data<Quat> sofa::component::SofaHAPIHapticsDevice::orientationBase

Orientation of the interface base in the scene world coordinates.

◆ orientationTool

Data<Quat> sofa::component::SofaHAPIHapticsDevice::orientationTool

Orientation of the tool in the device end effector frame.

◆ permanent

Data<bool> sofa::component::SofaHAPIHapticsDevice::permanent

Apply the force feedback permanently.

◆ positionBase

Data<Vec3d> sofa::component::SofaHAPIHapticsDevice::positionBase

Position of the interface base in the scene world coordinates.

◆ positionTool

Data<Vec3d> sofa::component::SofaHAPIHapticsDevice::positionTool

Position of the tool in the device end effector frame.

◆ scale

Data<double> sofa::component::SofaHAPIHapticsDevice::scale

Default scale applied to the Phantom Coordinates.

◆ toolCount

Data<int> sofa::component::SofaHAPIHapticsDevice::toolCount

Number of tools to switch between.

◆ toolIndex

Data<int> sofa::component::SofaHAPIHapticsDevice::toolIndex

Current tool index.

◆ toolSelector

Data<bool> sofa::component::SofaHAPIHapticsDevice::toolSelector

Switch tools with 2nd button.

◆ toolTransitionSpringStiffness

Data<double> sofa::component::SofaHAPIHapticsDevice::toolTransitionSpringStiffness

Stiffness of haptic springs when switching instruments (0 to disable)

◆ transitionEffect

H3DUtil::AutoRef<HAPI::HapticSpring> sofa::component::SofaHAPIHapticsDevice::transitionEffect
protected

Constructor details

◆ SofaHAPIHapticsDevice()

sofa::component::SofaHAPIHapticsDevice::SofaHAPIHapticsDevice ( )

◆ ~SofaHAPIHapticsDevice()

sofa::component::SofaHAPIHapticsDevice::~SofaHAPIHapticsDevice ( )
virtual

Function details

◆ bwdInit()

void sofa::component::SofaHAPIHapticsDevice::bwdInit ( )
virtual

◆ cleanup()

void sofa::component::SofaHAPIHapticsDevice::cleanup ( )
virtual

◆ draw()

void sofa::component::SofaHAPIHapticsDevice::draw ( const sofa::core::visual::VisualParams vparams)
virtual

◆ init()

void sofa::component::SofaHAPIHapticsDevice::init ( void  )
virtual

◆ initDevice()

bool sofa::component::SofaHAPIHapticsDevice::initDevice ( )

◆ onBeginAnimationStep()

void sofa::component::SofaHAPIHapticsDevice::onBeginAnimationStep ( const double  )
virtual

◆ onEndAnimationStep()

void sofa::component::SofaHAPIHapticsDevice::onEndAnimationStep ( const double  )
virtual

◆ onKeyPressedEvent()

void sofa::component::SofaHAPIHapticsDevice::onKeyPressedEvent ( KeypressedEvent kpe)
virtual

◆ onKeyReleasedEvent()

void sofa::component::SofaHAPIHapticsDevice::onKeyReleasedEvent ( KeyreleasedEvent kre)
virtual

◆ reinit()

void sofa::component::SofaHAPIHapticsDevice::reinit ( )
virtual

◆ releaseDevice()

void sofa::component::SofaHAPIHapticsDevice::releaseDevice ( )

◆ reset()

void sofa::component::SofaHAPIHapticsDevice::reset ( )
virtual

◆ sendHapticDeviceEvent()

void sofa::component::SofaHAPIHapticsDevice::sendHapticDeviceEvent ( )
protected

◆ setDataValue()

void sofa::component::SofaHAPIHapticsDevice::setDataValue ( )

◆ setForceFeedbacks()

void sofa::component::SofaHAPIHapticsDevice::setForceFeedbacks ( vector< ForceFeedback * >  ffs)

◆ setToolFeedback()

void sofa::component::SofaHAPIHapticsDevice::setToolFeedback ( int  indice,
bool  enable = true,
bool  transfer = true 
)
protected

◆ SOFA_CLASS()

sofa::component::SofaHAPIHapticsDevice::SOFA_CLASS ( SofaHAPIHapticsDevice  ,
Controller   
)