iMSTK
Interactive Medical Simulation Toolkit
imstkOpenVRDeviceClient.h
1 /*
2 ** This file is part of the Interactive Medical Simulation Toolkit (iMSTK)
3 ** iMSTK is distributed under the Apache License, Version 2.0.
4 ** See accompanying NOTICE for details.
5 */
6 
7 #pragma once
8 
9 #include "imstkDeviceClient.h"
10 
11 #include <unordered_map>
12 
14 
15 namespace imstk
16 {
25 {
26 protected:
30  OpenVRDeviceClient(DeviceType deviceType) : DeviceClient("OpenVRDevice", ""),
31  m_deviceType(deviceType), m_trackpadPosition(Vec2d::Zero()) { }
32 
36  static std::shared_ptr<OpenVRDeviceClient> New(DeviceType deviceType);
37 
38 public:
39  virtual ~OpenVRDeviceClient() override = default;
40 
41  // Only the viewer is allowed to provide these objects
42  friend class ::vtkInteractorStyleVR;
43 
44 public:
45  DeviceType getDeviceType() const { return m_deviceType; }
46 
47  const Vec2d& getTrackpadPosition() { return m_trackpadPosition; }
48  void setTrackpadPosition(const Vec2d& pos) { m_trackpadPosition = pos; }
49 
53  void setPose(const Vec3d& pos, const Quatd& orientation)
54  {
55  m_trackingEnabled = true;
56  m_position = pos;
57  m_orientation = orientation;
58  }
59 
60 protected:
64  void emitButtonTouched(const int buttonId);
65  void emitButtonUntouched(const int buttonId);
66  void emitButtonPress(const int buttonId);
67  void emitButtonRelease(const int buttonId);
68 
69 private:
70  DeviceType m_deviceType;
71  Vec2d m_trackpadPosition;
72 };
73 } // namespace imstk
The device client&#39;s represents the device and provides an interface to acquire data from a device...
Compound Geometry.
bool m_trackingEnabled
Tracking enabled if true.
void setPose(const Vec3d &pos, const Quatd &orientation)
Set the current position and orientation.
void emitButtonTouched(const int buttonId)
Emit various button events.
Quatd m_orientation
Orientation of the end effector.
Vec3d m_position
Position of end effector.
OpenVRDeviceClient(DeviceType deviceType)
This class provides quantities for the specified VR device The devices creation is tied to the viewer...
static std::shared_ptr< OpenVRDeviceClient > New(DeviceType deviceType)
VTK Interactor style for VR.