cgv
Loading...
Searching...
No Matches
vr::vr_driver Class Referenceabstract

interface class for vr drivers. More...

#include <vr_driver.h>

Inheritance diagram for vr::vr_driver:
vr_emulator

Public Member Functions

virtual ~vr_driver ()
 declare destructor virtual to ensure it being called also for derived classes
virtual std::string get_driver_name () const =0
 return name of driver
virtual bool is_installed () const =0
 return whether driver is installed
virtual std::vector< void * > scan_vr_kits ()=0
 scan all connected vr kits and return a vector with their ids
virtual vr_kit * replace_by_index (int &index, vr_kit *new_kit_ptr)=0
 scan all connected vr kits and return a vector with their ids
virtual bool replace_by_pointer (vr_kit *old_kit_ptr, vr_kit *new_kit_ptr)=0
 scan all connected vr kits and return a vector with their ids
void put_x_direction (float *x_dir) const
 put a 3d x direction into passed array
virtual void put_up_direction (float *up_dir) const =0
 put a 3d up direction into passed array
virtual float get_floor_level () const =0
 return the floor level relativ to the world origin
virtual float get_action_zone_height () const =0
 return height of action zone in meters
virtual void put_action_zone_bounary (std::vector< float > &boundary) const =0
 return a vector of floor points defining the action zone boundary as a closed polygon
void put_calibration_transformation (float transformation_matrix[12]) const
 read access to calibration transformation stored as 3x4-matrix
void calibrate_pose (float(&pose)[12]) const
 in case calibration matrix is enabled, transform given pose in place
void enable_calibration_transformation ()
 enable use of calibration transformation
void disable_calibration_transformation ()
 disable use of calibration transformation
bool is_calibration_transformation_enabled () const
 check whether calibration transformation is enabled; false after construction and typically set to true when calibration is read from calibration file
virtual const std::map< std::string, vr_trackable_state > & get_tracking_reference_states () const
 provide read only access to tracking reference states
virtual const vr_tracking_system_info & get_tracking_system_info () const
 provide information on tracking system

Protected Member Functions

void set_index (unsigned _idx)
 write access to driver index is restricted to the register_driver() function
void register_vr_kit (void *handle, vr_kit *kit)
 call this method during scanning of vr kits. In case vr kit handle had been registered before, previous copy is deleted and a warning is issued
void replace_vr_kit (void *handle, vr_kit *kit)
 call this method during replacement of vr kits. In case vr kit handle had been registered before it is replaced, otherwise it is registered
vr_trackable_state & ref_tracking_reference_state (const std::string &serial_nummer)
 provide reference to tracking reference states
void clear_tracking_reference_states ()
 remove all tracking reference states
void mark_tracking_references_as_untracked ()
 mark all tracking reference states as untracked
void set_calibration_transformation (const float new_transformation_matrix[12])
 write access to calibration transformation is reserved to classes derived from vr_calibration_base
 vr_driver ()
 protected constructor

Protected Attributes

vr_tracking_system_info tracking_system_info
 store tracking system info to be filled by driver implementations

Friends

class vr_kit
 allow vr_kit access to ref_reference_state and tracking_system_info
class vr_calibration_base
void CGV_API register_driver (vr_driver *vrd)
 register a new driver

Detailed Description

interface class for vr drivers.

A vr driver has a name get_driver_name() and can be installed or not installed(). It allows to scan for vr kits scan_vr_kits(), which returns a vector of device handles. When implementing your driver, provide a constructor with a single options argument of type std::string. A vr driver also provides information about the action zone via the function put_x_direction(), put_up_direction(), get_floor_level(), get_action_zone_height() and put_action_zone_bounary().

Definition at line 56 of file vr_driver.h.

Constructor & Destructor Documentation

◆ vr_driver()

vr::vr_driver::vr_driver ( )
protected

protected constructor

Definition at line 41 of file vr_driver.cxx.

Referenced by register_driver.

◆ ~vr_driver()

vr::vr_driver::~vr_driver ( )
virtual

declare destructor virtual to ensure it being called also for derived classes

Definition at line 117 of file vr_driver.cxx.

Member Function Documentation

◆ calibrate_pose()

void vr::vr_driver::calibrate_pose ( float(&) pose[12]) const

in case calibration matrix is enabled, transform given pose in place

Definition at line 55 of file vr_driver.cxx.

Referenced by get_tracking_reference_states(), put_action_zone_bounary(), and vr::vr_kit::query_state().

◆ clear_tracking_reference_states()

void vr::vr_driver::clear_tracking_reference_states ( )
protected

remove all tracking reference states

remove all reference states

Definition at line 28 of file vr_driver.cxx.

◆ disable_calibration_transformation()

void vr::vr_driver::disable_calibration_transformation ( )

disable use of calibration transformation

Definition at line 89 of file vr_driver.cxx.

Referenced by put_action_zone_bounary().

◆ enable_calibration_transformation()

void vr::vr_driver::enable_calibration_transformation ( )

enable use of calibration transformation

Definition at line 84 of file vr_driver.cxx.

Referenced by put_action_zone_bounary(), and cgv::gui::vr_calibration::update_driver_calibration().

◆ get_action_zone_height()

virtual float vr::vr_driver::get_action_zone_height ( ) const
pure virtual

return height of action zone in meters

Implemented in vr_emulator.

Referenced by vr_view_interactor::draw_action_zone().

◆ get_driver_name()

virtual std::string vr::vr_driver::get_driver_name ( ) const
pure virtual

◆ get_floor_level()

virtual float vr::vr_driver::get_floor_level ( ) const
pure virtual

return the floor level relativ to the world origin

Implemented in vr_emulator.

◆ get_tracking_reference_states()

const std::map< std::string, vr_trackable_state > & vr::vr_driver::get_tracking_reference_states ( ) const
virtual

provide read only access to tracking reference states

provide read only access to reference states

Definition at line 99 of file vr_driver.cxx.

References calibrate_pose(), is_calibration_transformation_enabled(), and vr::VRS_TRACKED.

Referenced by put_action_zone_bounary(), and cgv::gui::vr_calibration::update_driver_calibration().

◆ get_tracking_system_info()

const vr_tracking_system_info & vr::vr_driver::get_tracking_system_info ( ) const
virtual

provide information on tracking system

Definition at line 111 of file vr_driver.cxx.

References tracking_system_info.

Referenced by put_action_zone_bounary(), and register_vr_kit().

◆ is_calibration_transformation_enabled()

bool vr::vr_driver::is_calibration_transformation_enabled ( ) const

check whether calibration transformation is enabled; false after construction and typically set to true when calibration is read from calibration file

Definition at line 94 of file vr_driver.cxx.

Referenced by get_tracking_reference_states(), put_action_zone_bounary(), and vr::vr_kit::query_state().

◆ is_installed()

virtual bool vr::vr_driver::is_installed ( ) const
pure virtual

return whether driver is installed

Implemented in vr_emulator.

◆ mark_tracking_references_as_untracked()

void vr::vr_driver::mark_tracking_references_as_untracked ( )
protected

mark all tracking reference states as untracked

mark all reference states as untracked

Definition at line 34 of file vr_driver.cxx.

References vr::vr_trackable_state::status, and vr::VRS_DETACHED.

◆ put_action_zone_bounary()

virtual void vr::vr_driver::put_action_zone_bounary ( std::vector< float > & boundary) const
pure virtual

◆ put_calibration_transformation()

void vr::vr_driver::put_calibration_transformation ( float transformation_matrix[12]) const

read access to calibration transformation stored as 3x4-matrix

Definition at line 50 of file vr_driver.cxx.

Referenced by put_action_zone_bounary(), and cgv::gui::vr_calibration::update_driver_calibration().

◆ put_up_direction()

virtual void vr::vr_driver::put_up_direction ( float * up_dir) const
pure virtual

put a 3d up direction into passed array

Implemented in vr_emulator.

Referenced by vr_view_interactor::draw_action_zone().

◆ put_x_direction()

void vr::vr_driver::put_x_direction ( float * x_dir) const

put a 3d x direction into passed array

Definition at line 122 of file vr_driver.cxx.

Referenced by replace_by_pointer().

◆ ref_tracking_reference_state()

vr_trackable_state & vr::vr_driver::ref_tracking_reference_state ( const std::string & serial_nummer)
protected

provide reference to tracking reference states

provide reference to reference states

Definition at line 22 of file vr_driver.cxx.

Referenced by vr_emulator::update_reference_states().

◆ register_vr_kit()

void vr::vr_driver::register_vr_kit ( void * handle,
vr_kit * kit )
protected

call this method during scanning of vr kits. In case vr kit handle had been registered before, previous copy is deleted and a warning is issued

call this method during scanning of vr kits but only in case vr kit id does not yield vr kit through global get_vr_kit function

Definition at line 138 of file vr_driver.cxx.

References vr::vr_kit::get_camera(), vr::vr_kit::get_device_info(), vr::vr_kit::get_driver(), vr::vr_kit::get_name(), get_tracking_system_info(), vr::vr_camera::initialize(), vr::ref_vr_kit_map(), and vr_kit.

◆ replace_by_index()

virtual vr_kit * vr::vr_driver::replace_by_index ( int & index,
vr_kit * new_kit_ptr )
pure virtual

scan all connected vr kits and return a vector with their ids

Implemented in vr_emulator.

References vr_kit.

◆ replace_by_pointer()

virtual bool vr::vr_driver::replace_by_pointer ( vr_kit * old_kit_ptr,
vr_kit * new_kit_ptr )
pure virtual

scan all connected vr kits and return a vector with their ids

Implemented in vr_emulator.

References put_x_direction(), and vr_kit.

◆ replace_vr_kit()

void vr::vr_driver::replace_vr_kit ( void * handle,
vr_kit * kit )
protected

call this method during replacement of vr kits. In case vr kit handle had been registered before it is replaced, otherwise it is registered

Definition at line 128 of file vr_driver.cxx.

References vr::ref_vr_kit_map(), and vr_kit.

Referenced by vr_emulator::replace_by_index(), and vr_emulator::replace_by_pointer().

◆ scan_vr_kits()

virtual std::vector< void * > vr::vr_driver::scan_vr_kits ( )
pure virtual

scan all connected vr kits and return a vector with their ids

Implemented in vr_emulator.

Referenced by cgv::gui::vr_calibration::update_driver_calibration().

◆ set_calibration_transformation()

void vr::vr_driver::set_calibration_transformation ( const float new_transformation_matrix[12])
protected

write access to calibration transformation is reserved to classes derived from vr_calibration_base

Definition at line 79 of file vr_driver.cxx.

Referenced by vr::vr_calibration_base::set_driver_calibration_matrix().

◆ set_index()

void vr::vr_driver::set_index ( unsigned _idx)
protected

write access to driver index is restricted to the register_driver() function

Definition at line 160 of file vr_driver.cxx.

Referenced by register_driver.

◆ register_driver

void CGV_API register_driver ( vr_driver * vrd)
friend

register a new driver

Definition at line 173 of file vr_driver.cxx.

References vr::ref_drivers(), set_index(), and vr_driver().

◆ vr_calibration_base

friend class vr_calibration_base
friend

Definition at line 93 of file vr_driver.h.

◆ vr_kit

friend class vr_kit
friend

allow vr_kit access to ref_reference_state and tracking_system_info

Definition at line 76 of file vr_driver.h.

References vr_kit.

Referenced by register_vr_kit(), replace_by_index(), replace_by_pointer(), replace_vr_kit(), and vr_kit.

Member Data Documentation

◆ tracking_system_info

vr_tracking_system_info vr::vr_driver::tracking_system_info
mutableprotected

store tracking system info to be filled by driver implementations

Definition at line 78 of file vr_driver.h.

Referenced by get_tracking_system_info().


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