Unreal SDK  v1.2.0
Loading...
Searching...
No Matches
WeArtCommon.h
Go to the documentation of this file.
1#pragma once
2#include <vector>
3#include <string>
4#include "json.hpp"
5
6UENUM(meta = (Bitflags, UseEnumValuesAsMaskValuesInEditor = "true"))
8{
9 //HSnone = 0 UMETA(Hidden),
10 Left = 1 << 0 UMETA(DisplayName = "Left") ,
11 Right = 1 << 1 UMETA(DisplayName = "Right"),
12};
15 {EHandSide::Left, "LEFT"},
16 {EHandSide::Right, "RIGHT"},
17 })
18
19UENUM(meta = (Bitflags, UseEnumValuesAsMaskValuesInEditor = "true"))
20enum EActuationPoint
21{
22 //APnone = 0 UMETA(Hidden),
23 Thumb = 1 << 0 UMETA(DisplayName = "Thumb"),
24 Index = 1 << 1 UMETA(DisplayName = "Index"),
25 Middle = 1 << 2 UMETA(DisplayName = "Middle"),
26 Palm = 1 << 3 UMETA(DisplayName = "Palm"),
27};
28ENUM_RANGE_BY_VALUES(EActuationPoint, EActuationPoint::Thumb, EActuationPoint::Index, EActuationPoint::Middle, EActuationPoint::Palm);
30 {EActuationPoint::Thumb, "THUMB"},
31 {EActuationPoint::Index, "INDEX"},
32 {EActuationPoint::Middle, "MIDDLE"},
33 {EActuationPoint::Palm, "PALM"},
34 })
35
36enum class TrackingType{
37 DEFAULT,
38 WEART_HAND
39};
40
42{
43 Open = 0,
45 Closed = 2
46};
47
48
50{
52 Released = 1
53};
54
55UENUM(meta = (Bitflags, UseEnumValuesAsMaskValuesInEditor = "true"))
56enum class MiddlewareStatus {
58 IDLE,
60 RUNNING,
65};
66
68 {MiddlewareStatus::DISCONNECTED, "DISCONNECTED"},
69 {MiddlewareStatus::IDLE, "IDLE"},
70 {MiddlewareStatus::STARTING, "STARTING"},
71 {MiddlewareStatus::RUNNING, "RUNNING"},
72 {MiddlewareStatus::STOPPING, "STOPPING"},
73 {MiddlewareStatus::UPLOADING_TEXTURES, "UPLOADING_TEXTURES"},
74 {MiddlewareStatus::CONNECTING_DEVICE, "CONNECTING_DEVICE"},
75 {MiddlewareStatus::CALIBRATION, "CALIBRATION"},
76 })
77
78 struct AccelerometerData {
79 float x = 0.0f;
80 float y = 0.0f;
81 float z = 0.0f;
82};
83NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(AccelerometerData, x, y, z)
84
86 float x = 0.0f;
87 float y = 0.0f;
88 float z = 0.0f;
89};
91
92struct TofData {
93 int distance = 0;
94};
96
97struct SensorData {
98 AccelerometerData accelerometer;
101};
102NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SensorData, accelerometer, gyroscope, timeOfFlight)
103
105 std::string macAddress;
107};
109
111 std::uint64_t timestamp;
112 std::string status;
113 std::string version;
115 std::string errorDesc;
117 std::vector<MiddlewareConnectedDevice> connectedDevices;
118};
119NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(MiddlewareStatusData, status, version, statusCode, errorDesc, actuationsEnabled, connectedDevices);
120
124 EActuationPoint id;
130 std::string errorDesc;
131};
133
137 std::string macAddress;
138
141
144
147
149 std::vector<ThimbleStatus> thimbles;
150};
151NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(ConnectedDeviceStatus, macAddress, handSide, batteryLevel, charging, thimbles);
152
153
154UENUM()
155enum class TextureType : uint8
156{
157 ClickNormal = 0, ClickSoft = 1, DoubleClick = 2,
162 CrushedRock = 10,
163 VenetianGranite = 11,
164 SilverOak = 12,
165 LaminatedWood = 13,
167 VelcroHooks = 15,
168 VelcroLoops = 16,
169 PlasticFoil2 = 17,
170 Leather = 18,
171 Cotton1 = 19,
172 Aluminium = 20,
173 DoubleSidedTape = 21
174};
175
176
177// Constants shared by the WeArt components
179{
180 const std::string WEART_SDK_TYPE = "SdkUnreal";
181 const std::string WEART_SDK_VERSION = "1.1.0";
182 const std::string WEART_SDK_TRACK_TYPE = "TrackType1";
183
184 const float defaultTemperature = 0.5f;
185 const float minTemperature = 0.0f;
186 const float maxTemperature = 1.0f;
187
188 const float defaultForce = 0.0f;
189 const float minForce = 0.0f;
190 const float maxForce = 1.0f;
191
192 const float defaultClosure = 0.0f;
193 const float minClosure = 0.0f;
194 const float maxClosure = 1.0f;
195
196 const float staticTextureVelocity = 0.5f;
197
198 const int defaultTextureIndex = 0;
199 const int minTextureIndex = 0;
200 const int maxTextureIndex = 254;
201 const int nullTextureIndex = 255;
202
203 const float defaultTextureVelocity[3] = { 0.5f, 0.0f, 0.0f };
204 const float minTextureVelocity[3] = { 0.0f, 0.0f, 0.0f };
205 const float maxTextureVelocity[3] = { 1.0f, 1.0f, 1.0f };
206
207 const float defaultCollisionMultiplier = 20.0f;
208 const float minCollisionMultiplier = 0.0f;
209 const float maxCollisionMultiplier = 100.0f;
210
211 const float defaultVolumeTexture = 100.0f;
212 const float minVolumeTexture = 0.0f;
213 const float maxVolumeTexture = 100.0f;
214
215 const float thresholdThumbClosure = 0.5f;
216 const float thresholdIndexClosure = 0.5f;
217 const float thresholdMiddleClosure = 0.5f;
218
219 const float defaultGraspForce = 0.3f;
220 const float dynamicForceSensibility = 10.0f;
221};
MiddlewareStatus
Definition: WeArtCommon.h:56
TextureType
Definition: WeArtCommon.h:156
@ AluminiumFineMeshSlow
@ RhombAluminiumMeshMedium
@ ProfiledAluminiumMeshMedium
@ ProfiledAluminiumMeshFast
@ AluminiumFineMeshFast
GraspingState
Definition: WeArtCommon.h:50
@ Grabbed
Definition: WeArtCommon.h:51
@ Released
Definition: WeArtCommon.h:52
HandClosingState
Definition: WeArtCommon.h:42
@ Closed
Definition: WeArtCommon.h:45
@ Closing
Definition: WeArtCommon.h:44
@ Open
Definition: WeArtCommon.h:43
EHandSide
Definition: WeArtCommon.h:8
@ Left
Definition: WeArtCommon.h:10
@ Right
Definition: WeArtCommon.h:11
ENUM_RANGE_BY_VALUES(EHandSide, EHandSide::Left, EHandSide::Right)
#define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE,...)
macro to briefly define a mapping between an enum and JSON
Definition: json.hpp:2557
#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type,...)
macro
Definition: json.hpp:2755
#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type,...)
Definition: json.hpp:2759
Definition: WeArtCommon.h:179
const int defaultTextureIndex
Definition: WeArtCommon.h:198
const int nullTextureIndex
Definition: WeArtCommon.h:201
const float dynamicForceSensibility
Definition: WeArtCommon.h:220
const float defaultCollisionMultiplier
Definition: WeArtCommon.h:207
const float defaultTemperature
Definition: WeArtCommon.h:184
const float minForce
Definition: WeArtCommon.h:189
const float minTemperature
Definition: WeArtCommon.h:185
const float minVolumeTexture
Definition: WeArtCommon.h:212
const float maxCollisionMultiplier
Definition: WeArtCommon.h:209
const int maxTextureIndex
Definition: WeArtCommon.h:200
const float defaultTextureVelocity[3]
Definition: WeArtCommon.h:203
const float thresholdThumbClosure
Definition: WeArtCommon.h:215
const std::string WEART_SDK_TRACK_TYPE
Definition: WeArtCommon.h:182
const float maxVolumeTexture
Definition: WeArtCommon.h:213
const float staticTextureVelocity
Definition: WeArtCommon.h:196
const std::string WEART_SDK_VERSION
Definition: WeArtCommon.h:181
const float defaultClosure
Definition: WeArtCommon.h:192
const float thresholdMiddleClosure
Definition: WeArtCommon.h:217
const float defaultGraspForce
Definition: WeArtCommon.h:219
const float maxClosure
Definition: WeArtCommon.h:194
const float maxTextureVelocity[3]
Definition: WeArtCommon.h:205
const std::string WEART_SDK_TYPE
Definition: WeArtCommon.h:180
const float defaultVolumeTexture
Definition: WeArtCommon.h:211
const float defaultForce
Definition: WeArtCommon.h:188
const float thresholdIndexClosure
Definition: WeArtCommon.h:216
const float minTextureVelocity[3]
Definition: WeArtCommon.h:204
const float minCollisionMultiplier
Definition: WeArtCommon.h:208
const float maxTemperature
Definition: WeArtCommon.h:186
const int minTextureIndex
Definition: WeArtCommon.h:199
const float maxForce
Definition: WeArtCommon.h:190
const float minClosure
Definition: WeArtCommon.h:193
Status of a connected TouchDIVER device.
Definition: WeArtCommon.h:135
int batteryLevel
Battery charge level (from 0 to 100)
Definition: WeArtCommon.h:143
EHandSide handSide
Hand to which the device is assigned.
Definition: WeArtCommon.h:140
bool charging
Tells whether the device is under charge (true) or not (false)
Definition: WeArtCommon.h:146
std::string macAddress
Device BLE mac address.
Definition: WeArtCommon.h:137
std::vector< ThimbleStatus > thimbles
Status of the device thimbles.
Definition: WeArtCommon.h:149
Definition: WeArtCommon.h:85
Definition: WeArtCommon.h:104
EHandSide handSide
Definition: WeArtCommon.h:106
std::string macAddress
Definition: WeArtCommon.h:105
Definition: WeArtCommon.h:110
std::string version
Definition: WeArtCommon.h:113
std::string errorDesc
Definition: WeArtCommon.h:115
std::vector< MiddlewareConnectedDevice > connectedDevices
Definition: WeArtCommon.h:117
std::string status
Definition: WeArtCommon.h:112
std::uint64_t timestamp
Definition: WeArtCommon.h:111
int statusCode
Definition: WeArtCommon.h:114
bool actuationsEnabled
Definition: WeArtCommon.h:116
Definition: WeArtCommon.h:97
GyroscopeData gyroscope
Definition: WeArtCommon.h:99
TofData timeOfFlight
Definition: WeArtCommon.h:100
AccelerometerData accelerometer
Definition: WeArtCommon.h:98
Status of a single thimble connected to a device.
Definition: WeArtCommon.h:122
EActuationPoint id
Actuation Point to which the thimble is assigned.
Definition: WeArtCommon.h:124
std::string errorDesc
Description of the thimble status code.
Definition: WeArtCommon.h:130
bool connected
Tells whether the thimble is connected to the device or not.
Definition: WeArtCommon.h:126
int statusCode
Current status code of the thimble (0 = OK)
Definition: WeArtCommon.h:128
Definition: WeArtCommon.h:92