Low-Level C++ SDK  v1.2.0
Loading...
Searching...
No Matches
WeArtCommon.h
Go to the documentation of this file.
1
2
3#pragma once
4#include <vector>
5
6#define WIN32_LEAN_AND_MEAN
7#include <windows.h>
8
9#include <string>
10#include "nlohmann/json.hpp"
11
12enum class TrackingType {
13 DEFAULT,
15};
16
17enum class HandSide {
18 //HSnone = 0
19 Left = 1 << 0,
20 Right = 1 << 1,
21};
23 {HandSide::Left, "LEFT"},
24 {HandSide::Right, "RIGHT"},
25})
26
27
28enum class ActuationPoint {
29 //APnone = 0
30 Thumb = 1 << 0,
31 Index = 1 << 1,
32 Middle = 1 << 2,
33 Palm = 1 << 3,
34};
36 {ActuationPoint::Thumb, "THUMB"},
37 {ActuationPoint::Index, "INDEX"},
38 {ActuationPoint::Middle, "MIDDLE"},
39 {ActuationPoint::Palm, "PALM"},
40})
41
42
43enum HandClosingState {
44 Open = 0,
45 Closing = 1,
46 Closed = 2
47};
48
49
52 Released = 1
53};
54
56 IDLE = 0,
59};
60
61enum class MiddlewareStatus {
63 IDLE,
65 RUNNING,
70};
72 {MiddlewareStatus::DISCONNECTED, "DISCONNECTED"},
73 {MiddlewareStatus::IDLE, "IDLE"},
74 {MiddlewareStatus::STARTING, "STARTING"},
75 {MiddlewareStatus::RUNNING, "RUNNING"},
76 {MiddlewareStatus::STOPPING, "STOPPING"},
77 {MiddlewareStatus::UPLOADING_TEXTURES, "UPLOADING_TEXTURES"},
78 {MiddlewareStatus::CONNECTING_DEVICE, "CONNECTING_DEVICE"},
79 {MiddlewareStatus::CALIBRATION, "CALIBRATION"},
80})
81
82
83enum class TextureType : uint8 {
84 ClickNormal = 0, ClickSoft = 1, DoubleClick = 2,
85 AluminiumFineMeshSlow = 3, AluminiumFineMeshFast = 4,
86 PlasticMeshSlow = 5, ProfiledAluminiumMeshMedium = 6, ProfiledAluminiumMeshFast = 7,
87 RhombAluminiumMeshMedium = 8,
88 TextileMeshMedium = 9,
89 CrushedRock = 10,
90 VenetianGranite = 11,
91 SilverOak = 12,
92 LaminatedWood = 13,
93 ProfiledRubberSlow = 14,
94 VelcroHooks = 15,
95 VelcroLoops = 16,
96 PlasticFoil2 = 17,
97 Leather = 18,
98 Cotton1 = 19,
99 Aluminium = 20,
100 DoubleSidedTape = 21
101};
102
103
105 float x = 0.0f;
106 float y = 0.0f;
107 float z = 0.0f;
108};
110
112 float x = 0.0f;
113 float y = 0.0f;
114 float z = 0.0f;
115};
117
118struct TofData {
119 int distance = 0;
120};
122
127};
128NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SensorData, accelerometer, gyroscope, timeOfFlight)
129
135};
136NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(AnalogSensorRawData, ntcTemperatureRaw, ntcTemperatureConverted, forceSensingRaw, forceSensingConverted)
137
139 std::string macAddress;
141};
143
145 std::uint64_t timestamp;
147 std::string version;
149 std::string errorDesc;
151 std::vector<MiddlewareConnectedDevice> connectedDevices;
152};
153NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(MiddlewareStatusData, status, version, statusCode, errorDesc, actuationsEnabled, connectedDevices);
154
158 ActuationPoint id;
164 std::string errorDesc;
165};
167
171 std::string macAddress;
172
175
178
181
183 std::vector<ThimbleStatus> thimbles;
184};
185NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(ConnectedDeviceStatus, macAddress, handSide, batteryLevel, charging, thimbles);
186
187// Constants shared by the WeArt components
188namespace WeArtConstants {
189 const PCSTR DEFAULT_IP_ADDRESS = "127.0.0.1";
190 const PCSTR DEFAULT_TCP_PORT = "13031";
191
192 const std::string WEART_SDK_VERSION = "1.0.0";
193 const std::string WEART_SDK_TYPE = "SdkLLCPP";
194
195 const float defaultTemperature = 0.5f;
196 const float minTemperature = 0.0f;
197 const float maxTemperature = 1.0f;
198
199 const float defaultForce = 0.0f;
200 const float minForce = 0.0f;
201 const float maxForce = 1.0f;
202
203 const float defaultClosure = 0.0f;
204 const float minClosure = 0.0f;
205 const float maxClosure = 1.0f;
206
207 const float defaultAbduction = 0.442f;
208
209 const int defaultTextureIndex = 0;
210 const int minTextureIndex = 0;
211 const int maxTextureIndex = 21;
212 const int nullTextureIndex = 255;
213
214 const float defaultCollisionMultiplier = 20.0f;
215 const float minCollisionMultiplier = 0.0f;
216 const float maxCollisionMultiplier = 100.0f;
217
218 const float defaultVolumeTexture = 100.0f;
219 const float minVolumeTexture = 0.0f;
220 const float maxVolumeTexture = 100.0f;
221
222 const float thresholdThumbClosure = 0.5f;
223 const float thresholdIndexClosure = 0.5f;
224 const float thresholdMiddleClosure = 0.5f;
225
226 const float defaultGraspForce = 0.3f;
227 const float dynamicForceSensibility = 10.0f;
228};
CalibrationStatus
Definition: WeArtCommon.h:55
@ Running
Definition: WeArtCommon.h:58
@ Calibrating
Definition: WeArtCommon.h:57
@ IDLE
Definition: WeArtCommon.h:56
MiddlewareStatus
Definition: WeArtCommon.h:61
GraspingState
Definition: WeArtCommon.h:50
@ Grabbed
Definition: WeArtCommon.h:51
@ Released
Definition: WeArtCommon.h:52
HandSide
Definition: WeArtCommon.h:17
TrackingType
Definition: WeArtCommon.h:12
@ DEFAULT
Deprecated, contains only closure values.
@ WEART_HAND
Tracking with closures, and abduction value for thumb.
#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:188
const int defaultTextureIndex
Definition: WeArtCommon.h:209
const int nullTextureIndex
Definition: WeArtCommon.h:212
const float dynamicForceSensibility
Definition: WeArtCommon.h:227
const float defaultCollisionMultiplier
Definition: WeArtCommon.h:214
const float defaultAbduction
Definition: WeArtCommon.h:207
const float defaultTemperature
Definition: WeArtCommon.h:195
const float minForce
Definition: WeArtCommon.h:200
const PCSTR DEFAULT_IP_ADDRESS
Definition: WeArtCommon.h:189
const PCSTR DEFAULT_TCP_PORT
Definition: WeArtCommon.h:190
const float minTemperature
Definition: WeArtCommon.h:196
const float minVolumeTexture
Definition: WeArtCommon.h:219
const float maxCollisionMultiplier
Definition: WeArtCommon.h:216
const int maxTextureIndex
Definition: WeArtCommon.h:211
const float thresholdThumbClosure
Definition: WeArtCommon.h:222
const float maxVolumeTexture
Definition: WeArtCommon.h:220
const std::string WEART_SDK_VERSION
Definition: WeArtCommon.h:192
const float defaultClosure
Definition: WeArtCommon.h:203
const float thresholdMiddleClosure
Definition: WeArtCommon.h:224
const float defaultGraspForce
Definition: WeArtCommon.h:226
const float maxClosure
Definition: WeArtCommon.h:205
const std::string WEART_SDK_TYPE
Definition: WeArtCommon.h:193
const float defaultVolumeTexture
Definition: WeArtCommon.h:218
const float defaultForce
Definition: WeArtCommon.h:199
const float thresholdIndexClosure
Definition: WeArtCommon.h:223
const float minCollisionMultiplier
Definition: WeArtCommon.h:215
const float maxTemperature
Definition: WeArtCommon.h:197
const int minTextureIndex
Definition: WeArtCommon.h:210
const float maxForce
Definition: WeArtCommon.h:201
const float minClosure
Definition: WeArtCommon.h:204
Definition: WeArtCommon.h:104
float y
Definition: WeArtCommon.h:106
float x
Definition: WeArtCommon.h:105
float z
Definition: WeArtCommon.h:107
Definition: WeArtCommon.h:130
float forceSensingConverted
Definition: WeArtCommon.h:134
float ntcTemperatureRaw
Definition: WeArtCommon.h:131
float ntcTemperatureConverted
Definition: WeArtCommon.h:132
float forceSensingRaw
Definition: WeArtCommon.h:133
Status of a connected TouchDIVER device.
Definition: WeArtCommon.h:169
HandSide handSide
Hand to which the device is assigned.
Definition: WeArtCommon.h:174
int batteryLevel
Battery charge level (from 0 to 100)
Definition: WeArtCommon.h:177
bool charging
Tells whether the device is under charge (true) or not (false)
Definition: WeArtCommon.h:180
std::string macAddress
Device BLE mac address.
Definition: WeArtCommon.h:171
std::vector< ThimbleStatus > thimbles
Status of the device thimbles.
Definition: WeArtCommon.h:183
Definition: WeArtCommon.h:111
Definition: WeArtCommon.h:138
HandSide handSide
Definition: WeArtCommon.h:140
std::string macAddress
Definition: WeArtCommon.h:139
Definition: WeArtCommon.h:144
std::string version
Definition: WeArtCommon.h:147
MiddlewareStatus status
Definition: WeArtCommon.h:146
std::string errorDesc
Definition: WeArtCommon.h:149
std::vector< MiddlewareConnectedDevice > connectedDevices
Definition: WeArtCommon.h:151
std::uint64_t timestamp
Definition: WeArtCommon.h:145
int statusCode
Definition: WeArtCommon.h:148
bool actuationsEnabled
Definition: WeArtCommon.h:150
Definition: WeArtCommon.h:123
GyroscopeData gyroscope
Definition: WeArtCommon.h:125
TofData timeOfFlight
Definition: WeArtCommon.h:126
AccelerometerData accelerometer
Definition: WeArtCommon.h:124
Status of a single thimble connected to a device.
Definition: WeArtCommon.h:156
std::string errorDesc
Description of the thimble status code.
Definition: WeArtCommon.h:164
ActuationPoint id
Actuation Point to which the thimble is assigned.
Definition: WeArtCommon.h:158
bool connected
Tells whether the thimble is connected to the device or not.
Definition: WeArtCommon.h:160
int statusCode
Current status code of the thimble (0 = OK)
Definition: WeArtCommon.h:162
Definition: WeArtCommon.h:118