From 45af978b8844345ece8db32e6df504b8a827a395 Mon Sep 17 00:00:00 2001 From: Ehsan Ranjbari Date: Wed, 19 Jun 2024 12:53:53 +0200 Subject: [PATCH] remove stopAllHapticFeedback method and m_desiredHapticValues - change setFingertipHapticFeedbackReferences to send*** --- .../include/GloveControlHelper.hpp | 9 +-------- .../src/GloveControlHelper.cpp | 16 ++-------------- modules/HapticGlove_module/src/Teleoperation.cpp | 2 +- 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/modules/HapticGlove_module/include/GloveControlHelper.hpp b/modules/HapticGlove_module/include/GloveControlHelper.hpp index e816d44b..e2920972 100644 --- a/modules/HapticGlove_module/include/GloveControlHelper.hpp +++ b/modules/HapticGlove_module/include/GloveControlHelper.hpp @@ -40,7 +40,6 @@ class HapticGlove::GloveControlHelper bool m_isRightHand; /**< true if the glove is the right hand*/ - std::vector m_desiredHapticValues; /**< Desired haptic feedback values; range: [0, 100]. */ std::vector m_desiredForceValues; /**< Desired force feedback values; range: [0, 100]. */ std::vector m_desiredVibrotactileValues; /**< Desired vibrotactile feedback values; range: [0, 100] */ @@ -98,7 +97,7 @@ class HapticGlove::GloveControlHelper * Set the desired haptic feedback reference to the user fingertip * @return true/false in case of success/failure */ - bool setFingertipHapticFeedbackReferences(); + bool sendFingertipHapticFeedbackReferences(); /** * Set the desired force feedback reference to the user fingertip @@ -122,12 +121,6 @@ class HapticGlove::GloveControlHelper */ bool setPalmVibrotactileFeedbackReference(const int& desiredValue); - /** - * stop the haptics feedback (force feedback, fingertip vibrotactile feedback) to the user - * @return true/false in case of success/failure - */ - bool stopAllHapticFeedback(); - /** * stop the haptic feedback (force feedback, fingertip vibrotactile feedback, palm vibrotactile * feedback) to the user diff --git a/modules/HapticGlove_module/src/GloveControlHelper.cpp b/modules/HapticGlove_module/src/GloveControlHelper.cpp index e45bf8d9..ab6881b6 100644 --- a/modules/HapticGlove_module/src/GloveControlHelper.cpp +++ b/modules/HapticGlove_module/src/GloveControlHelper.cpp @@ -32,7 +32,6 @@ bool GloveControlHelper::configure(const yarp::os::Searchable& config, m_desiredVibrotactileValues.resize(m_numVibrotactileFeedback, 0); m_desiredForceValues.resize(m_numForceFeedback, 0); - m_desiredHapticValues.resize(m_numForceFeedback + m_numVibrotactileFeedback, 0); m_JointsValues.resize(m_numHandJoints, 0.0); @@ -203,7 +202,7 @@ bool GloveControlHelper::setFingertipVibrotactileFeedbackReferences( return true; } -bool GloveControlHelper::setFingertipHapticFeedbackReferences() +bool GloveControlHelper::sendFingertipHapticFeedbackReferences() { return m_pImp->setFingertipHapticFeedbackValues(m_desiredForceValues, m_desiredVibrotactileValues); } @@ -227,12 +226,6 @@ bool GloveControlHelper::stopForceFeedback() return true; } -bool GloveControlHelper::stopAllHapticFeedback() -{ - std::fill(m_desiredHapticValues.begin(), m_desiredHapticValues.end(), 0.0); - return m_pImp->setFingertipHapticFeedbackValues(m_desiredForceValues, m_desiredVibrotactileValues); -} - bool GloveControlHelper::stopHapticFeedback() { @@ -252,11 +245,6 @@ bool GloveControlHelper::stopHapticFeedback() "vibrotactile feedback"; return false; } - if (!stopAllHapticFeedback()) - { - yError() << m_logPrefix << "Cannot turn off the fingertip haptics feedback"; - return false; - } return true; } @@ -379,7 +367,7 @@ bool GloveControlHelper::findHumanMotionRange() std::vector desiredValue(m_numVibrotactileFeedback, 35); this->setFingertipVibrotactileFeedbackReferences(desiredValue); - this->setFingertipHapticFeedbackReferences(); + this->sendFingertipHapticFeedbackReferences(); return true; } diff --git a/modules/HapticGlove_module/src/Teleoperation.cpp b/modules/HapticGlove_module/src/Teleoperation.cpp index 06a90c8d..959f2e7c 100644 --- a/modules/HapticGlove_module/src/Teleoperation.cpp +++ b/modules/HapticGlove_module/src/Teleoperation.cpp @@ -354,7 +354,7 @@ bool Teleoperation::run() m_robotController->move(); m_humanGlove->setFingertipForceFeedbackReferences(m_data.humanForceFeedbacks); m_humanGlove->setFingertipVibrotactileFeedbackReferences(m_data.humanVibrotactileFeedbacks); - m_humanGlove->setFingertipHapticFeedbackReferences(); + m_humanGlove->sendFingertipHapticFeedbackReferences(); } if (m_enableLogger)