My Project
Loading...
Searching...
No Matches
CMyCustomDevice.h
Go to the documentation of this file.
1//==============================================================================
2/*
3 Software License Agreement (BSD License)
4 Copyright (c) 2003-2024, CHAI3D
5 (www.chai3d.org)
6
7 All rights reserved.
8
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions
11 are met:
12
13 * Redistributions of source code must retain the above copyright
14 notice, this list of conditions and the following disclaimer.
15
16 * Redistributions in binary form must reproduce the above
17 copyright notice, this list of conditions and the following
18 disclaimer in the documentation and/or other materials provided
19 with the distribution.
20
21 * Neither the name of CHAI3D nor the names of its contributors may
22 be used to endorse or promote products derived from this software
23 without specific prior written permission.
24
25 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29 COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 POSSIBILITY OF SUCH DAMAGE.
37
38 \author <http://www.chai3d.org>
39 \author Your name, institution, or company name.
40 \version 3.3.0
41*/
42//==============================================================================
43
44//------------------------------------------------------------------------------
45#ifndef CMyCustomDeviceH
46#define CMyCustomDeviceH
47//------------------------------------------------------------------------------
48#if defined(C_ENABLE_CUSTOM_DEVICE_SUPPORT)
49//------------------------------------------------------------------------------
51//------------------------------------------------------------------------------
52
53//------------------------------------------------------------------------------
54namespace chai3d {
55//------------------------------------------------------------------------------
56
57//==============================================================================
64//==============================================================================
65
66//------------------------------------------------------------------------------
67class cMyCustomDevice;
68typedef std::shared_ptr<cMyCustomDevice> cMyCustomDevicePtr;
69//------------------------------------------------------------------------------
70
71//==============================================================================
114//==============================================================================
116{
117 //--------------------------------------------------------------------------
118 // CONSTRUCTOR & DESTRUCTOR:
119 //--------------------------------------------------------------------------
120
121public:
122
124 cMyCustomDevice(unsigned int a_deviceNumber = 0);
125
127 virtual ~cMyCustomDevice();
128
130 static cMyCustomDevicePtr create(unsigned int a_deviceNumber = 0) { return (std::make_shared<cMyCustomDevice>(a_deviceNumber)); }
131
132
133 //--------------------------------------------------------------------------
134 // PUBLIC METHODS:
135 //--------------------------------------------------------------------------
136
137public:
138
140 virtual bool open();
141
143 virtual bool close();
144
146 virtual bool calibrate(bool a_forceCalibration = false);
147
149 virtual bool getPosition(cVector3d& a_position);
150
152 virtual bool getRotation(cMatrix3d& a_rotation);
153
155 virtual bool getGripperAngleRad(double& a_angle);
156
158 virtual bool getUserSwitches(unsigned int& a_userSwitches);
159
161 virtual bool setForceAndTorqueAndGripperForce(const cVector3d& a_force, const cVector3d& a_torque, double a_gripperForce);
162
163
164 //--------------------------------------------------------------------------
165 // PUBLIC STATIC METHODS:
166 //--------------------------------------------------------------------------
167
168public:
169
171 static unsigned int getNumDevices();
172
173
174 //--------------------------------------------------------------------------
175 // PROTECTED MEMBERS:
176 //--------------------------------------------------------------------------
177
179 /*
180 INTERNAL VARIABLES:
181
182 If you need to declare any local variables or methods for your device,
183 you may do it here below.
184 */
186
187protected:
188
191};
192
193//------------------------------------------------------------------------------
194} // namespace chai3d
195//------------------------------------------------------------------------------
196#endif // C_ENABLE_CUSTOM_DEVICE_SUPPORT
197//------------------------------------------------------------------------------
198#endif
199//------------------------------------------------------------------------------
Implements a base class for haptic devices.
This class implements a base class for haptic devices.
Definition CGenericHapticDevice.h:283
This class is a interface to support custom haptic devices (template).
Definition CMyCustomDevice.h:116
virtual bool getGripperAngleRad(double &a_angle)
This method returns the gripper angle in radian [rad].
Definition CMyCustomDevice.cpp:523
virtual ~cMyCustomDevice()
Destructor of cMyCustomDevice.
Definition CMyCustomDevice.cpp:226
static cMyCustomDevicePtr create(unsigned int a_deviceNumber=0)
Shared cMyCustomDevice allocator.
Definition CMyCustomDevice.h:130
virtual bool setForceAndTorqueAndGripperForce(const cVector3d &a_force, const cVector3d &a_torque, double a_gripperForce)
This method sends a force [N] and a torque [N*m] and gripper force [N] to the haptic device.
Definition CMyCustomDevice.cpp:565
virtual bool getPosition(cVector3d &a_position)
This method returns the position of the device.
Definition CMyCustomDevice.cpp:409
virtual bool close()
This method closes the connection to the haptic device.
Definition CMyCustomDevice.cpp:295
int m_MyVariable
A short description of my variable.
Definition CMyCustomDevice.h:190
virtual bool getRotation(cMatrix3d &a_rotation)
This method returns the orientation frame of the device end-effector.
Definition CMyCustomDevice.cpp:460
virtual bool calibrate(bool a_forceCalibration=false)
This method calibrates the haptic device.
Definition CMyCustomDevice.cpp:331
virtual bool open()
This method opens a connection to the haptic device.
Definition CMyCustomDevice.cpp:243
static unsigned int getNumDevices()
This method returns the number of devices available from this class of device.
Definition CMyCustomDevice.cpp:371
virtual bool getUserSwitches(unsigned int &a_userSwitches)
This method returns the status of all user switches [true = ON / false = OFF].
Definition CMyCustomDevice.cpp:635
Definition CAudioBuffer.cpp:57
std::shared_ptr< cMyCustomDevice > cMyCustomDevicePtr
Definition CMyCustomDevice.h:68
This class implements a 3D matrix.
Definition CMatrix3d.h:98
This class implements a 3D vector.
Definition CVector3d.h:89