ALBA
|
#include <albaDeviceButtonsPadTracker.h>
Public Types | |
enum | TRACKER_WIDGET_ID { ID_TB_X_EXTENT =Superclass::ID_LAST , ID_TB_Y_EXTENT , ID_TB_Z_EXTENT , ID_TB_POSITION , ID_TB_ORIENTATION , ID_AVATAR_CHECK , ID_AVATAR_SELECT , ID_LAST } |
Public Types inherited from albaDevice | |
enum | DEVICE_MINIMUM_ID { MIN_DEVICE_ID =1000000 } |
enum | DEVICE_WIDGET_ID { ID_NAME =MINID , ID_ACTIVATE , ID_SHUTDOWN , ID_AUTO_START , ID_LAST } |
Public Types inherited from albaAgentEventQueue | |
enum | DispatchModalities { SelfProcessMode = 0 , BroadcastMode } |
enum | PopModalities { SingleEventMode = 0 , MultipleEventMode } |
enum | PushModalities { DispatchEventMode =0 , PollingMode } |
Static Public Member Functions | |
static albaID | GetTracker3DMoveId () |
static albaID | GetTrackerBoundsUpdatedId () |
Static Public Member Functions inherited from albaDeviceButtonsPad | |
static albaID | GetButtonDownId () |
static albaID | GetButtonUpId () |
static albaID | GetWheelId () |
Static Public Member Functions inherited from albaObject | |
static const char * | GetStaticTypeName () |
static bool | IsStaticType (const char *type_name) |
static bool | IsStaticType (const albaTypeID &type_id) |
static const albaTypeID & | GetStaticTypeId () |
static albaObject * | SafeDownCast (albaObject *o) |
Static Public Member Functions inherited from albaStorable | |
static albaStorable * | SafeCastToObject (albaObject *o) |
Protected Member Functions | |
albaDeviceButtonsPadTracker () | |
virtual | ~albaDeviceButtonsPadTracker () |
virtual int | InternalStore (albaStorageElement *node) |
virtual int | InternalRestore (albaStorageElement *node) |
virtual int | InternalInitialize () |
virtual void | InternalShutdown () |
virtual void | SendButtonEvent (albaEventInteraction *event) |
int | AvatarChooser (wxString &avatar_name, wxString &avatar_type) |
Protected Member Functions inherited from albaDeviceButtonsPad | |
albaDeviceButtonsPad () | |
virtual | ~albaDeviceButtonsPad () |
virtual void | SendButtonEvent (albaEventInteraction *event) |
int | FlagCheck (bool event, bool &flag) |
Protected Member Functions inherited from albaDevice | |
albaDevice () | |
virtual | ~albaDevice () |
virtual int | InternalInitialize () |
virtual void | CreateGui () |
virtual int | InternalStore (albaStorageElement *node) |
virtual int | InternalRestore (albaStorageElement *node) |
Protected Member Functions inherited from albaAgentThreaded | |
albaAgentThreaded () | |
virtual | ~albaAgentThreaded () |
virtual void | RequestForDispatching () |
void | StopThread () |
virtual int | InternalInitialize () |
virtual void | InternalShutdown () |
virtual int | InternalUpdate () |
int | GetActiveFlag () |
void | SignalNewMessage () |
void | WaitForNewMessage () |
Protected Member Functions inherited from albaAgentEventQueue | |
albaAgentEventQueue () | |
virtual | ~albaAgentEventQueue () |
albaEventBase * | PopEvent () |
int | PopEvent (albaEventBase &event) |
virtual int | PopEvent (albaEventBase *&event) |
bool | GetDispatched () |
void | SetDispatched (bool value=true) |
virtual void | RequestForDispatching () |
Protected Member Functions inherited from albaAgent | |
albaAgent () | |
virtual | ~albaAgent () |
virtual int | InternalInitialize () |
virtual void | InternalShutdown () |
void | InvokeEvent (albaEventBase &event, albaID channel=-1) |
void | InvokeEvent (albaEventBase *event, albaID channel=-1) |
void | InvokeEvent (void *sender, int id, albaID channel=MCH_UP, void *data=NULL) |
virtual int | InternalStore (albaStorageElement *node)=0 |
virtual int | InternalRestore (albaStorageElement *node)=0 |
Additional Inherited Members | |
Protected Types inherited from albaEventBroadcaster | |
typedef std::list< albaObserver * > | albaObserversList |
Static Protected Member Functions inherited from albaAgentThreaded | |
static void | UpdateLoop (mmuThreadInfoStruct *data) |
Generic spatial position tracking device.
albaDeviceButtonsPadTracker is a class providing basic functionalities for space trackers, i.e. devices which track an object in space. Specialized classes for specific devices should add their own data structures and reimplemented InternalInitialize and InternalShutdow to activate/stop the device. Tracked pose is expressed by means of a 4x4 matrix. This class issues events each time a new coordinate is available, but if a new coordinate arrives and the last pose has not been consumed (i.e. the last MoveEvent has not been dispatched yet, no event is issued, but the LastPoseMatrix is overwritten. This allows consumer classes to always have last tracked pose. MoveEvent's are albaActionEvent objects, which stores a pose and state of buttons. This class also gives support to transforming from the tracker coordinate system into a canonical coordinate system. The canonical frame is computed by ComputeTrackerToCanonicalTansform() which take as input the tracked volume definition. TrackedVolume is defined as a Oriented Bounding Box, whose bounds is defined by the TrackedBounds member, while the Orientation is defined by the TrackedBoxOrientation member(expressed as Cardan angles according to VTK convention on orientation). The canonical space is related to the tracked volume by TrackerToCanonicalTransform which transforms the TrackedBox into a box centered in the origin, zero rotation and isotropically scaled to normalize max input dimension (e.g. a box of size [-.5,.5,-2,2,-.1,.1] would be scaled to [-.25,.25,-1,1,-.05,.05]. Each tracker can be assigned an avatar (albaAvatar) showing a graphical object moved by tracker's input. The albaDeviceButtonsPadTracker class has a specialized settings class which implements gui for setting the avatar and the tracker's tracked volume. The albaDeviceButtonsPadTracker is also a albaDeviceButtonsPad supporting buttons.
Definition at line 67 of file albaDeviceButtonsPadTracker.h.
|
protected |
|
protectedvirtual |
albaDeviceButtonsPadTracker::albaTypeMacro | ( | albaDeviceButtonsPadTracker | , |
albaDeviceButtonsPad | |||
) |
|
static |
return the tracker 3d move id
|
static |
return th tracker bounds updated id
|
virtual |
Reimplemented to manage fusion of move events.
Reimplemented from albaDevice.
void albaDeviceButtonsPadTracker::SetLastPoseMatrix | ( | const albaMatrix & | matrix | ) |
Internally used to set the last pose matrix.
This function make a copy of the matrix, and in case of vtkMatrix4x4 attach a time stamp with the current time. Finally a MoveEvent is rosed. Notice that old MoveEvent's are overwritten by new ones if not yet served.
albaMatrix & albaDeviceButtonsPadTracker::GetLastPoseMatrix | ( | ) |
|
inline |
set the timeout after which the event is discarded (in seconds)
Definition at line 114 of file albaDeviceButtonsPadTracker.h.
|
inline |
Definition at line 115 of file albaDeviceButtonsPadTracker.h.
void albaDeviceButtonsPadTracker::SetTrackerToCanonicalTransform | ( | albaTransform * | trans | ) |
Set the transform to be used to map coordinates between tracker and canonical frames.
albaTransform * albaDeviceButtonsPadTracker::GetTrackerToCanonicalTransform | ( | ) |
return the transform mapping coordinates from tracker to canonical frame.
void albaDeviceButtonsPadTracker::TrackerToCanonical | ( | const albaMatrix & | pose, |
albaMatrix & | dest | ||
) |
This is used to map the RAW transform in tracker's frame into the canonical frame.
|
inline |
Definition at line 130 of file albaDeviceButtonsPadTracker.h.
References TrackerToCanonical().
Referenced by TrackerToCanonical().
void albaDeviceButtonsPadTracker::TrackerToCanonical | ( | albaTransform * | trans | ) |
void albaDeviceButtonsPadTracker::CanonicalToTracker | ( | const albaMatrix & | pose, |
albaMatrix & | dest | ||
) |
This is used to map a pose in canonical frame into tracker's frame.
|
inline |
Definition at line 136 of file albaDeviceButtonsPadTracker.h.
References CanonicalToTracker().
Referenced by CanonicalToTracker().
void albaDeviceButtonsPadTracker::CanonicalToTracker | ( | albaTransform * | trans | ) |
void albaDeviceButtonsPadTracker::SetAvatar | ( | albaAvatar * | avatar | ) |
Set/Get the avatar assigned to this device.
|
inline |
Definition at line 142 of file albaDeviceButtonsPadTracker.h.
void albaDeviceButtonsPadTracker::SetDefaultAvatar | ( | albaAvatar * | avatar | ) |
Set the default avatar, i.e.
the avatar to be used as default one. An application module can set the avatar to a transient one and then restore the default one. The default avatar is made persistent and will be recreated by means of the object factory when restarting the application. Setting the default avatar automatically calls the SetAvatar() too.
|
inline |
Definition at line 151 of file albaDeviceButtonsPadTracker.h.
void albaDeviceButtonsPadTracker::RestoreDefaultAvatar | ( | ) |
Restore the avatar to the default one.
An application module can set the avatar to a transient one and then restore the default one.
void albaDeviceButtonsPadTracker::ComputeTrackerToCanonicalTansform | ( | ) |
Update the Tracker to Canonical transform.
This transform maps the tracked working box into the canonical working box, which is a working box with no orientation and centered around the origin (i.e. a identical pose matrix) and isotropically scaled to fit the [-1,1,-1,1,-1,1] box.
albaOBB & albaDeviceButtonsPadTracker::GetCanonicalBounds | ( | ) |
return bounds of canonical space
|
inline |
return bounds of tracked volume.
Tracked volume is expessed as an oriented bounding box. For orientation see GetTrackedBoxOrientation()
Definition at line 174 of file albaDeviceButtonsPadTracker.h.
|
inline |
return orientation of tracked volume.
Tracked volume is expessed as an oriented bounding box. For box extents see orientation see GetTrackedBounds()
Definition at line 180 of file albaDeviceButtonsPadTracker.h.
|
inline |
utility function for finding maximum among 2 values
Definition at line 236 of file albaDeviceButtonsPadTracker.h.
|
inline |
utility function for finding maximum among 3 values
Definition at line 244 of file albaDeviceButtonsPadTracker.h.
|
virtual |
internal function to create device GUI for settings
Reimplemented from albaDevice.
|
virtual |
force GUI update
Reimplemented from albaDevice.
|
protectedvirtual |
This is used to allow nested serialization of subclasses.
This function is called by Store and is reimplemented in subclasses. Each subclass can store its own subelements which are closed inside the "Device" element. Reimplemented functions should first call Superclass implementation.
Reimplemented from albaDevice.
|
protectedvirtual |
This function fills in the device with settings restored from the node.
Subclasses should reimplement it to restore custom settings. Reimplemented functions should first call Superclass implementation.
Reimplemented from albaDevice.
|
protectedvirtual |
start device
Reimplemented from albaDevice.
Reimplemented in albaDeviceButtonsPadTrackerP5Glove, and albaDeviceTrackerWIIMote.
|
protectedvirtual |
to be redefined by subclasses to define the shutdown actions
Reimplemented from albaAgentThreaded.
Reimplemented in albaDeviceButtonsPadTrackerP5Glove, and albaDeviceTrackerWIIMote.
|
protectedvirtual |
add pose matrix to the event
Reimplemented from albaDeviceButtonsPad.
|
protected |
|
protected |
stores the last pose matrix
Definition at line 209 of file albaDeviceButtonsPadTracker.h.
|
protected |
Flag used when last pose has not been served yet.
Definition at line 210 of file albaDeviceButtonsPadTracker.h.
|
protected |
Time stamp of last MoveEvent.
Definition at line 211 of file albaDeviceButtonsPadTracker.h.
|
protected |
Definition at line 212 of file albaDeviceButtonsPadTracker.h.
|
protected |
Definition at line 214 of file albaDeviceButtonsPadTracker.h.
|
protected |
Definition at line 216 of file albaDeviceButtonsPadTracker.h.
|
protected |
the current avatar
Definition at line 218 of file albaDeviceButtonsPadTracker.h.
|
protected |
the avatar set thorugh the GUI
Definition at line 219 of file albaDeviceButtonsPadTracker.h.
|
protected |
Bounds of canonical space.
Definition at line 223 of file albaDeviceButtonsPadTracker.h.
|
protected |
used for the GUI
Definition at line 224 of file albaDeviceButtonsPadTracker.h.
|
protected |
Stores tracked volume bounds (xmin,xmax,ymin,ymax,zmin,zmax)
Definition at line 225 of file albaDeviceButtonsPadTracker.h.
|
protected |
Used to store the tracked box orientation (VTK's convention: cardan angles)
Definition at line 226 of file albaDeviceButtonsPadTracker.h.
|
protected |
Used to store the tracked box center.
Definition at line 227 of file albaDeviceButtonsPadTracker.h.