Skip to content

Commit

Permalink
add enum value to stop the thumper haptic feedback for SenseGlove
Browse files Browse the repository at this point in the history
  • Loading branch information
kouroshD committed Jan 18, 2022
1 parent e94eb10 commit 8d336ef
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
43 changes: 43 additions & 0 deletions modules/HapticGlove_module/include/GloveWearable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,55 @@
#include <yarp/os/BufferedPort.h>
#include <yarp/os/Searchable.h>

template <typename E> constexpr typename std::underlying_type<E>::type to_underlying(E e) noexcept
{
return static_cast<typename std::underlying_type<E>::type>(e);
}

using namespace yarp::os;
namespace HapticGlove
{
class GloveWearableImpl;
namespace SenseGlove
{
enum class ThumperCmd : unsigned int;
} // namespace SenseGlove
} // namespace HapticGlove

enum class HapticGlove::SenseGlove::ThumperCmd : unsigned int
{
None = 126,

/// <summary> Turn off the thumper effects. </summary>
TurnOff = 124,

/// <summary> A 5-second long, constant vibration. </summary>
Cue_Game_Over = 118,

/// <summary> A double-click at 100% intensity. </summary>
Button_Double_100 = 10,
/// <summary> A double click at 60% intensity. </summary>
Button_Double_60 = 11,

/// <summary> Simulates an impact of the hand at 100% intensity. </summary>
Impact_Thump_100 = 1,
/// <summary> Simulates an impact of the hand at 30% intensity. </summary>
Impact_Thump_30 = 3,
/// <summary> Simulates an sharp impact of the hand at 40% intensity.
/// </summary>
Impact_Thump_10 = 6,

/// <summary> A light vibration to cue the user that an object it picked up.
/// 100% intensity. </summary>
Object_Grasp_100 = 7,
/// <summary> A light vibration to cue the user that an object it picked up.
/// 60% intensity. </summary>
Object_Grasp_60 = 8,
/// <summary> A light vibration to cue the user that an object it picked up.
/// 30% intensity. </summary>
Object_Grasp_30 = 9
};

/**
* GloveWearableImpl is a class for interfacing with the haptic glove using the wearable interface.
*/
Expand Down
5 changes: 3 additions & 2 deletions modules/HapticGlove_module/src/GloveControlHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ bool GloveControlHelper::setFingertipVibrotactileFeedbackReferences(
}
bool GloveControlHelper::stopPalmVibrotactileFeedback()
{
return m_pImp->setPalmVibrotactileValue(
124); // to turn off set `124`, for more details check the documentation.
return m_pImp->setPalmVibrotactileValue(to_underlying(
HapticGlove::SenseGlove::ThumperCmd::TurnOff)); // to turn off set `124`, for more details
// check the documentation.
}

bool GloveControlHelper::stopVibrotactileFeedback()
Expand Down

0 comments on commit 8d336ef

Please sign in to comment.