7 #include "imstkDeviceClient.h" 8 #include "imstkLogger.h" 13 DeviceClient::DeviceClient(
const std::string& name,
const std::string& ip) :
16 m_position(Vec3d::Zero()),
17 m_velocity(Vec3d::Zero()),
18 m_orientation(Quatd::Identity()),
19 m_force(Vec3d::Zero())
27 m_transformLock.lock();
29 m_transformLock.unlock();
37 m_transformLock.lock();
39 m_transformLock.unlock();
47 m_transformLock.lock();
48 angVel = m_angularVelocity;
49 m_transformLock.unlock();
57 m_transformLock.lock();
58 orientation = m_orientation;
59 m_transformLock.unlock();
74 DeviceClient::setForce(Vec3d force)
81 const std::unordered_map<int, int>&
92 if (m_buttons.find(buttonId) != m_buttons.end())
94 result = m_buttons.at(buttonId);
103 std::vector<double> result;
105 result = m_analogChannels;
113 if (i > m_analogChannels.size())
115 LOG(WARNING) <<
"Requested unknown channel, returning NAN";
116 return std::numeric_limits<double>::quiet_NaN();
122 result = m_analogChannels[i];
Vec3d getForce()
Get/Set the device force.
Vec3d getPosition()
Get the device position.
Vec3d getVelocity()
Get the device velocity.
Vec3d getAngularVelocity()
Get the device angular velocity.
Quatd getOrientation()
Get the device orientation.
std::vector< double > getAnalog() const
get values of the analog input
const std::unordered_map< int, int > & getButtons() const
Get button map.
int getButton(const int buttonId)
Get the state of a button returns 0 if can't find button.