H3D API
2.4.1
|
A PlaybackDevice is a fake haptics device node that can play back device values previously recorded using the DeviceLog node. More...
#include <H3D/PlaybackDevice.h>
Classes | |
class | OnDefaultValuesChanged |
A field used to update default playback values. More... | |
class | OnPlay |
A field used to start and stop playback. More... | |
class | OnPlaybackSpeed |
A field used to adjust the playback speed. More... | |
class | OnSeekToTime |
A field used to move playback to a specified time. More... | |
Public Member Functions | |
PlaybackDevice (Inst< MFString > _url=0, Inst< SFVec3f > _devicePosition=0, Inst< SFRotation > _deviceOrientation=0, Inst< TrackerPosition > _trackerPosition=0, Inst< TrackerOrientation > _trackerOrientation=0, Inst< SFMatrix4f > _positionCalibration=0, Inst< SFRotation > _orientationCalibration=0, Inst< SFVec3f > _proxyPosition=0, Inst< WeightedProxy > _weightedProxyPosition=0, Inst< SFFloat > _proxyWeighting=0, Inst< SFBool > _mainButton=0, Inst< SFBool > _secondaryButton=0, Inst< SFInt32 > _buttons=0, Inst< SFVec3f > _force=0, Inst< SFVec3f > _torque=0, Inst< SFInt32 > _inputDOF=0, Inst< SFInt32 > _outputDOF=0, Inst< SFInt32 > _hapticsRate=0, Inst< SFInt32 > _desiredHapticsRate=0, Inst< SFNode > _stylus=0, Inst< SFHapticsRendererNode > _hapticsRenderer=0, Inst< MFVec3f > _proxyPositions=0, Inst< SFBool > _followViewpoint=0, Inst< OnPlay > _play=0, Inst< SFBool > _binary=0, Inst< OnSeekToTime > _seekToTime=0, Inst< OnPlaybackSpeed > _playbackSpeed=0, Inst< SFTime > _playbackTime=0, Inst< SFBool > _playing=0, Inst< MFString > _playbackData=0, Inst< SFVec3f > _defaultDevicePosition=0, Inst< SFRotation > _defaultDeviceOrientation=0, Inst< SFVec3f > _defaultDeviceVelocity=0, Inst< SFInt32 > _defaultButtons=0) | |
Constructor. | |
virtual void | initialize () |
Initialize the node. | |
virtual void | updateDeviceValues () |
Update the output fields. | |
virtual ErrorCode | releaseDevice () |
Perform cleanup and let go of all device resources that are allocated. More... | |
![]() | |
X3DUrlObject (Inst< MFString > _url=0) | |
Constructor. | |
virtual LoadStatus | loadStatus () |
The loadStatus function returns the status of the loading of the current urls in order to be used with the LoadSensor node. | |
virtual H3DFloat | loadProgress () |
The loadProgress() functions returns a value between 0 and 1 indicating how much of the current url has been loaded. More... | |
void | setURLUsed (const string &_url_used) |
Set the url that is currently loaded. | |
const string & | getURLUsed () |
Get the url that is currently loaded. | |
void | setURLBase (const string &_url_base) |
Set the url base address. | |
const string & | getURLBase () |
Get the current url base address. | |
string | resolveURLAsFile (const string &url, bool *is_tmp_file=NULL) |
Get the url as a local file. | |
string | resolveURLAsString (const string &url) |
Get the content of the URL as a string. | |
bool | removeTmpFile (const string &file) |
Remove a tmpfile with the given name. More... | |
![]() | |
H3DHapticsDevice (Inst< SFVec3f > _devicePosition=0, Inst< SFRotation > _deviceOrientation=0, Inst< TrackerPosition > _trackerPosition=0, Inst< TrackerOrientation > _trackerOrientation=0, Inst< SFMatrix4f > _positionCalibration=0, Inst< SFRotation > _orientationCalibration=0, Inst< SFVec3f > _proxyPosition=0, Inst< WeightedProxy > _weightedProxyPosition=0, Inst< SFFloat > _proxyWeighting=0, Inst< SFBool > _mainButton=0, Inst< SFBool > _secondaryButton=0, Inst< SFInt32 > _buttons=0, Inst< SFVec3f > _force=0, Inst< SFVec3f > _torque=0, Inst< SFInt32 > _inputDOF=0, Inst< SFInt32 > _outputDOF=0, Inst< SFInt32 > _hapticsRate=0, Inst< SFInt32 > _desiredHapticsRate=0, Inst< SFNode > _stylus=0, Inst< SFHapticsRendererNode > _hapticsRenderer=0, Inst< MFVec3f > _proxyPositions=0, Inst< SFBool > _followViewpoint=0, Inst< SFVec3f > _deviceVelocity=0, Inst< TrackerVelocity > _trackerVelocity=0, Inst< SFString > _profiledResult=0, Inst< SFVec3f > _deviceAngularVelocity=0, Inst< TrackerAngularVelocity > _trackerAngularVelocity=0) | |
Constructor. | |
virtual | ~H3DHapticsDevice () |
Destuctor. | |
Vec3f | getPreviousProxyPosition (unsigned int layer=0) |
Get the proxy position from the previous loop for a certain layer. More... | |
const vector< Vec3f > & | getPreviousProxyPositions () |
Get all previous proxy positions. | |
virtual string | defaultXMLContainerField () |
Returns the default xml containerField attribute value. More... | |
HAPI::HAPIHapticsDevice * | getHAPIDevice () |
Get the HAPIHapticsDevice that is encapsulated by this node. | |
virtual ErrorCode | initDevice () |
Does all the initialization needed for the device before starting to use it. | |
virtual ErrorCode | enableDevice () |
Enable the device. Positions can be read and force can be sent. | |
virtual ErrorCode | disableDevice () |
Temporarily disable the device. More... | |
H3DUtil::PeriodicThreadBase * | getThread () |
Get the thread that is used to run this haptics device. | |
virtual void | postInit () |
This function is called for all devices in a DeviceInfo node for which the initDevice has been called. More... | |
virtual void | preRender () |
This function is called at the start of each scenegraph loop before any calls to other HapticDevice functions and can be used to perform any necessary operation that are needed for the other calls to function properly. | |
virtual void | postRender () |
This function is called at the end of each scenegraph loop after all calls to other HapticDevice functions and can be used to perform any necessary operation that are needed. | |
virtual void | renderShapes (const HapticShapeVector &shapes, unsigned int layer=0) |
Perform haptic rendering for the given HapticShape instances. More... | |
virtual void | renderStylus () |
Render the stylus of the device wint OpenGL. | |
virtual void | renderEffects (const HapticEffectVector &effects) |
Perform haptic rendering for the given HAPIForceEffect instances. More... | |
![]() | |
Node () | |
Constructor. | |
virtual Node * | clone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL) |
Returns a new instance of this node type with the same state as this one. More... | |
virtual | ~Node () |
Destructor. | |
X3DPrototypeInstance * | getProtoInstanceParent () |
If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More... | |
void | setProtoInstanceParent (X3DPrototypeInstance *p) |
Set the X3DPrototypeInstance this node is the the root node if applicaple. | |
virtual void | render () |
the render() function is used for the depth-first rendering traversal of the scene-graph. More... | |
virtual void | traverseSG (TraverseInfo &ti) |
traverseSG is called once per scenegraph loop on the scene in order to traverse the scenegraph. More... | |
virtual bool | lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result) |
Detect intersection between a line segment and the Node. More... | |
virtual void | closestPoint (const Vec3f &p, NodeIntersectResult &result) |
Find closest point on Node to p. More... | |
virtual bool | movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result) |
Detect collision between a moving sphere and the Node. More... | |
virtual Field * | getField (const string &_name) const |
return a pointer to the field specified by name within this instance | |
int | addDestructCallback (void(*func)(Node *, void *), void *args) |
Add a callback function to be run on destruction of node. More... | |
int | removeDestructCallback (void(*func)(Node *, void *), void *args) |
Add a callback function to be run on destruction of node. More... | |
Public Attributes | |
H3DUniquePtr< OnPlay > | play |
Start and stop the playback. More... | |
H3DUniquePtr< SFBool > | binary |
If true, then the recording pointed to by url is assumed to contain binary data. More... | |
H3DUniquePtr< OnSeekToTime > | seekToTime |
Move playback to the specified time. More... | |
H3DUniquePtr< OnPlaybackSpeed > | playbackSpeed |
A scaling factor to apply to the speed of playback. More... | |
H3DUniquePtr< SFTime > | playbackTime |
Current playback time. More... | |
H3DUniquePtr< SFBool > | playing |
True if the device is currently playing back values. More... | |
H3DUniquePtr< MFString > | playbackData |
The list of field names in the recording that should be played back. More... | |
H3DUniquePtr< SFVec3f > | defaultDevicePosition |
The default value to use for the devicePosition field if no value is played back from the recording. More... | |
H3DUniquePtr< SFRotation > | defaultDeviceOrientation |
The default value to use for the deviceOrientation field if no value is played back from the recording. More... | |
H3DUniquePtr< SFVec3f > | defaultDeviceVelocity |
The default value to use for the deviceVelocity field if no value is played back from the recording. More... | |
H3DUniquePtr< SFInt32 > | defaultButtons |
The default value to use for the buttons field if no value is played back from the recording. More... | |
![]() | |
H3DUniquePtr< MFString > | url |
The urls in decreasing order of preference. | |
![]() | |
H3DUniquePtr< SFVec3f > | devicePosition |
The position of the device given in the coordinate system of the device. More... | |
H3DUniquePtr< SFRotation > | deviceOrientation |
The orientation of the device given in the coordinate system of the device. More... | |
H3DUniquePtr< TrackerPosition > | trackerPosition |
The position of the device in the world coordinates of the API. More... | |
H3DUniquePtr< TrackerOrientation > | trackerOrientation |
The orientation of the device in the world coordinates of the API. More... | |
H3DUniquePtr< SFMatrix4f > | positionCalibration |
The calibration matrix between devicePosition and trackerPosition. More... | |
H3DUniquePtr< SFMatrix4f > | adjustedPositionCalibration |
The calibration matrix between devicePosition and trackerPosition adjusted with the movement of the viewpoint. | |
H3DUniquePtr< SFRotation > | orientationCalibration |
The calibration rotation between deviceOrientation and trackerOrientation. More... | |
H3DUniquePtr< SFRotation > | adjustedOrnCalibration |
The calibration rotation between deviceOrientation and trackerOrientation adjusted with the movement of the viewpoint. | |
H3DUniquePtr< SFVec3f > | proxyPosition |
The position of the proxy used in the haptic rendering(layer 0). More... | |
H3DUniquePtr< WeightedProxy > | weightedProxyPosition |
A weighted position between proxyPosition and trackerPosition. More... | |
H3DUniquePtr< SFFloat > | proxyWeighting |
The weighting between proxyPosition and trackerPosition when calculating weightedProxyPosition. More... | |
H3DUniquePtr< SFBool > | mainButton |
The state of the main button(button 0). More... | |
H3DUniquePtr< SFBool > | secondaryButton |
The state of the secondary button (button 1). More... | |
H3DUniquePtr< SFInt32 > | buttons |
The state of all buttons. More... | |
H3DUniquePtr< SFVec3f > | force |
The approximation of the force that has been rendered during the last scenegraph loop. More... | |
H3DUniquePtr< SFVec3f > | torque |
The approximation of the torque that has been rendered during the last scenegraph loop. More... | |
H3DUniquePtr< SFInt32 > | inputDOF |
The degrees of freedom supported as input. More... | |
H3DUniquePtr< SFInt32 > | outputDOF |
The degrees of freedom supported as output, i.e. More... | |
H3DUniquePtr< SFInt32 > | hapticsRate |
The update rate of the servoloop of the H3DHapticsDevice. More... | |
H3DUniquePtr< SFInt32 > | desiredHapticsRate |
The desired update rate of the servoloop of the H3DHapticsDevice. More... | |
H3DUniquePtr< SFTime > | hapticsLoopTime |
The time spent in the last haptics loop(in seconds) A value of -1 means that no haptics loop has been completed yet. More... | |
H3DUniquePtr< SFNode > | stylus |
The Node used as the visual representation of the stylus. More... | |
H3DUniquePtr< SFBool > | initialized |
true if the device is initialized and ready for calls to updateDeviceValues() and renderObjects(). More... | |
H3DUniquePtr< SFHapticsRendererNode > | hapticsRenderer |
Specifies the haptics rendering algorithm to use to generate forces from geometric shapes. More... | |
H3DUniquePtr< MFVec3f > | proxyPositions |
The positions of the proxies for each layer used in haptic rendering(layer 0). More... | |
H3DUniquePtr< SetEnabled > | set_enabled |
Enable/disable the device. More... | |
H3DUniquePtr< SFBool > | enabled |
true if the device is enabled, e.g. More... | |
H3DUniquePtr< SFBool > | followViewpoint |
true if the device should follow the viewpoint. More... | |
H3DUniquePtr< SFVec3f > | deviceVelocity |
The velocity of the device in the coordinate system of the device. More... | |
H3DUniquePtr< TrackerVelocity > | trackerVelocity |
The velocity of the device in the world coordinates of the API. More... | |
H3DUniquePtr< SFFloat > | forceLimit |
The maximum force(in N) we want the device to render. More... | |
H3DUniquePtr< SFFloat > | forceScale |
Set the scaling of the output force. More... | |
H3DUniquePtr< SFBool > | deadmansSwitch |
This is an alternative operational safety mode. More... | |
H3DUniquePtr< SFFloat > | torqueLimit |
The maximum torque(in Nm) we want the device to render. More... | |
H3DUniquePtr< SFVec3f > | deviceAngularVelocity |
The angular velocity of the device in the coordinate system of the device. More... | |
H3DUniquePtr< TrackerAngularVelocity > | trackerAngularVelocity |
The angular velocity of the device in the world coordinates of the API. More... | |
Static Public Attributes | |
static H3DNodeDatabase | database |
Node database entry. | |
![]() | |
static H3DNodeDatabase | database |
Node database entry. | |
Protected Member Functions | |
virtual void | updateDefaultValues () |
Function to update the default device values in the HAPI device. | |
![]() | |
string | resolveURL (const string &_url, bool return_contents, bool *is_tmp_file=NULL) |
Helper function for resolveURLAs*() functions. | |
void | addInlinePrefix (const string &s) |
Add a inline prefix that this node supports. | |
int | getInlinedContentOffset (const std::string &url) |
If the URL contains any inline prefix, return the index of the start of the inlined content. More... | |
![]() | |
void | cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for the clone() method. More... | |
Protected Attributes | |
H3DUniquePtr< Field > | playbackURLChanged |
A field used to detect if the url field has changed since last playback started. | |
H3DUniquePtr< OnDefaultValuesChanged > | defaultValuesChanged |
A field used to update the default device values in the HAPI device. | |
std::string | tmp_filename |
Store the name of the temp file used to resolve the url so that it can be removed later. | |
![]() | |
string | url_used |
If loadStatus() returns LOADED this string should contain the url that is loaded. More... | |
string | url_base |
The base URL for urls in this url object. More... | |
list< string > | supported_inline_prefixes |
A list of inline prefixes that are supported by this url object. More... | |
![]() | |
TimeStamp | last_effect_change |
The time for the last call to the renderEffects function. | |
Additional Inherited Members | |
![]() | |
enum | LoadStatus { INIT , LOADED , LOADING , FAILED } |
The load status of the given url. More... | |
![]() | |
typedef SFMatrix4f | PosCalibration |
typedef SFRotation | OrnCalibration |
![]() | |
typedef std::map< Node *, Node * > | DeepCopyMap |
A map type used during a deep copy clone() to map from original nodes to cloned nodes. | |
![]() | |
static unsigned int | nrNodesAlive () |
Returns the nr of nodes currently alive, i.e. nodes created but not destructed. | |
static int | nrNodesCreated () |
Returns the number of nodes created in total since the start of the program. | |
![]() | |
static Node * | getClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for nodes that implement clone() More... | |
A PlaybackDevice is a fake haptics device node that can play back device values previously recorded using the DeviceLog node.
This haptics device plays back device values from a file specified by the url field. The format of the file is the same as that produced by the DeviceLog force effect. Both binary and text formats are supported.
Any combination of columns are supported, however a TIME column is required in order to play back the values at the original speed.
The following columns are used to define the device's raw values: RAW_POSITION, RAW_ORIENTATION, RAW_VELOCITY, BUTTONS. Any other columns are ignored. The calibrated device values are calculated based on the raw values in the usual way and the recorded calibrated values (if present) are ignored.
Examples:
|
virtual |
Perform cleanup and let go of all device resources that are allocated.
After a call to this function no haptic rendering can be performed on the device until the initDevice() function has been called again.
Reimplemented from H3D::H3DHapticsDevice.
References H3D::H3DHapticsDevice::releaseDevice().
H3DUniquePtr< SFBool > H3D::PlaybackDevice::binary |
If true, then the recording pointed to by url is assumed to contain binary data.
Otherwise it is assumed to contain text data.
The value set here will take effect the next time that a new url is specified and playback is started.
Access type: inputOutput
Default value: false
Referenced by PlaybackDevice().
H3DUniquePtr< SFInt32 > H3D::PlaybackDevice::defaultButtons |
The default value to use for the buttons field if no value is played back from the recording.
Access type: inputOutput
Default value: 0
Referenced by PlaybackDevice(), and updateDefaultValues().
H3DUniquePtr< SFRotation > H3D::PlaybackDevice::defaultDeviceOrientation |
The default value to use for the deviceOrientation field if no value is played back from the recording.
Access type: inputOutput
Default value: Rotation(1,0,0,0)
Referenced by PlaybackDevice(), and updateDefaultValues().
H3DUniquePtr< SFVec3f > H3D::PlaybackDevice::defaultDevicePosition |
The default value to use for the devicePosition field if no value is played back from the recording.
Access type: inputOutput
Default value: Vec3f(0,0,0)
Referenced by PlaybackDevice(), and updateDefaultValues().
H3DUniquePtr< SFVec3f > H3D::PlaybackDevice::defaultDeviceVelocity |
The default value to use for the deviceVelocity field if no value is played back from the recording.
Access type: inputOutput
Default value: Vec3f(0,0,0)
Referenced by PlaybackDevice(), and updateDefaultValues().
H3DUniquePtr< OnPlay > H3D::PlaybackDevice::play |
Start and stop the playback.
If a value of true is received and a valid url has been specified then playback will begin. If a value of false is recieved then the playback is paused and can be resumed with a subsiquent true event.
To start the playback from the begining again, set seekToTime to zero first.
Access type: inputOutput
Default value: false
Referenced by initialize(), and PlaybackDevice().
H3DUniquePtr< MFString > H3D::PlaybackDevice::playbackData |
The list of field names in the recording that should be played back.
If the list is empty then all available columns are played back. If a field is not played back, then the default value specified using the default* fields is used instead.
The TIME field is always used if present in the recording.
Access type: inputOutput
Default value: []
Allowed values: "DEVICE_POSITION", "DEVICE_ORIENTATION", "DEVICE_VELOCITY", "BUTTONS"
Referenced by PlaybackDevice().
H3DUniquePtr< OnPlaybackSpeed > H3D::PlaybackDevice::playbackSpeed |
A scaling factor to apply to the speed of playback.
A value of 1 corresponds to the original recording speed. Changing this value during playback will result in discontinuities in the playback position.
Access type: inputOutput
Default value: 1.0
Referenced by PlaybackDevice().
H3DUniquePtr< SFTime > H3D::PlaybackDevice::playbackTime |
Current playback time.
Indicates the current playback time in the recording.
Access type: outputOnly
Default value: 0.0
Referenced by PlaybackDevice(), and updateDeviceValues().
H3DUniquePtr< SFBool > H3D::PlaybackDevice::playing |
True if the device is currently playing back values.
False if idle, or playback has ended.
Access type: outputOnly
Default value: false
Referenced by PlaybackDevice(), and updateDeviceValues().
H3DUniquePtr< OnSeekToTime > H3D::PlaybackDevice::seekToTime |
Move playback to the specified time.
The value set here will take effect the next time playback is started.
Access type: inputOutput
Default value: 0.0
Referenced by PlaybackDevice().