My Project
Loading...
Searching...
No Matches
CGenericTool.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 Francois Conti
40 \version 3.3.0
41*/
42//==============================================================================
43
44//------------------------------------------------------------------------------
45#ifndef CGenericToolH
46#define CGenericToolH
47//------------------------------------------------------------------------------
53#include "tools/CHapticPoint.h"
55#include "world/CWorld.h"
56//------------------------------------------------------------------------------
57
58//------------------------------------------------------------------------------
59namespace chai3d {
60//------------------------------------------------------------------------------
61
62//==============================================================================
69//==============================================================================
70
71//==============================================================================
84//==============================================================================
86{
87 //--------------------------------------------------------------------------
88 // CONSTRUCTOR & DESTRUCTOR:
89 //--------------------------------------------------------------------------
90
91public:
92
94 cGenericTool(cWorld* a_parentWorld);
95
97 virtual ~cGenericTool();
98
99
100 //--------------------------------------------------------------------------
101 // PUBLIC METHODS - GENERAL:
102 //--------------------------------------------------------------------------
103
104public:
105
107 virtual std::string getClassName() { return ("GenericTool"); }
108
109
110 //--------------------------------------------------------------------------
111 // PUBLIC METHODS - HAPTIC DEVICE
112 //--------------------------------------------------------------------------
113
114public:
115
117 void setHapticDevice(cGenericHapticDevicePtr a_hapticDevice) { if (a_hapticDevice != nullptr) { m_hapticDevice = a_hapticDevice; } }
118
121
123 virtual bool start();
124
126 virtual bool stop();
127
128
129 //--------------------------------------------------------------------------
130 // PUBLIC METHODS - FORCE CONTROL
131 //--------------------------------------------------------------------------
132
133public:
134
136 virtual void initialize();
137
139 virtual void updateFromDevice();
140
142 virtual void computeInteractionForces();
143
145 virtual bool applyToDevice();
146
148 virtual bool setForcesON();
149
151 virtual bool setForcesOFF();
152
153
154 //--------------------------------------------------------------------------
155 // PUBLIC METHODS - STARTUP MODES
156 //--------------------------------------------------------------------------
157
158public:
159
161 inline void setWaitForSmallForce(const bool a_value) { m_useWaitForSmallForce = a_value; }
162
165
167 void setSmallForceThresh(const double a_smallForceThresh) { m_smallForceThresh = fabs(a_smallForceThresh); }
168
171
173 void setUseForceRise(const bool a_value) { m_useForceRise = a_value; if (a_value) m_forceEngaged = true; }
174
176 bool getUseForceRise() { return (m_useForceRise); }
177
179 void setRiseTime(const double a_riseTime) { m_forceRiseTime = fabs(a_riseTime); }
180
182 double getRiseTime() { return (m_forceRiseTime); }
183
184
185 //--------------------------------------------------------------------------
186 // PUBLIC METHODS - USER SWITCH DATA
187 //--------------------------------------------------------------------------
188
189public:
190
192 virtual bool getUserSwitch(const unsigned int a_switchIndex) const { return (cCheckBit(m_userSwitches, a_switchIndex)); }
193
195 virtual void setUserSwitch(const unsigned int a_switchIndex, const bool a_value);
196
198 virtual unsigned int getUserSwitches() const { return (m_userSwitches); }
199
201 virtual void setUserSwitches(const unsigned int a_userSwitches);
202
203
204 //--------------------------------------------------------------------------
205 // PUBLIC METHODS - GRIPPER ANGLE POSITION AND ANGULAR VELOCITY
206 //--------------------------------------------------------------------------
207
208public:
209
211 virtual double getGripperAngleRad() const { return (m_gripperAngle); }
212
214 virtual void setGripperAngleRad(const double& a_gripperAngleRad);
215
217 virtual double getGripperAngleDeg() const { return (cRadToDeg(m_gripperAngle)); }
218
220 virtual void setGripperAngleDeg(const double& a_gripperAngleDeg);
221
223 virtual double getGripperAngVel() const { return (m_gripperAngVel); }
224
226 virtual void setGripperAngVel(const double& a_gripperAngVel);
227
228
229 //--------------------------------------------------------------------------
230 // PUBLIC METHODS - DEVICE POSITION AND VELOCITY
231 //--------------------------------------------------------------------------
232
233public:
234
236 virtual cVector3d getDeviceLocalPos() const { return (m_deviceLocalPos); }
237
239 virtual void setDeviceLocalPos(const cVector3d& a_localPos);
240
242 void setDeviceLocalPos(const double& a_x, const double& a_y, const double& a_z) { setDeviceLocalPos(cVector3d(a_x, a_y, a_z)); }
243
245 virtual cVector3d getDeviceGlobalPos() const { return (m_deviceGlobalPos); }
246
248 virtual void setDeviceGlobalPos(const cVector3d& a_globalPos);
249
251 void setDeviceGlobalPos(const double& a_x, const double& a_y, const double& a_z) { setDeviceGlobalPos(cVector3d(a_x, a_y, a_z)); }
252
255
257 virtual void setDeviceLocalLinVel(const cVector3d& a_localLinVel);
258
260 void setDeviceLocalLinVel(const double& a_x, const double& a_y, const double& a_z) { setDeviceLocalLinVel(cVector3d(a_x, a_y, a_z)); }
261
264
266 virtual void setDeviceGlobalLinVel(const cVector3d& a_globalLinVel);
267
269 void setDeviceGlobalLinVel(const double& a_x, const double& a_y, const double& a_z) { setDeviceGlobalLinVel(cVector3d(a_x, a_y, a_z)); }
270
271
272 //--------------------------------------------------------------------------
273 // PUBLIC METHODS - DEVICE ROTATION AND ANGULAR VELOCITY
274 //--------------------------------------------------------------------------
275
276public:
277
279 virtual cMatrix3d getDeviceLocalRot() const { return (m_deviceLocalRot); }
280
282 virtual void setDeviceLocalRot(const cMatrix3d& a_localRot);
283
285 virtual void setDeviceGlobalRot(const cMatrix3d& a_globalRot);
286
288 virtual cMatrix3d getDeviceGlobalRot() const { return (m_deviceGlobalRot); }
289
292
294 virtual void setDeviceLocalAngVel(const cVector3d& a_localAngVel);
295
297 void setDeviceLocalAngVel(const double& a_x, const double& a_y, const double& a_z) { setDeviceLocalAngVel(cVector3d(a_x, a_y, a_z)); }
298
301
303 virtual void setDeviceGlobalAngVel(const cVector3d& a_globalAngVel);
304
306 void setDeviceGlobalAngVel(const double& a_x, const double& a_y, const double& a_z) { setDeviceGlobalAngVel(cVector3d(a_x, a_y, a_z)); }
307
308
309 //--------------------------------------------------------------------------
310 // PUBLIC METHODS - DEVICE POSITION AND ROTATION TRANSFORM
311 //--------------------------------------------------------------------------
312
313public:
314
317
319 virtual void setDeviceLocalTransform(const cTransform& a_localTransform);
320
323
325 virtual void setDeviceGlobalTransform(const cTransform& a_globalTransform);
326
327
328 //--------------------------------------------------------------------------
329 // PUBLIC METHODS - GRIPPER FORCE
330 //--------------------------------------------------------------------------
331
332public:
333
335 virtual double getGripperForce() const { return (m_gripperForce); }
336
338 virtual void setGripperForce(const double& a_gripperForce);
339
341 virtual void addGripperForce(const double& a_gripperForce);
342
343
344 //--------------------------------------------------------------------------
345 // PUBLIC METHODS - DEVICE FORCE
346 //--------------------------------------------------------------------------
347
348public:
349
352
354 virtual void setDeviceLocalForce(const cVector3d& a_localForce);
355
357 void setDeviceLocalForce(const double& a_x, const double& a_y, const double& a_z) { setDeviceLocalForce(cVector3d(a_x, a_y, a_z)); }
358
360 virtual void addDeviceLocalForce(const cVector3d& a_localForce);
361
363 void addDeviceLocalForce(const double& a_x, const double& a_y, const double& a_z) { addDeviceLocalForce(cVector3d(a_x, a_y, a_z)); }
364
367
369 virtual void setDeviceGlobalForce(const cVector3d& a_globalForce);
370
372 void setDeviceGlobalForce(const double& a_x, const double& a_y, const double& a_z) { setDeviceGlobalForce(cVector3d(a_x, a_y, a_z)); }
373
375 virtual void addDeviceGlobalForce(const cVector3d& a_globalForce);
376
378 void addDeviceGlobalForce(const double& a_x, const double& a_y, const double& a_z) { addDeviceGlobalForce(cVector3d(a_x, a_y, a_z)); }
379
380
381 //--------------------------------------------------------------------------
382 // PUBLIC METHODS - DEVICE TORQUE
383 //--------------------------------------------------------------------------
384
385public:
386
389
391 virtual void setDeviceLocalTorque(const cVector3d& a_localTorque);
392
394 void setDeviceLocalTorque(const double& a_x, const double& a_y, const double& a_z) { setDeviceLocalTorque(cVector3d(a_x, a_y, a_z)); }
395
397 virtual void addDeviceLocalTorque(const cVector3d& a_localTorque);
398
400 void addDeviceLocalTorque(const double& a_x, const double& a_y, const double& a_z) { addDeviceLocalTorque(cVector3d(a_x, a_y, a_z)); }
401
404
406 virtual void setDeviceGlobalTorque(const cVector3d& a_globalTorque);
407
409 void setDeviceGlobalTorque(const double& a_x, const double& a_y, const double& a_z) { setDeviceGlobalTorque(cVector3d(a_x, a_y, a_z)); }
410
412 virtual void addDeviceGlobalTorque(const cVector3d& a_globalTorque);
413
415 void addDeviceGlobalTorque(const double& a_x, const double& a_y, const double& a_z) { addDeviceGlobalTorque(cVector3d(a_x, a_y, a_z)); }
416
417
418 //--------------------------------------------------------------------------
419 // PUBLIC METHODS - WORKSPACE SETTINGS
420 //--------------------------------------------------------------------------
421
422public:
423
425 bool setWorkspaceRadius(const double& a_workspaceRadius);
426
429
431 bool setWorkspaceScaleFactor(const double& a_workspaceScaleFactor);
432
435
436
437 //--------------------------------------------------------------------------
438 // PUBLIC METHODS - HAPTIC POINTS
439 //--------------------------------------------------------------------------
440
441public:
442
444 virtual bool isInContact(cGenericObject* a_object);
445
447 int getNumHapticPoints() { return (int)(m_hapticPoints.size()); }
448
450 cHapticPoint* getHapticPoint(int a_index) { return (m_hapticPoints[a_index]); }
451
453 virtual void setRadius(double a_radius);
454
456 virtual void setRadius(double a_radiusDisplay, double a_radiusContact);
457
459 virtual void setRadiusContact(double a_radiusContact);
460
462 virtual void setRadiusDisplay(double a_radiusDisplay);
463
465 virtual void setShowContactPoints(bool a_showProxy = true,
466 bool a_showGoal = false,
467 cColorf a_colorLine = cColorf(0.5, 0.5, 0.5));
468
469
470 //--------------------------------------------------------------------------
471 // PUBLIC METHODS - WORLD
472 //--------------------------------------------------------------------------
473
474public:
475
478
480 virtual void enableDynamicObjects(bool a_enabled);
481
482
483 //--------------------------------------------------------------------------
484 // PUBLIC METHODS - AUDIO
485 //--------------------------------------------------------------------------
486
487public:
488
490 bool createAudioSource(cAudioDevice* a_audioDevice);
491
492
493 //--------------------------------------------------------------------------
494 // PUBLIC METHODS - GRAPHIC REPRESENTATION
495 //--------------------------------------------------------------------------
496
497public:
498
500 virtual void render(cRenderOptions& a_options) {};
501
502
503 //--------------------------------------------------------------------------
504 // PUBLIC MEMBERS
505 //--------------------------------------------------------------------------
506
507public:
508
511
512
513 //--------------------------------------------------------------------------
514 // PROTECTED MEMBERS - HAPTIC POINTS
515 //--------------------------------------------------------------------------
516
517protected:
518
520 std::vector <cHapticPoint*> m_hapticPoints;
521
522
523 //--------------------------------------------------------------------------
524 // PROTECTED MEMBERS - HAPTIC DEVICE
525 //--------------------------------------------------------------------------
526
527protected:
528
531
533 unsigned int m_userSwitches;
534
537
538
539 //--------------------------------------------------------------------------
540 // PROTECTED MEMBERS - FORCE DATA
541 //--------------------------------------------------------------------------
542
543protected:
544
547
550
553
556
559
560
561 //--------------------------------------------------------------------------
562 // PROTECTED MEMBERS - TOOL POSE AND WORKSPACE SETTINGS
563 //--------------------------------------------------------------------------
564
565protected:
566
569
572
575
578
581
584
587
590
593
596
599
602
603
604 //--------------------------------------------------------------------------
605 // PROTECTED MEMBERS - INTERNAL
606 //--------------------------------------------------------------------------
607
608protected:
609
612
615
618
621
624
627
630
633
636
639
642
645
648
649
650 //--------------------------------------------------------------------------
651 // PROTECTED METHODS:
652 //--------------------------------------------------------------------------
653
654protected:
655
657 virtual void updateToolImagePosition();
658
660 virtual void updateGlobalPositions(const bool a_frameOnly);
661};
662
663//------------------------------------------------------------------------------
664} // namespace chai3d
665//------------------------------------------------------------------------------
666
667//------------------------------------------------------------------------------
668#endif
669//------------------------------------------------------------------------------
Implements a finger-proxy force rendering algorithm.
Implements a force algorithm for modeling haptic effects.
Implements a frequency counter.
Implements a base class for programming collision detectors that identify intersections between segme...
Implements a base class for haptic devices.
Implements a base class for all objects.
Implements a haptic point on a tool.
Implementation of a virtual world.
This class implements an audio device context.
Definition CAudioDevice.h:82
This class implements a frequency counter.
Definition CFrequencyCounter.h:86
This class implements a base class for all 2D or 3D objects in CHAI3D.
Definition CGenericObject.h:113
This class implements a base class for modeling haptic tools.
Definition CGenericTool.h:86
virtual void setDeviceGlobalLinVel(const cVector3d &a_globalLinVel)
This method overrides the linear velocity of the device expressed in world global coordinates.
Definition CGenericTool.cpp:405
virtual void setDeviceLocalPos(const cVector3d &a_localPos)
This method overrides the position of the haptic device expressed in device local coordinates.
Definition CGenericTool.cpp:325
bool createAudioSource(cAudioDevice *a_audioDevice)
This method creates an audio source for each haptic point of this tool.
Definition CGenericTool.cpp:1175
virtual cVector3d getDeviceGlobalTorque() const
This method returns the currently computed torque expressed in world coordinates.
Definition CGenericTool.h:403
virtual void setDeviceLocalTransform(const cTransform &a_localTransform)
This method overrides the transformation matrix which expresses the position and orientation of the h...
Definition CGenericTool.cpp:448
virtual cVector3d getDeviceGlobalLinVel() const
This method returns the linear velocity of the device expressed in world global coordinates.
Definition CGenericTool.h:263
virtual cVector3d getDeviceLocalTorque() const
This method returns the currently computed torque expressed in device or tool local coordinates.
Definition CGenericTool.h:388
virtual void addDeviceLocalForce(const cVector3d &a_localForce)
This method adds a force to the currently computed force expressed in device or tool local coordinate...
Definition CGenericTool.cpp:528
cFrequencyCounter m_freqWrite
Frequency counter to measure how often data is writing to haptic device.
Definition CGenericTool.h:647
virtual cVector3d getDeviceLocalForce() const
This method returns the currently computed force expressed in device or tool local coordinates.
Definition CGenericTool.h:351
virtual double getGripperAngleDeg() const
This method returns the angle in degrees of the gripper.
Definition CGenericTool.h:217
double getRiseTime()
This method returns the force rise time.
Definition CGenericTool.h:182
int m_smallForceCounter
Counter which waits for up to several cycles of "small forces" before enabling force.
Definition CGenericTool.h:623
virtual void setShowContactPoints(bool a_showProxy=true, bool a_showGoal=false, cColorf a_colorLine=cColorf(0.5, 0.5, 0.5))
This method sets the display properties of all haptic points.
Definition CGenericTool.cpp:215
void addDeviceLocalForce(const double &a_x, const double &a_y, const double &a_z)
This method adds a force to the currently computed force expressed in device or tool local coordinate...
Definition CGenericTool.h:363
double m_workspaceScaleFactor
Scale factor applied between the workspaces of the haptic device and the tool.
Definition CGenericTool.h:571
cVector3d m_deviceLocalLinVel
Linear velocity of the haptic device in device local coordinates.
Definition CGenericTool.h:586
virtual cMatrix3d getDeviceLocalRot() const
This method returns the orientation of the haptic device expressed in device local coordinates.
Definition CGenericTool.h:279
void setSmallForceThresh(const double a_smallForceThresh)
This method sets the force threshold required to engage forces when setWaitForSmallForce() is enabled...
Definition CGenericTool.h:167
bool m_useForceRise
The flag indicates if the force rising mode is enabled or disabled.
Definition CGenericTool.h:629
void setRiseTime(const double a_riseTime)
This method sets the time required to rise the forces from 0% to 100%.
Definition CGenericTool.h:179
virtual void setDeviceLocalAngVel(const cVector3d &a_localAngVel)
This method overrides the angular velocity of the device expressed in device local coordinates.
Definition CGenericTool.cpp:419
virtual void setDeviceGlobalRot(const cMatrix3d &a_globalRot)
This method overrides the orientation of the haptic device expressed in world global coordinates.
Definition CGenericTool.cpp:375
virtual cVector3d getDeviceLocalPos() const
This method returns the position of the haptic device expressed in device local coordinates.
Definition CGenericTool.h:236
virtual void setDeviceGlobalAngVel(const cVector3d &a_globalAngVel)
This method overrides the angular velocity of the device expressed in world global coordinates.
Definition CGenericTool.cpp:433
virtual cVector3d getDeviceGlobalForce() const
This method returns the currently computed force expressed in world coordinates.
Definition CGenericTool.h:366
virtual void setGripperForce(const double &a_gripperForce)
This method overrides the current gripper force.
Definition CGenericTool.cpp:487
bool m_enabled
If true then the tool has been started and is enabled. false otherwise.
Definition CGenericTool.h:536
virtual void updateToolImagePosition()
This method updates the position and orientation of the tool image.
Definition CGenericTool.cpp:825
cPrecisionClock m_forceRiseClock
Clock to measure force rise.
Definition CGenericTool.h:635
void setDeviceLocalAngVel(const double &a_x, const double &a_y, const double &a_z)
This method overrides the angular velocity of the device expressed in device local coordinates.
Definition CGenericTool.h:297
bool setWorkspaceRadius(const double &a_workspaceRadius)
This method set the translational virtual workspace dimensions in which tool will be working.
Definition CGenericTool.cpp:1103
virtual bool start()
This method starts communication with the haptic device and initializes the tool.
Definition CGenericTool.cpp:631
cVector3d m_deviceLocalAngVel
Angular velocity of the haptic device in device local coordinates.
Definition CGenericTool.h:592
virtual void addDeviceGlobalTorque(const cVector3d &a_globalTorque)
This method adds a torque to the currently computed torque expressed in world coordinates.
Definition CGenericTool.cpp:615
virtual void setDeviceGlobalForce(const cVector3d &a_globalForce)
This method overrides the current force expressed in world coordinates.
Definition CGenericTool.cpp:542
virtual bool setForcesOFF()
This method disables forces to the haptic device.
Definition CGenericTool.cpp:1050
virtual void updateGlobalPositions(const bool a_frameOnly)
This method updates the global position of this tool in the world.
Definition CGenericTool.cpp:808
double m_gripperForce
Currently computed interaction gripper force [N].
Definition CGenericTool.h:558
void setDeviceLocalTorque(const double &a_x, const double &a_y, const double &a_z)
This method overrides the current torque expressed in device local coordinates.
Definition CGenericTool.h:394
virtual void setRadius(double a_radius)
This method sets the radius size of all haptic points.
Definition CGenericTool.cpp:138
double getWorkspaceRadius()
This method returns the radius of the workspace of the tool.
Definition CGenericTool.h:428
void addDeviceGlobalTorque(const double &a_x, const double &a_y, const double &a_z)
This method adds a torque to the curently computed torque expressed in world coordinates.
Definition CGenericTool.h:415
double m_workspaceRadius
Radius of the workspace which can be accessed by the tool.
Definition CGenericTool.h:568
virtual void addDeviceGlobalForce(const cVector3d &a_globalForce)
This method adds a force to the currently computed force expressed in world coordinates.
Definition CGenericTool.cpp:557
virtual ~cGenericTool()
Destructor of cGenericTool.
Definition CGenericTool.cpp:122
virtual void setDeviceGlobalTorque(const cVector3d &a_globalTorque)
This method overrides the current torque expressed in world coordinates.
Definition CGenericTool.cpp:600
cFrequencyCounter m_freqRead
Frequency counter to measure how often data is read from haptic device.
Definition CGenericTool.h:644
cHapticPoint * getHapticPoint(int a_index)
This method returns a pointer to a haptic point by passing its index number.
Definition CGenericTool.h:450
cMatrix3d m_deviceGlobalRot
Orientation of the haptic device in world global coordinates.
Definition CGenericTool.h:583
void setWaitForSmallForce(const bool a_value)
This method enables the tool to wait for the simulation to compute a small force before sending it to...
Definition CGenericTool.h:161
int getNumHapticPoints()
This method returns the number of haptic points that describe this tool.
Definition CGenericTool.h:447
virtual bool stop()
This method stops communication with the haptic device.
Definition CGenericTool.cpp:680
virtual void setGripperAngVel(const double &a_gripperAngVel)
This method overrides the angular velocity of the gripper in radians per second.
Definition CGenericTool.cpp:312
virtual cVector3d getDeviceGlobalAngVel() const
This method returns the angular velocity of the device expressed in world global coordinates.
Definition CGenericTool.h:300
cVector3d m_deviceGlobalLinVel
Linear velocity of the haptic device in world global coordinates.
Definition CGenericTool.h:589
cGenericObject * m_image
Generic image model that can be used to display any a representation of the tool.
Definition CGenericTool.h:510
cGenericHapticDevicePtr m_hapticDevice
Handle to the haptic device.
Definition CGenericTool.h:530
virtual void updateFromDevice()
This method updates the position, orientation, velocity and other degree of freedoms of the tool by r...
Definition CGenericTool.cpp:715
virtual void setRadiusDisplay(double a_radiusDisplay)
This method sets the radius size of the spheres used to display the proxies and goals positions.
Definition CGenericTool.cpp:196
virtual void initialize()
This method resets the contact force models and sets the tool at the position of the haptic device.
Definition CGenericTool.cpp:696
virtual cVector3d getDeviceLocalAngVel() const
This method returns the angular velocity of the device expressed in device local coordinates.
Definition CGenericTool.h:291
void setUseForceRise(const bool a_value)
This method enables or disables the tool to gradually rise forces at startup.
Definition CGenericTool.h:173
bool getUseForceRise()
This method returns the status about force rising mode.
Definition CGenericTool.h:176
unsigned int m_userSwitches
Status of the user switches of the device attached to the tool.
Definition CGenericTool.h:533
cVector3d m_deviceLocalPos
Position of the haptic device in device local coordinates.
Definition CGenericTool.h:574
void setHapticDevice(cGenericHapticDevicePtr a_hapticDevice)
This method define a haptic device that will control this tool.
Definition CGenericTool.h:117
cWorld * m_parentWorld
Parent world of tool.
Definition CGenericTool.h:611
virtual void render(cRenderOptions &a_options)
This method renders the tool graphically using OpenGL.
Definition CGenericTool.h:500
virtual void setDeviceLocalRot(const cMatrix3d &a_localRot)
This method overrides the orientation of the haptic device expressed in device local coordinates.
Definition CGenericTool.cpp:358
virtual double getGripperForce() const
This method returns the currently computed gripper force.
Definition CGenericTool.h:335
virtual void setUserSwitch(const unsigned int a_switchIndex, const bool a_value)
This method overrides the status of a selected user switch.
Definition CGenericTool.cpp:259
cVector3d m_deviceLocalForce
Currently computed interaction force [N] in device or tool local coordinates.
Definition CGenericTool.h:546
void setDeviceGlobalForce(const double &a_x, const double &a_y, const double &a_z)
This method overrides the current force expressed in world coordinates.
Definition CGenericTool.h:372
virtual void setDeviceLocalTorque(const cVector3d &a_localTorque)
This method overrides the current torque expressed in device local coordinates.
Definition CGenericTool.cpp:571
virtual bool getUserSwitch(const unsigned int a_switchIndex) const
This method returns the status of a user switch from the device.
Definition CGenericTool.h:192
virtual void addDeviceLocalTorque(const cVector3d &a_localTorque)
This method adds a torque to the currently computed torque expressed in device local coordinates.
Definition CGenericTool.cpp:586
void setDeviceLocalPos(const double &a_x, const double &a_y, const double &a_z)
This method overrides the position of the haptic device expressed in device local coordinates.
Definition CGenericTool.h:242
void setDeviceLocalLinVel(const double &a_x, const double &a_y, const double &a_z)
This method overrides the linear velocity of the device expressed in device local coordinates.
Definition CGenericTool.h:260
bool m_useWaitForSmallForce
The flag indicates if the device should wait for a small commanded force before engaging forces.
Definition CGenericTool.h:620
cVector3d m_deviceLocalTorque
Currently computed interaction torque [N*m] in device or tool local coordinates.
Definition CGenericTool.h:552
virtual void setDeviceGlobalTransform(const cTransform &a_globalTransform)
This method overrides the transformation matrix which expresses the position and orientation of the h...
Definition CGenericTool.cpp:468
bool m_forceEngaged
This flag is used to avoid initial bumps in force (has the user sent a small force yet?...
Definition CGenericTool.h:617
virtual cTransform getDeviceGlobalTransform() const
This method returns a transformation matrix which expresses the position and orientation of the hapti...
Definition CGenericTool.h:322
double m_smallForceThresh
Force threshold that determines when forces are engaged if m_useWaitForSmallForce is enabled.
Definition CGenericTool.h:626
virtual void setGripperAngleDeg(const double &a_gripperAngleDeg)
This method overrides the angle in degrees of the gripper.
Definition CGenericTool.cpp:298
void addDeviceGlobalForce(const double &a_x, const double &a_y, const double &a_z)
This method adds a force to the currently computed force expressed in world coordinates.
Definition CGenericTool.h:378
void addDeviceLocalTorque(const double &a_x, const double &a_y, const double &a_z)
This method adds a torque to the currently computed torque expressed in device local coordinates.
Definition CGenericTool.h:400
virtual cMatrix3d getDeviceGlobalRot() const
This method returns the orientation of the haptic device expressed in world global coordinates.
Definition CGenericTool.h:288
virtual cVector3d getDeviceLocalLinVel() const
This method returns the linear velocity of the device expressed in device local coordinates.
Definition CGenericTool.h:254
cVector3d m_deviceGlobalAngVel
Angular velocity of the haptic device in world global coordinates.
Definition CGenericTool.h:595
double m_gripperAngle
Gripper angle in radians.
Definition CGenericTool.h:598
cVector3d m_deviceGlobalTorque
Currently computed interaction torque [N*m] in world global coordinates.
Definition CGenericTool.h:555
virtual cTransform getDeviceLocalTransform() const
This method returns a transformation matrix which expresses the position and orientation of the hapti...
Definition CGenericTool.h:316
cVector3d m_deviceGlobalPos
Position of the haptic device in world global coordinates.
Definition CGenericTool.h:577
double m_gripperAngVel
Gripper angular velocity in radians per second.
Definition CGenericTool.h:601
virtual void setUserSwitches(const unsigned int a_userSwitches)
This method overrides the status of all user switches on the device.
Definition CGenericTool.cpp:272
virtual void setGripperAngleRad(const double &a_gripperAngleRad)
This method overrides the angle in radians of the gripper.
Definition CGenericTool.cpp:285
virtual bool setForcesON()
This method enables forces to the haptic device.
Definition CGenericTool.cpp:1020
void setDeviceLocalForce(const double &a_x, const double &a_y, const double &a_z)
This method overrides the current force expressed in device or tool local coordinates.
Definition CGenericTool.h:357
cWorld * getParentWorld()
This method returns the parent world of this tool.
Definition CGenericTool.h:477
bool m_flagForceRiseFirstTime
Flag that indicates when force ramping is called for the first time.
Definition CGenericTool.h:638
cMatrix3d m_deviceLocalRot
Orientation of the haptic device in device local coordinates.
Definition CGenericTool.h:580
void setDeviceGlobalAngVel(const double &a_x, const double &a_y, const double &a_z)
This method overrides the angular velocity of the device expressed in world global coordinates.
Definition CGenericTool.h:306
virtual void enableDynamicObjects(bool a_enabled)
This method enables or disables the dynamic proxy algorithm to support environments where mesh object...
Definition CGenericTool.cpp:242
bool m_flagForceRiseActivated
Flag that indicates if forces are currently rising.
Definition CGenericTool.h:641
virtual unsigned int getUserSwitches() const
This method returns the status of all user switches on the device.
Definition CGenericTool.h:198
double m_forceRiseTime
Force rising time in seconds.
Definition CGenericTool.h:632
virtual std::string getClassName()
This method returns the name of the object class.
Definition CGenericTool.h:107
void setDeviceGlobalTorque(const double &a_x, const double &a_y, const double &a_z)
This method overrides the current torque expressed in world coordinates.
Definition CGenericTool.h:409
void setDeviceGlobalLinVel(const double &a_x, const double &a_y, const double &a_z)
This method overrides the linear velocity of the device expressed in world global coordinates.
Definition CGenericTool.h:269
bool setWorkspaceScaleFactor(const double &a_workspaceScaleFactor)
This method sets the scale factor between the workspaces of the haptic device and the virtual tool.
Definition CGenericTool.cpp:1142
virtual double getGripperAngleRad() const
This method returns the angle in radians of the gripper.
Definition CGenericTool.h:211
bool m_forceOn
This flag indicates whether the forces are enabled or disabled on the hapitc device.
Definition CGenericTool.h:614
virtual double getGripperAngVel() const
This method returns the angular velocity in radians per second of the gripper.
Definition CGenericTool.h:223
virtual void computeInteractionForces()
This method computes all interaction forces between the tool's haptic points and the virtual environm...
Definition CGenericTool.cpp:842
cGenericHapticDevicePtr getHapticDevice()
This method returns a pointer to the haptic device that is controlling this tool.
Definition CGenericTool.h:120
virtual bool isInContact(cGenericObject *a_object)
This method checks if the tool is touching a particular object.
Definition CGenericTool.cpp:1081
virtual bool applyToDevice()
This method sends the latest computed interaction force, torque, and gripper force to the haptic devi...
Definition CGenericTool.cpp:886
std::vector< cHapticPoint * > m_hapticPoints
Haptic points that describe the tool.
Definition CGenericTool.h:520
virtual void addGripperForce(const double &a_gripperForce)
This method adds a force to the currently computed gripper force.
Definition CGenericTool.cpp:500
void setDeviceGlobalPos(const double &a_x, const double &a_y, const double &a_z)
This method overrides the position of the haptic device expressed in world global coordinates.
Definition CGenericTool.h:251
double getSmallForceThresh()
This method returns the force threshold required to engage forces when setWaitForSmallForce() is enab...
Definition CGenericTool.h:170
double getWorkspaceScaleFactor()
This method returns the current workspace scale factor between the haptic device and the tool.
Definition CGenericTool.h:434
bool getWaitForSmallForce()
This method returns the status about waiting for small small forces to appear before sending them to ...
Definition CGenericTool.h:164
virtual void setRadiusContact(double a_radiusContact)
This method sets the radius size of the of the physical proxy used in all haptic points.
Definition CGenericTool.cpp:179
virtual cVector3d getDeviceGlobalPos() const
This method returns the position of the haptic device expressed in world global coordinates.
Definition CGenericTool.h:245
virtual void setDeviceLocalLinVel(const cVector3d &a_localLinVel)
This method overrides the linear velocity of the device expressed in device local coordinates.
Definition CGenericTool.cpp:391
cVector3d m_deviceGlobalForce
Currently computed interaction force [N] in world global coordinates.
Definition CGenericTool.h:549
virtual void setDeviceGlobalPos(const cVector3d &a_globalPos)
This method overrides the position of the haptic device expressed in world global coordinates.
Definition CGenericTool.cpp:341
virtual void setDeviceLocalForce(const cVector3d &a_localForce)
This method overrides the current force expressed in device or tool local coordinates.
Definition CGenericTool.cpp:513
This class implements a haptic point on a tool.
Definition CHapticPoint.h:98
This class implements a high precision clock.
Definition CPrecisionClock.h:86
This class implements a virtual world.
Definition CWorld.h:93
Definition CAudioBuffer.cpp:57
double cRadToDeg(const double &a_angleRad)
This function converts an angle from radians to degrees.
Definition CMaths.h:716
std::shared_ptr< cGenericHapticDevice > cGenericHapticDevicePtr
Definition CGenericHapticDevice.h:267
bool cCheckBit(const unsigned int &a_value, const unsigned int &a_bitPosition)
This function checks if a given bit is enabled.
Definition CMaths.h:93
This class defines a color using a GLfloat representation for each component.
Definition CColor.h:139
This class implements a 3D matrix.
Definition CMatrix3d.h:98
This structures provide a containers for storing rendering options that are passed through the sceneg...
Definition CRenderOptions.h:83
This class implements a 4D transformation matrix encoded as column-major.
Definition CTransform.h:76
This class implements a 3D vector.
Definition CVector3d.h:89