8static HandSide StringToHandside(std::string &str) {
12 else if (str ==
"RIGHT") {
22static std::string HandsideToString(
HandSide hs) {
40 else if (str ==
"INDEX") {
43 else if (str ==
"MIDDLE") {
46 else if (str ==
"PALM") {
75static TrackingType StringToTrackingType(
const std::string& str) {
76 if (str ==
"TrackType1")
81static std::string TrackingTypeToString(
TrackingType trackType) {
97 virtual std::string
getID() = 0;
99 virtual void setValues(std::vector<std::string>& values) = 0;
115 virtual std::vector<std::string>
getValues()
override {
return std::vector<std::string>(); };
116 virtual void setValues(std::vector<std::string>& values)
override {};
139 virtual std::string
getID()
override {
return std::string(
"StartFromClient"); };
142 std::vector<std::string> ret;
143 if (_trackType != TrackingType::DEFAULT) {
151 virtual void setValues(std::vector<std::string>& values)
override {
153 _trackType = TrackingType::DEFAULT;
155 _trackType = StringToTrackingType(values[2]);
168 virtual std::string
getID()
override {
return std::string(
"StopFromClient"); };
177 virtual std::string
getID()
override {
return std::string(
"StartCalibration"); };
186 virtual std::string
getID()
override {
return std::string(
"StopCalibration"); };
195 virtual std::string
getID()
override {
return std::string(
"exit"); };
204 virtual std::string
getID()
override {
return std::string(
"disconnect"); };
215 virtual std::string
getID()
override {
return std::string(
"temperature"); };
218 std::vector<std::string> ret;
220 ret.push_back(HandsideToString(
handSide));
225 virtual void setValues(std::vector<std::string>& values)
override {
226 assert(values.size() == 3);
228 handSide = StringToHandside(values[1]);
244 virtual std::string
getID()
override {
return std::string(
"stopTemperature"); };
247 std::vector<std::string> ret;
248 ret.push_back(HandsideToString(
handSide));
253 virtual void setValues(std::vector<std::string>& values)
override {
254 assert(values.size() == 2);
255 handSide = StringToHandside(values[0]);
269 virtual std::string
getID()
override {
return std::string(
"force"); };
272 std::vector<std::string> ret;
273 ret.push_back(std::to_string(
force[0]));
274 ret.push_back(std::to_string(
force[1]));
275 ret.push_back(std::to_string(
force[2]));
276 ret.push_back(HandsideToString(
handSide));
281 virtual void setValues(std::vector<std::string>& values)
override {
282 assert(values.size() == 5);
283 force[0] = std::stof(values[0]);
284 force[1] = std::stof(values[1]);
285 force[2] = std::stof(values[2]);
286 handSide = StringToHandside(values[3]);
302 virtual std::string
getID()
override {
return std::string(
"stopForce"); };
305 std::vector<std::string> ret;
306 ret.push_back(HandsideToString(
handSide));
311 virtual void setValues(std::vector<std::string>& values)
override {
312 assert(values.size() == 2);
313 handSide = StringToHandside(values[0]);
327 virtual std::string
getID()
override {
return std::string(
"texture"); };
330 std::vector<std::string> ret;
337 ret.push_back(std::to_string(
index));
338 ret.push_back(std::to_string(
velocity[0]));
339 ret.push_back(std::to_string(
velocity[1]));
340 ret.push_back(std::to_string(
velocity[2]));
341 ret.push_back(std::to_string(
volume));
342 ret.push_back(HandsideToString(
handSide));
347 virtual void setValues(std::vector<std::string>& values)
override {
348 assert(values.size() == 6);
349 index = std::stoi(values[0]);
353 volume = std::stof(values[4]);
354 handSide = StringToHandside(values[5]);
372 virtual std::string
getID()
override {
return std::string(
"stopTexture"); };
375 std::vector<std::string> ret;
376 ret.push_back(HandsideToString(
handSide));
381 virtual void setValues(std::vector<std::string>& values)
override {
382 assert(values.size() == 2);
383 handSide = StringToHandside(values[0]);
394 uint8 RightThumbClosure;
395 uint8 RightIndexClosure;
396 uint8 RightMiddleClosure;
397 uint8 RightPalmClosure;
398 uint8 LeftThumbClosure;
399 uint8 LeftIndexClosure;
400 uint8 LeftMiddleClosure;
401 uint8 LeftPalmClosure;
404 uint8 RightThumbAbduction;
405 uint8 LeftThumbAbduction;
411 virtual std::string
getID()
override {
return std::string(
"Tracking"); };
420 std::vector<std::string> ret;
421 ret.push_back(std::to_string(RightThumbClosure));
422 ret.push_back(std::to_string(RightIndexClosure));
423 ret.push_back(std::to_string(RightMiddleClosure));
424 ret.push_back(std::to_string(RightPalmClosure));
425 ret.push_back(std::to_string(LeftThumbClosure));
426 ret.push_back(std::to_string(LeftIndexClosure));
427 ret.push_back(std::to_string(LeftMiddleClosure));
428 ret.push_back(std::to_string(LeftPalmClosure));
432 virtual void setValues(std::vector<std::string>& values)
override {
433 _trackingType = StringToTrackingType(values[0]);
434 switch (_trackingType) {
435 case TrackingType::DEFAULT:
437 assert(values.size() == 8);
438 RightThumbClosure = std::stoi(values[0]);
439 RightIndexClosure = std::stoi(values[1]);
440 RightMiddleClosure = std::stoi(values[2]);
441 RightPalmClosure = std::stoi(values[3]);
442 LeftThumbClosure = std::stoi(values[4]);
443 LeftIndexClosure = std::stoi(values[5]);
444 LeftMiddleClosure = std::stoi(values[6]);
445 LeftPalmClosure = std::stoi(values[7]);
448 case TrackingType::WEART_HAND:
450 assert(values.size() == 9);
452 RightIndexClosure = std::stoi(values[1]);
453 RightThumbClosure = std::stoi(values[2]);
454 RightThumbAbduction = std::stoi(values[3]);
455 RightMiddleClosure = std::stoi(values[4]);
458 LeftIndexClosure = std::stoi(values[5]);
459 LeftThumbClosure = std::stoi(values[6]);
460 LeftThumbAbduction = std::stoi(values[7]);
461 LeftMiddleClosure = std::stoi(values[8]);
467 uint8 byteValue = 0x00;
471 switch (actuationPoint)
473 case ActuationPoint::Thumb: byteValue = LeftThumbClosure;
break;
474 case ActuationPoint::Index: byteValue = LeftIndexClosure;
break;
475 case ActuationPoint::Middle: byteValue = LeftMiddleClosure;
break;
476 case ActuationPoint::Palm: byteValue = LeftPalmClosure;
break;
479 case HandSide::Right:
480 switch (actuationPoint)
482 case ActuationPoint::Thumb: byteValue = RightThumbClosure;
break;
483 case ActuationPoint::Index: byteValue = RightIndexClosure;
break;
484 case ActuationPoint::Middle: byteValue = RightMiddleClosure;
break;
485 case ActuationPoint::Palm: byteValue = RightPalmClosure;
break;
490 float num(byteValue);
496 float maxAbductionValue = 255;
499 if (actuationPoint == ActuationPoint::Thumb)
return ((
float)LeftThumbAbduction) / maxAbductionValue;
501 case HandSide::Right:
502 if (actuationPoint == ActuationPoint::Thumb)
return ((
float)RightThumbAbduction) / maxAbductionValue;
HandSide
Definition: WeArtCommon.h:7
@ Left
Definition: WeArtCommon.h:9
@ Right
Definition: WeArtCommon.h:10
TrackingType
Definition: WeArtCommon.h:26
@ DEFAULT
Deprecated, contains only closure values.
@ WEART_HAND
Tracking with closures, and abduction value for thumb.
ActuationPoint
Definition: WeArtCommon.h:17
@ Index
Definition: WeArtCommon.h:20
@ Thumb
Definition: WeArtCommon.h:19
@ Middle
Definition: WeArtCommon.h:21
@ Palm
Definition: WeArtCommon.h:22
Message to the middleware to disconnect.
Definition: WeArtMessages.h:201
virtual std::string getID() override
Definition: WeArtMessages.h:204
Message to the middleware to exit the connection.
Definition: WeArtMessages.h:192
virtual std::string getID() override
Definition: WeArtMessages.h:195
Message to the middleware to set the force of the effect.
Definition: WeArtMessages.h:264
float force[3]
Definition: WeArtMessages.h:292
virtual std::vector< std::string > getValues() override
Definition: WeArtMessages.h:271
SetForceMessage()
Definition: WeArtMessages.h:268
SetForceMessage(const float f[3])
Definition: WeArtMessages.h:267
virtual void setValues(std::vector< std::string > &values) override
Definition: WeArtMessages.h:281
virtual std::string getID() override
Definition: WeArtMessages.h:269
Message to the middleware to set the temperature of the effect.
Definition: WeArtMessages.h:211
float temperature
Definition: WeArtMessages.h:234
virtual std::vector< std::string > getValues() override
Definition: WeArtMessages.h:217
SetTemperatureMessage()
Definition: WeArtMessages.h:214
virtual void setValues(std::vector< std::string > &values) override
Definition: WeArtMessages.h:225
SetTemperatureMessage(const float t)
Definition: WeArtMessages.h:213
virtual std::string getID() override
Definition: WeArtMessages.h:215
Message to the middleware to set the texture of the effect.
Definition: WeArtMessages.h:322
float velocity[3]
Definition: WeArtMessages.h:361
float volume
Definition: WeArtMessages.h:362
virtual void setValues(std::vector< std::string > &values) override
Definition: WeArtMessages.h:347
SetTextureMessage()
Definition: WeArtMessages.h:326
virtual std::string getID() override
Definition: WeArtMessages.h:327
SetTextureMessage(const int idx, const float vel[3], const float vol)
Definition: WeArtMessages.h:325
int index
Definition: WeArtMessages.h:360
virtual std::vector< std::string > getValues() override
Definition: WeArtMessages.h:329
Message to the middleware to start the calibration.
Definition: WeArtMessages.h:174
virtual std::string getID() override
Definition: WeArtMessages.h:177
Message to middleware to start the connection.
Definition: WeArtMessages.h:135
virtual std::vector< std::string > getValues() override
Definition: WeArtMessages.h:141
virtual void setValues(std::vector< std::string > &values) override
Definition: WeArtMessages.h:151
virtual std::string getID() override
Definition: WeArtMessages.h:139
Message to the middleware to stop the calibration.
Definition: WeArtMessages.h:183
virtual std::string getID() override
Definition: WeArtMessages.h:186
Message to the middleware to stop the temperature of the effect.
Definition: WeArtMessages.h:299
virtual std::string getID() override
Definition: WeArtMessages.h:302
virtual std::vector< std::string > getValues() override
Definition: WeArtMessages.h:304
virtual void setValues(std::vector< std::string > &values) override
Definition: WeArtMessages.h:311
Message to middleware to stop the connection.
Definition: WeArtMessages.h:165
virtual std::string getID() override
Definition: WeArtMessages.h:168
Message to the middleware to stop the temperature of the effect.
Definition: WeArtMessages.h:241
virtual void setValues(std::vector< std::string > &values) override
Definition: WeArtMessages.h:253
virtual std::string getID() override
Definition: WeArtMessages.h:244
virtual std::vector< std::string > getValues() override
Definition: WeArtMessages.h:246
Message to the middleware to stop the texture of the effect.
Definition: WeArtMessages.h:369
virtual std::vector< std::string > getValues() override
Definition: WeArtMessages.h:374
virtual std::string getID() override
Definition: WeArtMessages.h:372
virtual void setValues(std::vector< std::string > &values) override
Definition: WeArtMessages.h:381
Generic Tracking message, contains information on closure and abduction (based on tracking type)
Definition: WeArtMessages.h:392
virtual std::vector< std::string > getValues() override
Definition: WeArtMessages.h:419
float GetClosure(HandSide handSide, ActuationPoint actuationPoint)
Definition: WeArtMessages.h:466
virtual std::string getID() override
Definition: WeArtMessages.h:411
float GetAbduction(HandSide handSide, ActuationPoint actuationPoint)
Definition: WeArtMessages.h:495
virtual void setValues(std::vector< std::string > &values) override
Definition: WeArtMessages.h:432
Generic Weart message.
Definition: WeArtMessages.h:94
virtual void setValues(std::vector< std::string > &values)=0
virtual std::string getID()=0
virtual std::vector< std::string > getValues()=0
virtual void setActuationPoint(ActuationPoint ap)=0
virtual void setHandSide(HandSide hs)=0
Message without handside or actuation point parameters.
Definition: WeArtMessages.h:108
virtual std::vector< std::string > getValues() override
Definition: WeArtMessages.h:115
virtual void setValues(std::vector< std::string > &values) override
Definition: WeArtMessages.h:116
virtual void setActuationPoint(ActuationPoint ap) override
Definition: WeArtMessages.h:112
virtual void setHandSide(HandSide hs) override
Definition: WeArtMessages.h:111
Message without handside or actuation point parameters.
Definition: WeArtMessages.h:122
ActuationPoint actuationPoint
Definition: WeArtMessages.h:126
virtual void setActuationPoint(ActuationPoint ap) override
Definition: WeArtMessages.h:129
virtual void setHandSide(HandSide hs) override
Definition: WeArtMessages.h:128
HandSide handSide
Definition: WeArtMessages.h:125
const int nullTextureIndex
Definition: WeArtCommon.h:93
const int maxTextureIndex
Definition: WeArtCommon.h:92
const std::string WEART_SDK_TRACK_TYPE
Definition: WeArtCommon.h:74
const std::string WEART_SDK_VERSION
Definition: WeArtCommon.h:73
const std::string WEART_SDK_TYPE
Definition: WeArtCommon.h:72
Definition: WeArtMessages.h:413
float Y
Definition: WeArtMessages.h:415
float Z
Definition: WeArtMessages.h:416
float X
Definition: WeArtMessages.h:414