Skip to content
Snippets Groups Projects
Commit 55a57e2d authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

ENH: Add dummy client that can be controlled externally

parent d9e125e4
No related branches found
No related tags found
No related merge requests found
/*=========================================================================
Library: iMSTK
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
#include <map>
#include "imstkDummyClient.h"
#include "g3log/g3log.hpp"
namespace imstk
{
void
DummyClient::setButton(const unsigned int buttonId, const bool buttonStatus)
{
auto x = m_buttons.find(buttonId);
if (x != m_buttons.end())
{
x->second = buttonStatus;
}
}
} // imstk
/*=========================================================================
Library: iMSTK
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
#ifndef imstkDummyClient_h
#define imstkDummyClient_h
#include "imstkDeviceClient.h"
namespace imstk
{
///
/// \class Dummy client
/// \brief Allows setting the pose of the device from external caller
///
class DummyClient : public DeviceClient
{
public:
///
/// \brief Constructor/Destructor
///
DummyClient(std::string name) : DeviceClient(name, "localhost"){}
virtual ~DummyClient(){}
protected:
///
/// \brief Initialize the phantom omni device
///
void init(const unsigned int numButtons = 0)
{
for (unsigned int i = 0; i < numButtons; ++i)
{
m_buttons[i] = false;
}
};
void run() = delete;
void cleanUp() = delete;
public:
///
/// \brief Set position
///
void setPosition(const Vec3d& pos) { m_position = pos; };
///
/// \brief Set velocity
///
void setVelocity(const Vec3d& vel) { m_velocity = vel; };
///
/// \brief Set orientation
///
void setOrientation(const Quatd& orient) { m_orientation = orient; };
///
/// \brief Set orientation from 4x4 transform
///
void setOrientation(double* transform)
{
m_orientation = (Eigen::Affine3d(Eigen::Matrix4d(transform))).rotation();
};
///
/// \brief Set the button status if it exists
///
void setButton(const unsigned int buttonId, const bool buttonStatus);
};
}
#endif // ifndef imstkDummyClient_h
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment