NovintDevice.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// 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
//
// 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 SURGSIM_DEVICES_NOVINT_NOVINTDEVICE_H
#define SURGSIM_DEVICES_NOVINT_NOVINTDEVICE_H
#include <string>
#include "SurgSim/DataStructures/OptionalValue.h"
#include "SurgSim/Input/CommonDevice.h"
namespace SurgSim
{
namespace Devices
{
class NovintScaffold;
SURGSIM_STATIC_REGISTRATION(NovintDevice);
class NovintDevice : public SurgSim::Input::CommonDevice
{
public:
explicit NovintDevice(const std::string& name);
SURGSIM_CLASSNAME(SurgSim::Devices::NovintDevice);
virtual ~NovintDevice();
void setSerialNumber(const std::string& serialNumber);
bool getSerialNumber(std::string* serialNumber) const;
void setInitializationName(const std::string& initializationName);
bool getInitializationName(std::string* initializationName) const;
bool initialize() override;
bool isInitialized() const override;
void setPositionScale(double scale);
double getPositionScale() const;
void setOrientationScale(double scale);
double getOrientationScale() const;
void set7DofDevice(bool val);
virtual bool is7DofDevice() const;
void setMaxForce(double force);
double getMaxForce() const;
void setAntigrav(Math::Vector3d antigrav);
Math::Vector3d getAntigrav() const;
protected:
bool m_7DofDevice;
double m_maxForce;
Math::Vector3d m_antigrav;
private:
friend class NovintScaffold;
bool finalize() override;
const DataStructures::OptionalValue<std::string>& getOptionalInitializationName() const;
void setOptionalInitializationName(const DataStructures::OptionalValue<std::string>& name);
const DataStructures::OptionalValue<std::string>& getOptionalSerialNumber() const;
void setOptionalSerialNumber(const DataStructures::OptionalValue<std::string>& serial);
std::shared_ptr<NovintScaffold> m_scaffold;
SurgSim::DataStructures::OptionalValue<std::string> m_initializationName;
SurgSim::DataStructures::OptionalValue<std::string> m_serialNumber;
double m_positionScale;
double m_orientationScale;
};
}; // namespace Devices
}; // namespace SurgSim
#endif // SURGSIM_DEVICES_NOVINT_NOVINTDEVICE_H
SurgSim::Devices::NovintDevice::setOrientationScale
void setOrientationScale(double scale)
Sets the orientation scale for this device.
Definition: NovintDevice.cpp:140
SurgSim::Devices::NovintDevice::m_maxForce
double m_maxForce
The maximum force magnitude (in Newtons) that should be sent to the hardware.
Definition: NovintDevice.h:155
SurgSim::Devices::NovintDevice::m_orientationScale
double m_orientationScale
Scale factor for the orientation axes; stored locally before the device is initialized.
Definition: NovintDevice.h:185
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Devices::NovintDevice::setPositionScale
void setPositionScale(double scale)
Sets the position scale for this device.
Definition: NovintDevice.cpp:126
SurgSim::Devices::NovintDevice::is7DofDevice
virtual bool is7DofDevice() const
Query if this object represents a 7 degree of freedom hardware device.
Definition: NovintDevice.cpp:160
SurgSim::Devices::NovintDevice::setAntigrav
void setAntigrav(Math::Vector3d antigrav)
Set a constant force that gets added to all forces sent to the hardware.
Definition: NovintDevice.cpp:179
SurgSim::Devices::NovintDevice::m_scaffold
std::shared_ptr< NovintScaffold > m_scaffold
The scaffold handles all the communication with the SDK.
Definition: NovintDevice.h:174
SurgSim::Devices::NovintDevice::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Devices::NovintDevice)
SurgSim::Devices::NovintDevice::getSerialNumber
bool getSerialNumber(std::string *serialNumber) const
Gets the serial number used to register this device with the hardware library.
Definition: NovintDevice.cpp:68
SurgSim::Devices::NovintDevice::m_7DofDevice
bool m_7DofDevice
True if the device is 7Dof, false if the device is 3Dof.
Definition: NovintDevice.h:152
SurgSim::DataStructures::OptionalValue< std::string >
SurgSim::Devices::NovintDevice::m_initializationName
SurgSim::DataStructures::OptionalValue< std::string > m_initializationName
The name passed to the SDK to specify which hardware device should be used.
Definition: NovintDevice.h:177
SurgSim::Devices::NovintScaffold
A class that manages Novint Falcon devices.
Definition: NovintScaffold.h:37
SurgSim::Devices::NovintDevice::set7DofDevice
void set7DofDevice(bool val)
Sets whether or not this is supposed to be a 7Dof device.
Definition: NovintDevice.cpp:154
SurgSim::Devices::NovintDevice::m_positionScale
double m_positionScale
Scale factor for the position axes; stored locally before the device is initialized.
Definition: NovintDevice.h:183
SurgSim::Devices::NovintDevice::setSerialNumber
void setSerialNumber(const std::string &serialNumber)
Sets the serial number used to register this device with the hardware library.
Definition: NovintDevice.cpp:58
SurgSim::Devices::NovintDevice
A class implementing the communication with a Novint Falcon device.
Definition: NovintDevice.h:69
SurgSim::Devices::NovintDevice::getInitializationName
bool getInitializationName(std::string *initializationName) const
Gets the name used to register this device with the hardware library.
Definition: NovintDevice.cpp:88
SurgSim::Devices::NovintDevice::isInitialized
bool isInitialized() const override
Definition: NovintDevice.cpp:121
SurgSim::Devices::NovintDevice::setOptionalSerialNumber
void setOptionalSerialNumber(const DataStructures::OptionalValue< std::string > &serial)
Definition: NovintDevice.cpp:207
SurgSim::Devices::NovintDevice::m_antigrav
Math::Vector3d m_antigrav
The anti-gravity force in Newtons.
Definition: NovintDevice.h:158
SurgSim::Devices::NovintDevice::NovintDevice
NovintDevice(const std::string &name)
Constructor.
Definition: NovintDevice.cpp:31
SurgSim::Input::CommonDevice
A class that implements some common management code on top of the DeviceInterface.
Definition: CommonDevice.h:35
SurgSim::Devices::NovintDevice::getOptionalInitializationName
const DataStructures::OptionalValue< std::string > & getOptionalInitializationName() const
Definition: NovintDevice.cpp:192
SurgSim::Devices::NovintDevice::setOptionalInitializationName
void setOptionalInitializationName(const DataStructures::OptionalValue< std::string > &name)
Definition: NovintDevice.cpp:197
SurgSim::Devices::NovintDevice::getOrientationScale
double getOrientationScale() const
Gets the orientation scale for this device.
Definition: NovintDevice.cpp:149
SurgSim::Devices::NovintDevice::~NovintDevice
virtual ~NovintDevice()
Destructor.
Definition: NovintDevice.cpp:50
SurgSim::Devices::NovintDevice::setInitializationName
void setInitializationName(const std::string &initializationName)
Sets the name used to register this device with the hardware library.
Definition: NovintDevice.cpp:78
CommonDevice.h
OptionalValue.h
SurgSim::Devices::NovintDevice::setMaxForce
void setMaxForce(double force)
Set the maximum force that can be sent to the device.
Definition: NovintDevice.cpp:165
SurgSim::Devices::NovintDevice::m_serialNumber
SurgSim::DataStructures::OptionalValue< std::string > m_serialNumber
The serial number passed to the SDK to specify which hardware device should be used.
Definition: NovintDevice.h:180
SurgSim::Devices::NovintDevice::getPositionScale
double getPositionScale() const
Gets the position scale for this device.
Definition: NovintDevice.cpp:135
SurgSim::Devices::NovintDevice::getAntigrav
Math::Vector3d getAntigrav() const
Definition: NovintDevice.cpp:187
SurgSim::Devices::NovintDevice::getMaxForce
double getMaxForce() const
Definition: NovintDevice.cpp:174
SurgSim::Math::Vector3d
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
SurgSim::Devices::NovintDevice::finalize
bool finalize() override
Finalize (de-initialize) the device.
Definition: NovintDevice.cpp:113
SurgSim::Devices::NovintDevice::initialize
bool initialize() override
Fully initialize the device.
Definition: NovintDevice.cpp:98
SurgSim::Devices::NovintDevice::getOptionalSerialNumber
const DataStructures::OptionalValue< std::string > & getOptionalSerialNumber() const
Definition: NovintDevice.cpp:202