iMSTK
Interactive Medical Simulation Toolkit
imstkDummyClient.cpp
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 #include "imstkDummyClient.h"
8 #include "imstkLogger.h"
9 
10 namespace imstk
11 {
12 void
13 DummyClient::init(const unsigned int numButtons /*= 0*/)
14 {
15  for (unsigned int i = 0; i < numButtons; i++)
16  {
17  m_buttons[i] = false;
18  }
19 }
20 
21 void
22 DummyClient::setPosition(const Vec3d& pos)
23 {
25  m_position = pos;
27 }
28 
29 void
30 DummyClient::setVelocity(const Vec3d& vel)
31 {
33  m_velocity = vel;
35 }
36 
37 void
38 DummyClient::setOrientation(const Quatd& orient)
39 {
41  m_orientation = orient;
43 }
44 
45 void
46 DummyClient::setOrientation(double* transform)
47 {
49  m_orientation = (Eigen::Affine3d(Eigen::Matrix4d(transform))).rotation();
51 }
52 
53 void
54 DummyClient::setButton(const unsigned int buttonId, const bool buttonStatus)
55 {
56  m_dataLock.lock();
57  auto x = m_buttons.find(buttonId);
58  if (x != m_buttons.end())
59  {
60  x->second = buttonStatus;
61  }
63 }
64 } // namespace imstk
void unlock()
End a thread-safe region.
Definition: imstkSpinLock.h:53
void setPosition(const Vec3d &pos)
Set position.
ParallelUtils::SpinLock m_dataLock
Used for button and analog data.
void init(const unsigned int numButtons=0)
Initialize the client.
void setButton(const unsigned int buttonId, const bool buttonStatus)
Set the button status if it exists.
Compound Geometry.
void setVelocity(const Vec3d &vel)
Set velocity.
ParallelUtils::SpinLock m_transformLock
Used for devices filling data from other threads.
Quatd m_orientation
Orientation of the end effector.
void lock()
Start a thread-safe region, where only one thread can execute at a time until a call to the unlock fu...
Definition: imstkSpinLock.h:45
Vec3d m_velocity
Linear velocity of end effector.
Vec3d m_position
Position of end effector.
void setOrientation(const Quatd &orient)
Set orientation.